linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Colin King <colin.king@canonical.com>
Cc: "Darrick J . Wong" <djwong@kernel.org>,
	linux-xfs@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: clean up some inconsistent indenting
Date: Fri, 3 Sep 2021 09:31:37 +1000	[thread overview]
Message-ID: <20210902233137.GB1826899@dread.disaster.area> (raw)
In-Reply-To: <20210902225219.57929-1-colin.king@canonical.com>

On Thu, Sep 02, 2021 at 11:52:19PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There are bunch of statements where the indentation is not correct,
> clean these up.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  fs/xfs/xfs_log.c | 29 ++++++++++++++---------------
>  1 file changed, 14 insertions(+), 15 deletions(-)

Good idea, but I see no point in only fixing one of the many style
violations this ancient debug code has whilst introducing new ones
(i.e line lengths > 80 columns).

> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index f6cd2d4aa770..9afc58a1a9ee 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -3700,21 +3700,20 @@ xlog_verify_tail_lsn(
>  	xfs_lsn_t	tail_lsn = be64_to_cpu(iclog->ic_header.h_tail_lsn);
>  	int		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 (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)
> -		xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
> -    }
> +	if (CYCLE_LSN(tail_lsn) == log->l_prev_cycle) {
> +		blocks = log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn));

Line length.

> +		if (blocks < BTOBB(iclog->ic_offset)+BTOBB(log->l_iclog_hsize))

Lack of whitespace around "="

> +			xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);

Line length.

> +	} else {

Return from the if {} block rather than using an else statement, and
the indent of this block doesn't change:

> +		ASSERT(CYCLE_LSN(tail_lsn)+1 == log->l_prev_cycle);

Whitespace.
> +
> +		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)
> +			xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);

And because this doesn't need indent because of the return above, it
won't violate line length limits...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

      reply	other threads:[~2021-09-02 23:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02 22:52 Colin King
2021-09-02 23:31 ` Dave Chinner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210902233137.GB1826899@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=colin.king@canonical.com \
    --cc=djwong@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --subject='Re: [PATCH] xfs: clean up some inconsistent indenting' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).