]> www.infradead.org Git - users/hch/misc.git/commitdiff
btrfs: remove pointless inode lookup when processing extrefs during log replay
authorFilipe Manana <fdmanana@suse.com>
Wed, 3 Sep 2025 11:10:01 +0000 (12:10 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Sep 2025 06:49:21 +0000 (08:49 +0200)
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>
fs/btrfs/tree-log.c

index 6186300923b7c448cdd8ff7f0b365100cef6832f..86c595ef57f474252baf6a445ebf4211182bbdf4 100644 (file)
@@ -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;