All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Gao Xiang <hsiangkao@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-xfs@vger.kernel.org,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Eric Sandeen <sandeen@sandeen.net>
Subject: Re: [PATCH v3 6/6] xfs: kill ialloced in xfs_dialloc()
Date: Tue, 8 Dec 2020 07:23:45 +1100	[thread overview]
Message-ID: <20201207202345.GT3913616@dread.disaster.area> (raw)
In-Reply-To: <20201207142448.GD2817641@xiangao.remote.csb>

On Mon, Dec 07, 2020 at 10:24:48PM +0800, Gao Xiang wrote:
> On Mon, Dec 07, 2020 at 02:57:19PM +0100, Christoph Hellwig wrote:
> > > +		error = xfs_ialloc_ag_alloc(*tpp, agbp);
> > > +		if (error < 0) {
> > >  			xfs_trans_brelse(*tpp, agbp);
> > >  
> > >  			if (error == -ENOSPC)
> > >  				error = 0;
> > >  			break;
> > > +		} else if (error == 0) {
> > 
> > No need for the else after the break.
> 
> Personally, I'd like to save a line by using "} else if {"
> for such case (and tell readers about these two judgments),
> and for any cases, compilers will do their best.

And extra line is not an issue, and the convention we use everywhere
is to elide the "else" whereever possible. e.g. we do:

	if (foo)
		return false;
	if (!bar)
		return true;
	if (baz)
		return false;
	return true;

Rather than if() {} else if() {} else if() {} else {}. The elses in
these cases mainly obfuscate the actual logic flow...

Cheers,

Dave.

-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2020-12-07 20:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07  0:15 [PATCH v3 0/6] xfs: some xfs_dialloc() cleanup Gao Xiang
2020-12-07  0:15 ` [PATCH v3 1/6] xfs: convert noroom, okalloc in xfs_dialloc() to bool Gao Xiang
2020-12-07  0:15 ` [PATCH v3 2/6] xfs: introduce xfs_dialloc_roll() Gao Xiang
2020-12-07 13:43   ` Christoph Hellwig
2020-12-07 14:11     ` Gao Xiang
2020-12-07  0:15 ` [PATCH v3 3/6] xfs: move on-disk inode allocation out of xfs_ialloc() Gao Xiang
2020-12-07 13:49   ` Christoph Hellwig
2020-12-07 14:19     ` Gao Xiang
2020-12-07 14:21       ` Christoph Hellwig
2020-12-07 20:19       ` Dave Chinner
2020-12-07 16:59     ` Darrick J. Wong
2020-12-07  0:15 ` [PATCH v3 4/6] xfs: move xfs_dialloc_roll() into xfs_dialloc() Gao Xiang
2020-12-07 13:53   ` Christoph Hellwig
2020-12-07 14:20     ` Gao Xiang
2020-12-07  0:15 ` [PATCH v3 5/6] xfs: spilt xfs_dialloc() into 2 functions Gao Xiang
2020-12-07 13:56   ` Christoph Hellwig
2020-12-07 14:33     ` Gao Xiang
2020-12-07 16:38       ` Christoph Hellwig
2020-12-07  0:15 ` [PATCH v3 6/6] xfs: kill ialloced in xfs_dialloc() Gao Xiang
2020-12-07 13:57   ` Christoph Hellwig
2020-12-07 14:24     ` Gao Xiang
2020-12-07 20:23       ` Dave Chinner [this message]
2020-12-07 22:03         ` Gao Xiang

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=20201207202345.GT3913616@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.com \
    --cc=hch@lst.de \
    --cc=hsiangkao@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.