btrfs: pass NULL index to btrfs_del_inode_ref() where not needed
authorFilipe Manana <fdmanana@suse.com>
Thu, 29 May 2025 15:59:07 +0000 (16:59 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 21:53:30 +0000 (23:53 +0200)
There are two callers of btrfs_del_inode_ref() that declare a local index
variable and then pass a pointer for it to btrfs_del_inode_ref(), but then
don't use that index at all. Since btrfs_del_inode_ref() accepts a NULL
index pointer, pass NULL instead and stop declaring those useless index
variables.

Reviewed-by: Boris Burkov <boris@bur.io>
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/inode.c
fs/btrfs/tree-log.c

index 0f2cbaf8320db463ddb14bc9ff774247fe879489..474cb40a42f7f51edc05d47373f634a33b75d11d 100644 (file)
@@ -6711,10 +6711,9 @@ fail_dir_item:
                if (ret2)
                        btrfs_abort_transaction(trans, ret2);
        } else if (add_backref) {
-               u64 local_index;
                int ret2;
 
-               ret2 = btrfs_del_inode_ref(trans, root, name, ino, parent_ino, &local_index);
+               ret2 = btrfs_del_inode_ref(trans, root, name, ino, parent_ino, NULL);
                if (ret2)
                        btrfs_abort_transaction(trans, ret2);
        }
index e9f3dc569bfc93ad7e03fedacf909355b7e83e3d..2c647836ce4969d3d911d95551f8b6ae08bee9d2 100644 (file)
@@ -3502,7 +3502,6 @@ void btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
                                struct btrfs_inode *inode, u64 dirid)
 {
        struct btrfs_root *log;
-       u64 index;
        int ret;
 
        ret = inode_logged(trans, inode, NULL);
@@ -3520,8 +3519,7 @@ void btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
        log = root->log_root;
        mutex_lock(&inode->log_mutex);
 
-       ret = btrfs_del_inode_ref(trans, log, name, btrfs_ino(inode),
-                                 dirid, &index);
+       ret = btrfs_del_inode_ref(trans, log, name, btrfs_ino(inode), dirid, NULL);
        mutex_unlock(&inode->log_mutex);
        if (ret < 0 && ret != -ENOENT)
                btrfs_set_log_full_commit(trans);