diff --git a/src/bees-roots.cc b/src/bees-roots.cc index b65eba9..146af05 100644 --- a/src/bees-roots.cc +++ b/src/bees-roots.cc @@ -54,10 +54,9 @@ string BeesRoots::scan_mode_ntoa(BeesRoots::ScanMode mode) { static const bits_ntoa_table table[] = { - NTOA_TABLE_ENTRY_ENUM(SCAN_MODE_ZERO), - NTOA_TABLE_ENTRY_ENUM(SCAN_MODE_ONE), - NTOA_TABLE_ENTRY_ENUM(SCAN_MODE_TWO), - NTOA_TABLE_ENTRY_ENUM(SCAN_MODE_COUNT), + { .n = SCAN_MODE_LOCKSTEP, .mask = ~0ULL, .a = "lockstep" }, + { .n = SCAN_MODE_INDEPENDENT, .mask = ~0ULL, .a = "independent" }, + { .n = SCAN_MODE_SEQUENTIAL, .mask = ~0ULL, .a = "sequential" }, NTOA_TABLE_ENTRY_END() }; return bits_ntoa(mode, table); @@ -269,8 +268,8 @@ BeesRoots::crawl_roots() switch (m_scan_mode) { - case SCAN_MODE_ZERO: { - // Scan the same inode/offset tuple in each subvol (good for snapshots) + case SCAN_MODE_LOCKSTEP: { + // Scan the same inode/offset tuple in each subvol (bad for locking) BeesFileRange first_range; shared_ptr first_crawl; for (auto i : crawl_map_copy) { @@ -301,7 +300,7 @@ BeesRoots::crawl_roots() break; } - case SCAN_MODE_ONE: { + case SCAN_MODE_INDEPENDENT: { // Scan each subvol one extent at a time (good for continuous forward progress) size_t batch_count = 0; for (auto i : crawl_map_copy) { @@ -315,7 +314,7 @@ BeesRoots::crawl_roots() break; } - case SCAN_MODE_TWO: { + case SCAN_MODE_SEQUENTIAL: { // Scan oldest crawl first (requires maximum amount of temporary space) vector> crawl_vector; for (auto i : crawl_map_copy) { diff --git a/src/bees.cc b/src/bees.cc index 768b333..e4b58bc 100644 --- a/src/bees.cc +++ b/src/bees.cc @@ -601,7 +601,7 @@ bees_main(int argc, char *argv[]) unsigned thread_min = 0; double load_target = 0; bool workaround_btrfs_send = false; - BeesRoots::ScanMode root_scan_mode = BeesRoots::SCAN_MODE_ZERO; + BeesRoots::ScanMode root_scan_mode = BeesRoots::SCAN_MODE_LOCKSTEP; // Configure getopt_long static const struct option long_options[] = { diff --git a/src/bees.h b/src/bees.h index e1488e5..26fec38 100644 --- a/src/bees.h +++ b/src/bees.h @@ -594,12 +594,11 @@ public: Fd open_root_ino(const BeesFileId &bfi) { return open_root_ino(bfi.root(), bfi.ino()); } bool is_root_ro(uint64_t root); - // TODO: think of better names for these. - // or TODO: do extent-tree scans instead + // TODO: do extent-tree scans instead enum ScanMode { - SCAN_MODE_ZERO, - SCAN_MODE_ONE, - SCAN_MODE_TWO, + SCAN_MODE_LOCKSTEP, + SCAN_MODE_INDEPENDENT, + SCAN_MODE_SEQUENTIAL, SCAN_MODE_COUNT, // must be last }; @@ -607,7 +606,7 @@ public: void set_workaround_btrfs_send(bool do_avoid); private: - ScanMode m_scan_mode = SCAN_MODE_ZERO; + ScanMode m_scan_mode = SCAN_MODE_LOCKSTEP; static string scan_mode_ntoa(ScanMode new_mode); };