]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: use the inode item boolean everywhere in overwrite_item()
authorFilipe Manana <fdmanana@suse.com>
Fri, 29 Aug 2025 15:46:15 +0000 (16:46 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Sep 2025 06:49:19 +0000 (08:49 +0200)
We have this boolean 'inode_item' to tell if we are processing an inode
item key and we use it in a couple of places while in another two places
we open code by checking if the key type matches the inode item type.
Make this consistent and use the boolean everywhere. Also rename it from
'inode_item' to 'is_inode_item', which makes it more clear that it's a
boolean and not an instance of struct btrfs_inode_item, and make it const
too.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c

index 88e813bb28d8d38e90b1d105fe7713ee3b6c4ba2..d830c33be7c65b2383890eafbe453a06a04a3b4e 100644 (file)
@@ -424,7 +424,7 @@ static int overwrite_item(struct walk_control *wc,
        unsigned long dst_ptr;
        struct extent_buffer *dst_eb;
        int dst_slot;
-       bool inode_item = key->type == BTRFS_INODE_ITEM_KEY;
+       const bool is_inode_item = (key->type == BTRFS_INODE_ITEM_KEY);
 
        /*
         * This is only used during log replay, so the root is always from a
@@ -486,7 +486,7 @@ static int overwrite_item(struct walk_control *wc,
                 * We need to load the old nbytes into the inode so when we
                 * replay the extents we've logged we get the right nbytes.
                 */
-               if (inode_item) {
+               if (is_inode_item) {
                        struct btrfs_inode_item *item;
                        u64 nbytes;
                        u32 mode;
@@ -507,7 +507,7 @@ static int overwrite_item(struct walk_control *wc,
                        if (S_ISDIR(mode))
                                btrfs_set_inode_size(eb, item, 0);
                }
-       } else if (inode_item) {
+       } else if (is_inode_item) {
                struct btrfs_inode_item *item;
                u32 mode;
 
@@ -561,7 +561,7 @@ insert:
         * state of the tree found in the subvolume, and i_size is modified
         * as it goes
         */
-       if (key->type == BTRFS_INODE_ITEM_KEY && ret == -EEXIST) {
+       if (is_inode_item && ret == -EEXIST) {
                struct btrfs_inode_item *src_item;
                struct btrfs_inode_item *dst_item;
 
@@ -602,7 +602,7 @@ insert:
        }
 
        /* make sure the generation is filled in */
-       if (key->type == BTRFS_INODE_ITEM_KEY) {
+       if (is_inode_item) {
                struct btrfs_inode_item *dst_item;
 
                dst_item = (struct btrfs_inode_item *)dst_ptr;