Skip to content

Commit cf5a2fd

Browse files
fdmananakdave
authored andcommitted
btrfs: remove unnecessary inode key in btrfs_log_all_parents()
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 0202e83 ("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>
1 parent 5012542 commit cf5a2fd

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

fs/btrfs/tree-log.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7201,28 +7201,24 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
72017201
item_size = btrfs_item_size(leaf, slot);
72027202
ptr = btrfs_item_ptr_offset(leaf, slot);
72037203
while (cur_offset < item_size) {
7204-
struct btrfs_key inode_key;
7204+
u64 dir_id;
72057205
struct btrfs_inode *dir_inode;
72067206

7207-
inode_key.type = BTRFS_INODE_ITEM_KEY;
7208-
inode_key.offset = 0;
7209-
72107207
if (key.type == BTRFS_INODE_EXTREF_KEY) {
72117208
struct btrfs_inode_extref *extref;
72127209

72137210
extref = (struct btrfs_inode_extref *)
72147211
(ptr + cur_offset);
7215-
inode_key.objectid = btrfs_inode_extref_parent(
7216-
leaf, extref);
7212+
dir_id = btrfs_inode_extref_parent(leaf, extref);
72177213
cur_offset += sizeof(*extref);
72187214
cur_offset += btrfs_inode_extref_name_len(leaf,
72197215
extref);
72207216
} else {
7221-
inode_key.objectid = key.offset;
7217+
dir_id = key.offset;
72227218
cur_offset = item_size;
72237219
}
72247220

7225-
dir_inode = btrfs_iget_logging(inode_key.objectid, root);
7221+
dir_inode = btrfs_iget_logging(dir_id, root);
72267222
/*
72277223
* If the parent inode was deleted, return an error to
72287224
* fallback to a transaction commit. This is to prevent

0 commit comments

Comments
 (0)