Skip to content

Commit 26558ce

Browse files
fdmananakdave
authored andcommitted
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 <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 37b0c31 commit 26558ce

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

fs/btrfs/tree-log.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7036,7 +7036,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
70367036
struct btrfs_root *root = inode->root;
70377037
struct btrfs_fs_info *fs_info = root->fs_info;
70387038
int ret = 0;
7039-
bool log_dentries = false;
7039+
bool log_dentries;
70407040

70417041
if (btrfs_test_opt(fs_info, NOTREELOG)) {
70427042
ret = BTRFS_LOG_FORCE_COMMIT;
@@ -7090,8 +7090,11 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
70907090
goto end_trans;
70917091
}
70927092

7093-
if (S_ISDIR(inode->vfs_inode.i_mode) && ctx->log_new_dentries)
7094-
log_dentries = true;
7093+
/*
7094+
* Track if we need to log dentries because ctx->log_new_dentries can
7095+
* be modified in the call chains below.
7096+
*/
7097+
log_dentries = ctx->log_new_dentries;
70957098

70967099
/*
70977100
* On unlink we must make sure all our current and old parent directory

0 commit comments

Comments
 (0)