… | |
… | |
43 | sub scan { |
43 | sub scan { |
44 | my ($path) = @_; |
44 | my ($path) = @_; |
45 | |
45 | |
46 | $path .= "/"; |
46 | $path .= "/"; |
47 | |
47 | |
|
|
48 | IO::AIO::poll_cb; |
|
|
49 | |
48 | aioreq_pri -1; |
50 | aioreq_pri -1; |
49 | aio_scandir $path, 8, sub { |
51 | aio_scandir $path, 8, sub { |
50 | my ($dirs, $files) = @_; |
52 | my ($dirs, $files) = @_ |
|
|
53 | or warn "$path: $!\n"; |
51 | |
54 | |
52 | printfn "", [$path] unless $opt_nodirs; |
55 | printfn "", [$path] unless $opt_nodirs; |
53 | printfn $path, $files unless $opt_nofiles; |
56 | printfn $path, $files unless $opt_nofiles; |
54 | |
|
|
55 | IO::AIO::poll_cb; |
|
|
56 | |
57 | |
57 | if ($opt_stat) { |
58 | if ($opt_stat) { |
58 | aio_wd $path, sub { |
59 | aio_wd $path, sub { |
59 | my $wd = shift; |
60 | my $wd = shift; |
60 | |
61 | |
… | |
… | |
64 | |
65 | |
65 | &scan ("$path$_") for @$dirs; |
66 | &scan ("$path$_") for @$dirs; |
66 | }; |
67 | }; |
67 | } |
68 | } |
68 | |
69 | |
69 | IO::AIO::max_outstanding 400; # two fds per directory, so limit accordingly |
70 | IO::AIO::max_outstanding 100; # two fds per directory, so limit accordingly |
70 | IO::AIO::min_parallel 20; |
71 | IO::AIO::min_parallel 20; |
71 | |
72 | |
72 | for my $seed (@ARGV) { |
73 | for my $seed (@ARGV) { |
73 | $seed =~ s/\/+$//; |
74 | $seed =~ s/\/+$//; |
74 | aio_lstat "$seed/.", sub { |
75 | aio_lstat "$seed/.", sub { |