Start separate thread for inode ordering

This makes it easier to tell apart in `htop` and similar tools.
This commit is contained in:
Marcus Holland-Moritz 2022-12-24 14:50:42 +01:00
parent 411468872e
commit 9320f502f4

View File

@ -661,8 +661,13 @@ void scanner_<LoggerPolicy>::scan(
LOG_INFO << "building blocks..."; LOG_INFO << "building blocks...";
block_manager bm(lgr_, prog, cfg_, os_, fsw); block_manager bm(lgr_, prog, cfg_, os_, fsw);
{
worker_group blockify("blockify", 1, 1 << 20); worker_group blockify("blockify", 1, 1 << 20);
{
worker_group ordering("ordering", 1);
ordering.add_job([&] {
im.order_inodes(script_, options_.file_order, im.order_inodes(script_, options_.file_order,
[&](std::shared_ptr<inode> const& ino) { [&](std::shared_ptr<inode> const& ino) {
blockify.add_job([&] { blockify.add_job([&] {
@ -677,6 +682,10 @@ void scanner_<LoggerPolicy>::scan(
return INT64_C(500) * queued_blocks + return INT64_C(500) * queued_blocks +
static_cast<int64_t>(queued_files); static_cast<int64_t>(queued_files);
}); });
});
ordering.wait();
}
LOG_INFO << "waiting for segmenting/blockifying to finish..."; LOG_INFO << "waiting for segmenting/blockifying to finish...";
@ -684,6 +693,7 @@ void scanner_<LoggerPolicy>::scan(
LOG_INFO << "segmenting/blockifying CPU time: " LOG_INFO << "segmenting/blockifying CPU time: "
<< time_with_unit(blockify.get_cpu_time()); << time_with_unit(blockify.get_cpu_time());
}
bm.finish_blocks(); bm.finish_blocks();
wg_.wait(); wg_.wait();