]> git.hungrycats.org Git - bees/commitdiff
roots: use symbolic names for SCAN_MODEs
authorZygo Blaxell <bees@furryterror.org>
Wed, 24 Oct 2018 05:43:22 +0000 (01:43 -0400)
committerZygo Blaxell <bees@furryterror.org>
Wed, 21 Dec 2022 01:51:00 +0000 (20:51 -0500)
This was done on the development branch three years ago, and
has been creating annoying merge conflicts ever since.  Sync
up the branches so they have the same names for these.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees-roots.cc
src/bees.cc
src/bees.h

index b65eba936200d917ac4b513148ba0e69eccb0c37..146af05f66be351c5fa1a567c906bad32458c178 100644 (file)
@@ -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<BeesCrawl> 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<shared_ptr<BeesCrawl>> crawl_vector;
                        for (auto i : crawl_map_copy) {
index 768b33307b3d216eb1a5cdcbd713ace22a4d4746..e4b58bc04526e4915b50964176fe8a3fda760d8c 100644 (file)
@@ -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[] = {
index e1488e5442af4b0d40609a7d34053d0653e5a4d7..26fec38bf8fe3b7c7339b4079923eed81d981f23 100644 (file)
@@ -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);
 
 };