mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-04 02:06:22 -04:00
Scan files after scanning directories has finished
Hopefully this will always be more efficient in terms of disk access patterns.
This commit is contained in:
parent
ca0dfa3e53
commit
9788567c39
@ -335,10 +335,6 @@ void scanner_<LoggerPolicy>::scan(filesystem_writer& fsw,
|
|||||||
|
|
||||||
case entry::E_FILE:
|
case entry::E_FILE:
|
||||||
prog.files_found++;
|
prog.files_found++;
|
||||||
wg_.add_job([=, this, &prog] {
|
|
||||||
pe->scan(*os_, prog);
|
|
||||||
prog.files_scanned++;
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case entry::E_LINK:
|
case entry::E_LINK:
|
||||||
@ -374,6 +370,18 @@ void scanner_<LoggerPolicy>::scan(filesystem_writer& fsw,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now scan all files
|
||||||
|
// TODO: automatically adjust # of worker threads based on load
|
||||||
|
root->walk([&](entry* ep) {
|
||||||
|
wg_.add_job([=, this, &prog] {
|
||||||
|
if (ep->type() == entry::E_FILE) {
|
||||||
|
prog.current.store(ep);
|
||||||
|
ep->scan(*os_, prog);
|
||||||
|
prog.files_scanned++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
log_.info() << "waiting for background scanners...";
|
log_.info() << "waiting for background scanners...";
|
||||||
wg_.wait();
|
wg_.wait();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user