Skip to contentSkip to conversation

xfs: remove an unneeded NULL check

PATCH In review Dan Carpenter 5 participants 8 messages Jan 28, 2012 – Feb 1, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: remove an unneeded NULL check

Smatch complains because we check "commit_lsn" for NULL inconsistently. fs/xfs/xfs_log_cil.c +705 xfs_log_commit_cil(43) error: we previously
assumed 'commit_lsn' could be null (see line 688)
xfs_log_commit_cil() is only called from one place, and "commit_lsn" is a valid pointer, so I've removed the NULL check.

fs/xfs/xfs_log_cil.c +1 -2
index d4fadbe..d9c4652 100644
@@ -685,8 +685,7 @@ xfs_log_commit_cil(
 
 	/* lock out background commit */
 	down_read(&log->l_cilp->xc_ctx_lock);
-	if (commit_lsn)
-		*commit_lsn = log->l_cilp->xc_ctx->sequence;
+	*commit_lsn = log->l_cilp->xc_ctx->sequence;
 
 	xlog_cil_insert_items(log, log_vector, tp->t_ticket);
 
#1 lore raw

PATCH 1/1 xfs: remove an unneeded NULL check

#pwhite: We can safely remove this check because the one call to #xfs_log_commit_cil() comes from xfs_trans_commit() and passes a pointer to a #local variable.

Smatch complains because we check "commit_lsn" for NULL inconsistently. fs/xfs/xfs_log_cil.c +705 xfs_log_commit_cil(43) error: we previously
assumed 'commit_lsn' could be null (see line 688)
xfs_log_commit_cil() is only called from one place, and "commit_lsn" is a valid pointer, so I've removed the NULL check.

fs/xfs/xfs_log_cil.c +1 -2
index d4fadbe..d9c4652 100644
@@ -685,8 +685,7 @@ xfs_log_commit_cil(
 
 	/* lock out background commit */
 	down_read(&log->l_cilp->xc_ctx_lock);
-	if (commit_lsn)
-		*commit_lsn = log->l_cilp->xc_ctx->sequence;
+	*commit_lsn = log->l_cilp->xc_ctx->sequence;
 
 	xlog_cil_insert_items(log, log_vector, tp->t_ticket);
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
In reply to Dan Carpenter
Quoted 13 lines · Dan Carpenter

Smatch complains because we check "commit_lsn" for NULL inconsistently. fs/xfs/xfs_log_cil.c +705 xfs_log_commit_cil(43) error: we previously
assumed 'commit_lsn' could be null (see line 688)
xfs_log_commit_cil() is only called from one place, and "commit_lsn" is a valid pointer, so I've removed the NULL check.

fs/xfs/xfs_log_cil.c +0 -0
index d4fadbe..d9c4652 100644

fs/xfs/xfs_log_cil.c xfs_log_commit_cil( · line 690

Quoted 8 lines
fs/xfs/xfs_log_cil.c +1 -2
@@ -685,8 +685,7 @@ xfs_log_commit_cil(
 
 	/* lock out background commit */
 	down_read(&log->l_cilp->xc_ctx_lock);
-	if (commit_lsn)
-		*commit_lsn = log->l_cilp->xc_ctx->sequence;
+	*commit_lsn = log->l_cilp->xc_ctx->sequence;
 
 	xlog_cil_insert_items(log, log_vector, tp->t_ticket);

There's a set of reviewed patches (for 3.3) that change all this code. The null check might still be there, but that needs to be checked.

On that note, Ben, can you get all of the reviewed patches that are currently outstanding into the for-next branch of the oss tree? We need this done sooner rather than later so that all our current testing during development is done with those patches applied. it also helps us to avoid conflicts between patchsets that touch the same code (which I have quite a few of at the moment)....

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#3 lore raw
Quoted 27 lines · Dave Chinner
Quoted 13 lines · Dan Carpenter

Smatch complains because we check "commit_lsn" for NULL inconsistently. fs/xfs/xfs_log_cil.c +705 xfs_log_commit_cil(43) error: we previously
assumed 'commit_lsn' could be null (see line 688)
xfs_log_commit_cil() is only called from one place, and "commit_lsn" is a valid pointer, so I've removed the NULL check.

fs/xfs/xfs_log_cil.c +0 -0
index d4fadbe..d9c4652 100644

fs/xfs/xfs_log_cil.c xfs_log_commit_cil( · line 690

Quoted 8 lines
fs/xfs/xfs_log_cil.c +1 -2
@@ -685,8 +685,7 @@ xfs_log_commit_cil(
 
 	/* lock out background commit */
 	down_read(&log->l_cilp->xc_ctx_lock);
-	if (commit_lsn)
-		*commit_lsn = log->l_cilp->xc_ctx->sequence;
+	*commit_lsn = log->l_cilp->xc_ctx->sequence;
 
 	xlog_cil_insert_items(log, log_vector, tp->t_ticket);

There's a set of reviewed patches (for 3.3) that change all this code. The null check might still be there, but that needs to be checked.

Quoted 6 lines

On that note, Ben, can you get all of the reviewed patches that are currently outstanding into the for-next branch of the oss tree? We need this done sooner rather than later so that all our current testing during development is done with those patches applied. it also helps us to avoid conflicts between patchsets that touch the same code (which I have quite a few of at the moment)....

I'll have it resolved ASAP.

-Ben

#4 lore raw
In reply to Dave Chinner
Quoted 11 lines · Dave Chinner

fs/xfs/xfs_log_cil.c xfs_log_commit_cil( · line 690

Quoted 7 lines
fs/xfs/xfs_log_cil.c +1 -2
 	/* lock out background commit */
 	down_read(&log->l_cilp->xc_ctx_lock);
-	if (commit_lsn)
-		*commit_lsn = log->l_cilp->xc_ctx->sequence;
+	*commit_lsn = log->l_cilp->xc_ctx->sequence;
 
 	xlog_cil_insert_items(log, log_vector, tp->t_ticket);

There's a set of reviewed patches (for 3.3) that change all this code. The null check might still be there, but that needs to be checked.

Which series is that? I mut have to admit I've lost track by now.

#5 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Dave Chinner
Quoted 6 lines
fs/xfs/xfs_log_cil.c +1 -2
 	/* lock out background commit */
 	down_read(&log->l_cilp->xc_ctx_lock);
-	if (commit_lsn)
-		*commit_lsn = log->l_cilp->xc_ctx->sequence;
+	*commit_lsn = log->l_cilp->xc_ctx->sequence;
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

xlog_cil_insert_items(log, log_vector, tp->t_ticket);

There's a set of reviewed patches (for 3.3) that change all this code. The null check might still be there, but that needs to be checked.

Which series is that? I mut have to admit I've lost track by now.

The removal of all the old log code.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#6 lore raw
Quoted 7 lines · Dave Chinner
Quoted 5 lines
Quoted 3 lines

There's a set of reviewed patches (for 3.3) that change all this code. The null check might still be there, but that needs to be checked.

Which series is that? I mut have to admit I've lost track by now.

The removal of all the old log code.

That stuff actually still went into 3.3-rc1.

#7 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 7 lines · Dave Chinner
Quoted 5 lines
Quoted 3 lines

There's a set of reviewed patches (for 3.3) that change all this code. The null check might still be there, but that needs to be checked.

Which series is that? I mut have to admit I've lost track by now.

The removal of all the old log code.

That stuff actually still went into 3.3-rc1.

Hmmm. That means my cscope trees are not automatically updating properly for some reason. That's my problem, sorry for the noise.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]