aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorFilipe Manana <[email protected]>2025-03-13 17:07:47 +0000
committerDavid Sterba <[email protected]>2025-03-18 19:35:56 +0000
commit26558ce574b86e7c81f28f3f10767fcab0f3abb3 (patch)
tree06d4f754071f6a68367ef0f7414f086b8d8c4aea /fs
parentbtrfs: remove redundant else statement from btrfs_log_inode_parent() (diff)
downloadkernel-26558ce574b86e7c81f28f3f10767fcab0f3abb3.tar.gz
kernel-26558ce574b86e7c81f28f3f10767fcab0f3abb3.zip
btrfs: simplify condition for logging new dentries at btrfs_log_inode_parent()
There's no point in checking if the inode is a directory as ctx->log_new_dentries is only set in case we are logging a directory down the call chain of btrfs_log_inode(). So remove that check making the logic more simple and while at it add a comment about why use a local variable to track if we later need to log new dentries. Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/tree-log.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 6c59c581ebe4..6bc9f5f32393 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -7036,7 +7036,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
struct btrfs_root *root = inode->root;
struct btrfs_fs_info *fs_info = root->fs_info;
int ret = 0;
- bool log_dentries = false;
+ bool log_dentries;
if (btrfs_test_opt(fs_info, NOTREELOG)) {
ret = BTRFS_LOG_FORCE_COMMIT;
@@ -7090,8 +7090,11 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
goto end_trans;
}
- if (S_ISDIR(inode->vfs_inode.i_mode) && ctx->log_new_dentries)
- log_dentries = true;
+ /*
+ * Track if we need to log dentries because ctx->log_new_dentries can
+ * be modified in the call chains below.
+ */
+ log_dentries = ctx->log_new_dentries;
/*
* On unlink we must make sure all our current and old parent directory