]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: reduce arguments to btrfs_del_inode_ref_in_log()
authorFilipe Manana <fdmanana@suse.com>
Wed, 19 Nov 2025 13:06:55 +0000 (13:06 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 25 Nov 2025 00:53:33 +0000 (01:53 +0100)
Instead of passing a root and the objectid of the parent directory, just
pass the directory inode, as like that we can extract both the root and
the objectid, reducing the number of arguments by one. It also makes the
function more consistent with other log tree functions in the sense that
we pass the inode and not only its 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>
fs/btrfs/inode.c
fs/btrfs/tree-log.c
fs/btrfs/tree-log.h

index 554bd03c9f2169136da57a60b695db64540d17c4..3cf30abcdb08cf78bfc9a924b7f9364032698e4a 100644 (file)
@@ -4362,7 +4362,7 @@ skip_backref:
         * operations on the log tree, increasing latency for applications.
         */
        if (!rename_ctx) {
-               btrfs_del_inode_ref_in_log(trans, root, name, inode, dir_ino);
+               btrfs_del_inode_ref_in_log(trans, name, inode, dir);
                btrfs_del_dir_entries_in_log(trans, name, dir, index);
        }
 
index c2e45e64ab6c2a2be2f0d30c009a8fa9a608df9c..42c9327e0c12f002a1dbf8c70ed96df5732689ce 100644 (file)
@@ -3938,11 +3938,11 @@ void btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
 
 /* see comments for btrfs_del_dir_entries_in_log */
 void btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
-                               struct btrfs_root *root,
                                const struct fscrypt_str *name,
-                               struct btrfs_inode *inode, u64 dirid)
+                               struct btrfs_inode *inode,
+                               struct btrfs_inode *dir)
 {
-       struct btrfs_root *log;
+       struct btrfs_root *root = dir->root;
        int ret;
 
        ret = inode_logged(trans, inode, NULL);
@@ -3957,10 +3957,10 @@ void btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
        ASSERT(ret == 0, "join_running_log_trans() ret=%d", ret);
        if (WARN_ON(ret))
                return;
-       log = root->log_root;
        mutex_lock(&inode->log_mutex);
 
-       ret = btrfs_del_inode_ref(trans, log, name, btrfs_ino(inode), dirid, NULL);
+       ret = btrfs_del_inode_ref(trans, root->log_root, name, btrfs_ino(inode),
+                                 btrfs_ino(dir), NULL);
        mutex_unlock(&inode->log_mutex);
        if (ret < 0 && ret != -ENOENT)
                btrfs_set_log_full_commit(trans);
index a0aeec2448c0f467b7ecd0f8a125ce44824cb0cf..41e47fda036dedcbbeb9bde4f7d59016d6b52f3f 100644 (file)
@@ -82,9 +82,9 @@ void btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
                                  const struct fscrypt_str *name,
                                  struct btrfs_inode *dir, u64 index);
 void btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
-                               struct btrfs_root *root,
                                const struct fscrypt_str *name,
-                               struct btrfs_inode *inode, u64 dirid);
+                               struct btrfs_inode *inode,
+                               struct btrfs_inode *dir);
 void btrfs_end_log_trans(struct btrfs_root *root);
 void btrfs_pin_log_trans(struct btrfs_root *root);
 void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,