btrfs: cleanups for a couple log tree functions
cover btrfs: cleanups for a couple log tree functions
From: Filipe Manana <[email protected]>
A couple of trivial cleanups for the argument list of two log tree functions.
Filipe Manana (2):
btrfs: remove root argument from btrfs_del_dir_entries_in_log()
btrfs: reduce arguments to btrfs_del_inode_ref_in_log()
fs/btrfs/inode.c | 4 ++-- fs/btrfs/tree-log.c | 12 ++++++------ fs/btrfs/tree-log.h | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-)
Signature · 1 line
2.47.2
PATCH 1/2 btrfs: remove root argument from btrfs_del_dir_entries_in_log()
From: Filipe Manana <[email protected]>
There's no need to pass the root as we can extract it from the directory inode, so remove it.
--- fs/btrfs/inode.c | 2 +- fs/btrfs/tree-log.c | 2 +- fs/btrfs/tree-log.h | 1 - 3 files changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/inode.c +1 -1
@@ -4359,7 +4359,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,*/ if (!rename_ctx) {btrfs_del_inode_ref_in_log (trans, root, name, inode, dir_ino); -btrfs_del_dir_entries_in_log (trans, root, name, dir, index); +btrfs_del_dir_entries_in_log (trans, name, dir, index); }/*
fs/btrfs/tree-log.c +1 -1
@@ -3900,10 +3900,10 @@ static int del_logged_dentry(struct btrfs_trans_handle *trans,* or the entire directory. */ void btrfs_del_dir_entries_in_log (struct btrfs_trans_handle *trans, -struct btrfs_root *root,const struct fscrypt_str *name,struct btrfs_inode *dir,u64 index) { +struct btrfs_root *root = dir->root;BTRFS_PATH_AUTO_FREE (path);int ret;
fs/btrfs/tree-log.h +0 -1
@@ -79,7 +79,6 @@ int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans,struct dentry *dentry, struct btrfs_log_ctx *ctx);void btrfs_del_dir_entries_in_log (struct btrfs_trans_handle *trans, -struct btrfs_root *root,const struct fscrypt_str *name,struct btrfs_inode *dir,u64 index); void btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
Signature · 1 line
2.47.2
PATCH 2/2 btrfs: reduce arguments to btrfs_del_inode_ref_in_log()
In reply to [email protected]From: Filipe Manana <[email protected]>
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.
--- fs/btrfs/inode.c | 2 +- fs/btrfs/tree-log.c | 10 +++++----- fs/btrfs/tree-log.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
fs/btrfs/inode.c +1 -1
@@ -4358,7 +4358,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,* 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); }
fs/btrfs/tree-log.c +5 -5
@@ -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);
fs/btrfs/tree-log.h +2 -2
@@ -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,
Signature · 1 line
2.47.2
Quoted 4 lines · 在 2025/11/19 23:49, [email protected] 写道:
From: Filipe Manana <[email protected]>
A couple of trivial cleanups for the argument list of two log tree functions.
Thanks,
Qu
Quoted 10 lines
Filipe Manana (2):
btrfs: remove root argument frombtrfs_del_dir_entries_in_log()
btrfs: reduce arguments tobtrfs_del_inode_ref_in_log()fs/btrfs/inode.c | 4 ++-- fs/btrfs/tree-log.c | 12 ++++++------ fs/btrfs/tree-log.h | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-)
Looks good,
Quoted 8 lines · On Wed, Nov 19, 2025 at 01:19:06PM +0000, [email protected] wrote:
From: Filipe Manana <[email protected]>
A couple of trivial cleanups for the argument list of two log tree functions.
Filipe Manana (2):
btrfs: remove root argument frombtrfs_del_dir_entries_in_log()
btrfs: reduce arguments tobtrfs_del_inode_ref_in_log()