]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/btrfs/delayed-ref.h
btrfs: delayed-ref: Use list to replace the ref_root in ref_head.
[mirror_ubuntu-artful-kernel.git] / fs / btrfs / delayed-ref.h
index 5eb0892396d017ba95645f7ab179a1c8a3696253..362ca57cfeb7d7f74b1639e2627390a09a5a2c0f 100644 (file)
 #define BTRFS_ADD_DELAYED_EXTENT 3 /* record a full extent allocation */
 #define BTRFS_UPDATE_DELAYED_HEAD 4 /* not changing ref count on head ref */
 
+/*
+ * XXX: Qu: I really hate the design that ref_head and tree/data ref shares the
+ * same ref_node structure.
+ * Ref_head is in a higher logic level than tree/data ref, and duplicated
+ * bytenr/num_bytes in ref_node is really a waste or memory, they should be
+ * referred from ref_head.
+ * This gets more disgusting after we use list to store tree/data ref in
+ * ref_head. Must clean this mess up later.
+ */
 struct btrfs_delayed_ref_node {
+       /*
+        * ref_head use rb tree, stored in ref_root->href.
+        * indexed by bytenr
+        */
        struct rb_node rb_node;
 
+       /*data/tree ref use list, stored in ref_head->ref_list. */
+       struct list_head list;
+
        /* the starting bytenr of the extent */
        u64 bytenr;
 
@@ -83,7 +99,7 @@ struct btrfs_delayed_ref_head {
        struct mutex mutex;
 
        spinlock_t lock;
-       struct rb_root ref_root;
+       struct list_head ref_list;
 
        struct rb_node href_node;