Skip to content

Commit e41c5e6

Browse files
fdmananakdave
authored andcommitted
btrfs: remove pointless inode lookup when processing extrefs during log replay
At unlink_extrefs_not_in_log() we do an inode lookup of the directory but we already have the directory inode accessible as a function argument, so the lookup is redudant. Remove it and use the directory inode passed in as an argument. 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 bd9c063 commit e41c5e6

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

fs/btrfs/tree-log.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,10 +1165,8 @@ static int unlink_extrefs_not_in_log(struct walk_control *wc,
11651165

11661166
while (cur_offset < item_size) {
11671167
struct btrfs_trans_handle *trans = wc->trans;
1168-
struct btrfs_root *root = wc->root;
11691168
struct btrfs_root *log_root = wc->log;
11701169
struct btrfs_inode_extref *extref;
1171-
struct btrfs_inode *victim_parent;
11721170
struct fscrypt_str victim_name;
11731171
int ret;
11741172

@@ -1202,20 +1200,10 @@ static int unlink_extrefs_not_in_log(struct walk_control *wc,
12021200
continue;
12031201
}
12041202

1205-
victim_parent = btrfs_iget_logging(btrfs_ino(dir), root);
1206-
if (IS_ERR(victim_parent)) {
1207-
kfree(victim_name.name);
1208-
ret = PTR_ERR(victim_parent);
1209-
btrfs_abort_transaction(trans, ret);
1210-
return ret;
1211-
}
1212-
12131203
inc_nlink(&inode->vfs_inode);
12141204
btrfs_release_path(wc->subvol_path);
12151205

1216-
ret = unlink_inode_for_log_replay(wc, victim_parent, inode,
1217-
&victim_name);
1218-
iput(&victim_parent->vfs_inode);
1206+
ret = unlink_inode_for_log_replay(wc, dir, inode, &victim_name);
12191207
kfree(victim_name.name);
12201208
if (ret)
12211209
return ret;

0 commit comments

Comments
 (0)