]> Gentwo Git Trees - linux/.git/commitdiff
btrfs: remove unnecessary inode key in btrfs_log_all_parents()
authorFilipe Manana <fdmanana@suse.com>
Fri, 21 Nov 2025 16:56:46 +0000 (16:56 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 25 Nov 2025 00:53:33 +0000 (01:53 +0100)
We are setting up an inode key to lookup parent directory inode but all we
need is the inode's objectid. The use of the key was necessary in the past
but since commit 0202e83fdab0 ("btrfs: simplify iget helpers") we only
need the objectid.

So remove the key variable in the stack and use instead a simple u64 for
the inode's objectid.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
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 651e6747dcec24916b4b206aa507061b3c54dad0..fff37c8d96a45d2c75c77a4fe9235c127a6a5885 100644 (file)
@@ -7201,28 +7201,24 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
                item_size = btrfs_item_size(leaf, slot);
                ptr = btrfs_item_ptr_offset(leaf, slot);
                while (cur_offset < item_size) {
-                       struct btrfs_key inode_key;
+                       u64 dir_id;
                        struct btrfs_inode *dir_inode;
 
-                       inode_key.type = BTRFS_INODE_ITEM_KEY;
-                       inode_key.offset = 0;
-
                        if (key.type == BTRFS_INODE_EXTREF_KEY) {
                                struct btrfs_inode_extref *extref;
 
                                extref = (struct btrfs_inode_extref *)
                                        (ptr + cur_offset);
-                               inode_key.objectid = btrfs_inode_extref_parent(
-                                       leaf, extref);
+                               dir_id = btrfs_inode_extref_parent(leaf, extref);
                                cur_offset += sizeof(*extref);
                                cur_offset += btrfs_inode_extref_name_len(leaf,
                                        extref);
                        } else {
-                               inode_key.objectid = key.offset;
+                               dir_id = key.offset;
                                cur_offset = item_size;
                        }
 
-                       dir_inode = btrfs_iget_logging(inode_key.objectid, root);
+                       dir_inode = btrfs_iget_logging(dir_id, root);
                        /*
                         * If the parent inode was deleted, return an error to
                         * fallback to a transaction commit. This is to prevent