[PATCH next] xfs: fix inconsistent indenting of xlog_verify_tail_lsn()

Yang Li posted 1 patch 2 years, 3 months ago
fs/xfs/xfs_log.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
[PATCH next] xfs: fix inconsistent indenting of xlog_verify_tail_lsn()
Posted by Yang Li 2 years, 3 months ago
Fix smatch warning:

fs/xfs/xfs_log.c:3598 xlog_verify_tail_lsn() warn: inconsistent indenting

Also fix several style violations mentioned in [1].

[1] https://lore.kernel.org/linux-xfs/20210902233137.GB1826899@dread.disaster.area/
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 fs/xfs/xfs_log.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 79004d193e54..d197534cd3b3 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3593,23 +3593,23 @@ xlog_verify_tail_lsn(
 	struct xlog_in_core	*iclog)
 {
 	xfs_lsn_t	tail_lsn = be64_to_cpu(iclog->ic_header.h_tail_lsn);
-	int		blocks;
+	int		blocks, ic_blocks;
 
-    if (CYCLE_LSN(tail_lsn) == log->l_prev_cycle) {
-	blocks =
-	    log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn));
-	if (blocks < BTOBB(iclog->ic_offset)+BTOBB(log->l_iclog_hsize))
-		xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
-    } else {
-	ASSERT(CYCLE_LSN(tail_lsn)+1 == log->l_prev_cycle);
+	if (CYCLE_LSN(tail_lsn) == log->l_prev_cycle) {
+		blocks = log->l_logBBsize -
+			(log->l_prev_block - BLOCK_LSN(tail_lsn));
+		ic_blocks = BTOBB(iclog->ic_offset) + BTOBB(log->l_iclog_hsize);
+	} else {
+		ASSERT(CYCLE_LSN(tail_lsn) + 1 == log->l_prev_cycle);
 
-	if (BLOCK_LSN(tail_lsn) == log->l_prev_block)
-		xfs_emerg(log->l_mp, "%s: tail wrapped", __func__);
+		if (BLOCK_LSN(tail_lsn) == log->l_prev_block)
+			xfs_emerg(log->l_mp, "%s: tail wrapped", __func__);
 
-	blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block;
-	if (blocks < BTOBB(iclog->ic_offset) + 1)
+		blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block;
+		ic_blocks = BTOBB(iclog->ic_offset) + 1;
+	}
+	if (blocks < ic_blocks)
 		xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
-    }
 }
 
 /*
-- 
2.20.1.7.g153144c
Re: [PATCH next] xfs: fix inconsistent indenting of xlog_verify_tail_lsn()
Posted by Darrick J. Wong 2 years, 3 months ago
On Fri, Aug 18, 2023 at 10:02:50AM +0800, Yang Li wrote:
> Fix smatch warning:
> 
> fs/xfs/xfs_log.c:3598 xlog_verify_tail_lsn() warn: inconsistent indenting
> 
> Also fix several style violations mentioned in [1].
> 
> [1] https://lore.kernel.org/linux-xfs/20210902233137.GB1826899@dread.disaster.area/
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

Looks ok to me,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_log.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 79004d193e54..d197534cd3b3 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -3593,23 +3593,23 @@ xlog_verify_tail_lsn(
>  	struct xlog_in_core	*iclog)
>  {
>  	xfs_lsn_t	tail_lsn = be64_to_cpu(iclog->ic_header.h_tail_lsn);
> -	int		blocks;
> +	int		blocks, ic_blocks;
>  
> -    if (CYCLE_LSN(tail_lsn) == log->l_prev_cycle) {
> -	blocks =
> -	    log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn));
> -	if (blocks < BTOBB(iclog->ic_offset)+BTOBB(log->l_iclog_hsize))
> -		xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
> -    } else {
> -	ASSERT(CYCLE_LSN(tail_lsn)+1 == log->l_prev_cycle);
> +	if (CYCLE_LSN(tail_lsn) == log->l_prev_cycle) {
> +		blocks = log->l_logBBsize -
> +			(log->l_prev_block - BLOCK_LSN(tail_lsn));
> +		ic_blocks = BTOBB(iclog->ic_offset) + BTOBB(log->l_iclog_hsize);
> +	} else {
> +		ASSERT(CYCLE_LSN(tail_lsn) + 1 == log->l_prev_cycle);
>  
> -	if (BLOCK_LSN(tail_lsn) == log->l_prev_block)
> -		xfs_emerg(log->l_mp, "%s: tail wrapped", __func__);
> +		if (BLOCK_LSN(tail_lsn) == log->l_prev_block)
> +			xfs_emerg(log->l_mp, "%s: tail wrapped", __func__);
>  
> -	blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block;
> -	if (blocks < BTOBB(iclog->ic_offset) + 1)
> +		blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block;

> +		ic_blocks = BTOBB(iclog->ic_offset) + 1;
> +	}
> +	if (blocks < ic_blocks)
>  		xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
> -    }
>  }
>  
>  /*
> -- 
> 2.20.1.7.g153144c
>