]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
btrfs: replace btrfs_delayed_*_ref with btrfs_*_ref
authorJosef Bacik <josef@toxicpanda.com>
Sat, 13 Apr 2024 04:11:22 +0000 (00:11 -0400)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 May 2024 19:31:05 +0000 (21:31 +0200)
Now that these two structs are the same, move the btrfs_data_ref and
btrfs_tree_ref up and use these in the btrfs_delayed_ref_node.  Then
remove the btrfs_delayed_*_ref structs.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/delayed-ref.c
fs/btrfs/delayed-ref.h

index 8d553347e11b2082c736044105111d4df1d398e7..6cc80fb10da239715158753bf7c51020ddab22e0 100644 (file)
@@ -982,12 +982,10 @@ static void init_delayed_ref_common(struct btrfs_fs_info *fs_info,
        RB_CLEAR_NODE(&ref->ref_node);
        INIT_LIST_HEAD(&ref->add_list);
 
-       if (generic_ref->type == BTRFS_REF_DATA) {
-               ref->data_ref.objectid = generic_ref->data_ref.objectid;
-               ref->data_ref.offset = generic_ref->data_ref.offset;
-       } else {
-               ref->tree_ref.level = generic_ref->tree_ref.level;
-       }
+       if (generic_ref->type == BTRFS_REF_DATA)
+               ref->data_ref = generic_ref->data_ref;
+       else
+               ref->tree_ref = generic_ref->tree_ref;
 }
 
 void btrfs_init_tree_ref(struct btrfs_ref *generic_ref, int level, u64 mod_root,
index 09f2c4cfea7f602ff2131daaf361958f550e9f82..04b180ebe1fe03284332996bbed5f17b20463e13 100644 (file)
@@ -30,15 +30,32 @@ enum btrfs_delayed_ref_action {
        BTRFS_UPDATE_DELAYED_HEAD,
 } __packed;
 
-struct btrfs_delayed_tree_ref {
-       int level;
-};
+struct btrfs_data_ref {
+       /* For EXTENT_DATA_REF */
 
-struct btrfs_delayed_data_ref {
+       /* Inode which refers to this data extent */
        u64 objectid;
+
+       /*
+        * file_offset - extent_offset
+        *
+        * file_offset is the key.offset of the EXTENT_DATA key.
+        * extent_offset is btrfs_file_extent_offset() of the EXTENT_DATA data.
+        */
        u64 offset;
 };
 
+struct btrfs_tree_ref {
+       /*
+        * Level of this tree block.
+        *
+        * Shared for skinny (TREE_BLOCK_REF) and normal tree ref.
+        */
+       int level;
+
+       /* For non-skinny metadata, no special member needed */
+};
+
 struct btrfs_delayed_ref_node {
        struct rb_node ref_node;
        /*
@@ -84,8 +101,8 @@ struct btrfs_delayed_ref_node {
        unsigned int type:8;
 
        union {
-               struct btrfs_delayed_tree_ref tree_ref;
-               struct btrfs_delayed_data_ref data_ref;
+               struct btrfs_tree_ref tree_ref;
+               struct btrfs_data_ref data_ref;
        };
 };
 
@@ -222,32 +239,6 @@ enum btrfs_ref_type {
        BTRFS_REF_LAST,
 } __packed;
 
-struct btrfs_data_ref {
-       /* For EXTENT_DATA_REF */
-
-       /* Inode which refers to this data extent */
-       u64 objectid;
-
-       /*
-        * file_offset - extent_offset
-        *
-        * file_offset is the key.offset of the EXTENT_DATA key.
-        * extent_offset is btrfs_file_extent_offset() of the EXTENT_DATA data.
-        */
-       u64 offset;
-};
-
-struct btrfs_tree_ref {
-       /*
-        * Level of this tree block
-        *
-        * Shared for skinny (TREE_BLOCK_REF) and normal tree ref.
-        */
-       int level;
-
-       /* For non-skinny metadata, no special member needed */
-};
-
 struct btrfs_ref {
        enum btrfs_ref_type type;
        enum btrfs_delayed_ref_action action;