From: Filipe Manana Date: Wed, 3 Sep 2025 11:10:01 +0000 (+0100) Subject: btrfs: remove pointless inode lookup when processing extrefs during log replay X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e41c5e611a65799747709b8fed461dd07647c40d;p=users%2Fhch%2Fmisc.git 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 Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 6186300923b7..86c595ef57f4 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -1165,10 +1165,8 @@ static int unlink_extrefs_not_in_log(struct walk_control *wc, while (cur_offset < item_size) { struct btrfs_trans_handle *trans = wc->trans; - struct btrfs_root *root = wc->root; struct btrfs_root *log_root = wc->log; struct btrfs_inode_extref *extref; - struct btrfs_inode *victim_parent; struct fscrypt_str victim_name; int ret; @@ -1202,20 +1200,10 @@ next: continue; } - victim_parent = btrfs_iget_logging(btrfs_ino(dir), root); - if (IS_ERR(victim_parent)) { - kfree(victim_name.name); - ret = PTR_ERR(victim_parent); - btrfs_abort_transaction(trans, ret); - return ret; - } - inc_nlink(&inode->vfs_inode); btrfs_release_path(wc->subvol_path); - ret = unlink_inode_for_log_replay(wc, victim_parent, inode, - &victim_name); - iput(&victim_parent->vfs_inode); + ret = unlink_inode_for_log_replay(wc, dir, inode, &victim_name); kfree(victim_name.name); if (ret) return ret;