Skip to content

Commit 816a880

Browse files
Long Liakpm00
authored andcommitted
ocfs2: remove redundant NULL check in rename path
The code checks newfe_bh for NULL after it has already been dereferenced to access b_data. This NULL check is unnecessary for two reasons: 1. If ocfs2_inode_lock() succeeds (returns >= 0), newfe_bh is guaranteed to be valid. 2. We've already dereferenced newfe_bh to access b_data, so it must be non-NULL at this point. Remove the redundant NULL check in the trace_ocfs2_rename_over_existing() call to improve code clarity. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Long Li <[email protected]> Reviewed-by: Su Yue <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Junxiao Bi <[email protected]> Cc: Changwei Ge <[email protected]> Cc: Jun Piao <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 2ae8267 commit 816a880

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ocfs2/namei.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,8 +1452,8 @@ static int ocfs2_rename(struct mnt_idmap *idmap,
14521452
newfe = (struct ocfs2_dinode *) newfe_bh->b_data;
14531453

14541454
trace_ocfs2_rename_over_existing(
1455-
(unsigned long long)newfe_blkno, newfe_bh, newfe_bh ?
1456-
(unsigned long long)newfe_bh->b_blocknr : 0ULL);
1455+
(unsigned long long)newfe_blkno, newfe_bh,
1456+
(unsigned long long)newfe_bh->b_blocknr);
14571457

14581458
if (S_ISDIR(new_inode->i_mode) || (new_inode->i_nlink == 1)) {
14591459
status = ocfs2_prepare_orphan_dir(osb, &orphan_dir,

0 commit comments

Comments
 (0)