btrfs: rename BTRFS_ROOT_REF_COWS to BTRFS_ROOT_SHAREABLE
[linux-block.git] / fs / btrfs / ctree.h
index 0a1fa1526c4351e74cc57cc4158a1e8bcab21295..bf46093be76e4673556e1846d690078e3fe44582 100644 (file)
@@ -969,7 +969,28 @@ enum {
         * is used to tell us when more checks are required
         */
        BTRFS_ROOT_IN_TRANS_SETUP,
-       BTRFS_ROOT_REF_COWS,
+
+       /*
+        * Set if tree blocks of this root can be shared by other roots.
+        * Only subvolume trees and their reloc trees have this bit set.
+        * Conflicts with TRACK_DIRTY bit.
+        *
+        * This affects two things:
+        *
+        * - How balance works
+        *   For shareable roots, we need to use reloc tree and do path
+        *   replacement for balance, and need various pre/post hooks for
+        *   snapshot creation to handle them.
+        *
+        *   While for non-shareable trees, we just simply do a tree search
+        *   with COW.
+        *
+        * - How dirty roots are tracked
+        *   For shareable roots, btrfs_record_root_in_trans() is needed to
+        *   track them, while non-subvolume roots have TRACK_DIRTY bit, they
+        *   don't need to set this manually.
+        */
+       BTRFS_ROOT_SHAREABLE,
        BTRFS_ROOT_TRACK_DIRTY,
        BTRFS_ROOT_IN_RADIX,
        BTRFS_ROOT_ORPHAN_ITEM_INSERTED,
@@ -1055,7 +1076,7 @@ struct btrfs_root {
        struct btrfs_key defrag_progress;
        struct btrfs_key defrag_max;
 
-       /* the dirty list is only used by non-reference counted roots */
+       /* The dirty list is only used by non-shareable roots */
        struct list_head dirty_list;
 
        struct list_head root_list;