Skip to content

Commit d8e5214

Browse files
fdmananakdave
authored andcommitted
btrfs: reduce arguments to btrfs_del_inode_ref_in_log()
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>
1 parent 15fe48e commit d8e5214

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4362,7 +4362,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
43624362
* operations on the log tree, increasing latency for applications.
43634363
*/
43644364
if (!rename_ctx) {
4365-
btrfs_del_inode_ref_in_log(trans, root, name, inode, dir_ino);
4365+
btrfs_del_inode_ref_in_log(trans, name, inode, dir);
43664366
btrfs_del_dir_entries_in_log(trans, name, dir, index);
43674367
}
43684368

fs/btrfs/tree-log.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3938,11 +3938,11 @@ void btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
39383938

39393939
/* see comments for btrfs_del_dir_entries_in_log */
39403940
void btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
3941-
struct btrfs_root *root,
39423941
const struct fscrypt_str *name,
3943-
struct btrfs_inode *inode, u64 dirid)
3942+
struct btrfs_inode *inode,
3943+
struct btrfs_inode *dir)
39443944
{
3945-
struct btrfs_root *log;
3945+
struct btrfs_root *root = dir->root;
39463946
int ret;
39473947

39483948
ret = inode_logged(trans, inode, NULL);
@@ -3957,10 +3957,10 @@ void btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
39573957
ASSERT(ret == 0, "join_running_log_trans() ret=%d", ret);
39583958
if (WARN_ON(ret))
39593959
return;
3960-
log = root->log_root;
39613960
mutex_lock(&inode->log_mutex);
39623961

3963-
ret = btrfs_del_inode_ref(trans, log, name, btrfs_ino(inode), dirid, NULL);
3962+
ret = btrfs_del_inode_ref(trans, root->log_root, name, btrfs_ino(inode),
3963+
btrfs_ino(dir), NULL);
39643964
mutex_unlock(&inode->log_mutex);
39653965
if (ret < 0 && ret != -ENOENT)
39663966
btrfs_set_log_full_commit(trans);

fs/btrfs/tree-log.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ void btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
8282
const struct fscrypt_str *name,
8383
struct btrfs_inode *dir, u64 index);
8484
void btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
85-
struct btrfs_root *root,
8685
const struct fscrypt_str *name,
87-
struct btrfs_inode *inode, u64 dirid);
86+
struct btrfs_inode *inode,
87+
struct btrfs_inode *dir);
8888
void btrfs_end_log_trans(struct btrfs_root *root);
8989
void btrfs_pin_log_trans(struct btrfs_root *root);
9090
void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,

0 commit comments

Comments
 (0)