Changeset 88

Show
Ignore:
Timestamp:
05/10/07 22:16:27 (2 years ago)
Author:
bradfitz
Message:

halve number of stats when walking backup root

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Changes

    r85 r88  
     1  - halve number of stats when walking backup root 
     2 
    13  - cleanups, strictness 
    24 
  • trunk/lib/Brackup/Root.pm

    r86 r88  
    8383    chdir $self->{dir} or die "Failed to chdir to $self->{dir}"; 
    8484 
     85    my %statcache; # file -> statobj 
     86 
    8587    find({ 
    8688        no_chdir => 1, 
     
    100102                next if $path eq $self->{digdb_file}; 
    101103 
    102                 my (@stat) = stat($path); 
     104                my $statobj = File::stat::lstat($path); 
     105                $statcache{$path} = $statobj; 
     106 
    103107                my $is_dir = -d _; 
    104108 
     
    116120 
    117121        wanted => sub { 
    118             my (@stat) = stat(_); 
    119122            my $path = $_; 
    120123            $path =~ s!^\./!!; 
    121             # TODO: pass along the stat info 
    122             my $file = Brackup::File->new(root => $self, path => $path); 
     124 
     125            my $stat_obj = delete $statcache{$path}; 
     126            my $file = Brackup::File->new(root => $self, 
     127                                          path => $path, 
     128                                          stat => $stat_obj, 
     129                                          ); 
    123130            $cb->($file); 
    124131        },