… | |
… | |
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 | |
57 | |
55 | if ($opt_stat) { |
58 | if ($opt_stat) { |
|
|
59 | aio_wd $path, sub { |
|
|
60 | my $wd = shift; |
|
|
61 | |
56 | aio_lstat "$path$_" for @$files; |
62 | aio_lstat [$wd, $_] for @$files; |
|
|
63 | }; |
57 | } |
64 | } |
58 | |
65 | |
59 | &scan ("$path$_") for @$dirs; |
66 | &scan ("$path$_") for @$dirs; |
60 | }; |
67 | }; |
61 | } |
68 | } |
62 | |
69 | |
63 | IO::AIO::max_outstanding 64; |
70 | IO::AIO::max_outstanding 100; # two fds per directory, so limit accordingly |
64 | IO::AIO::min_parallel 32; |
71 | IO::AIO::min_parallel 20; |
65 | |
72 | |
66 | for my $seed (@ARGV) { |
73 | for my $seed (@ARGV) { |
67 | $seed =~ s/\/+$//; |
74 | $seed =~ s/\/+$//; |
68 | aio_lstat "$seed/.", sub { |
75 | aio_lstat "$seed/.", sub { |
69 | if ($_[0]) { |
76 | if ($_[0]) { |