linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Wan Jiabing <wanjiabing@vivo.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	kael_w@yeah.net, johannes.thumshirn@wdc.com
Subject: Re: [PATCH] btrfs: Simplify conditional in assert
Date: Fri, 15 Oct 2021 12:51:54 +0200	[thread overview]
Message-ID: <20211015105154.GC30611@twin.jikos.cz> (raw)
In-Reply-To: <20211015103639.21838-1-wanjiabing@vivo.com>

Adding Johannes to CC,

On Fri, Oct 15, 2021 at 06:36:39AM -0400, Wan Jiabing wrote:
> Fix following coccicheck warning:
> ./fs/btrfs/inode.c:2015:16-18: WARNING !A || A && B is equivalent to !A || B
> 
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> ---
>  fs/btrfs/inode.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index e9154b436c47..da4aeef73b0d 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -2011,8 +2011,7 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page
>  		 * to use run_delalloc_nocow() here, like for  regular
>  		 * preallocated inodes.
>  		 */
> -		ASSERT(!zoned ||
> -		       (zoned && btrfs_is_data_reloc_root(inode->root)));
> +		ASSERT(!zoned || btrfs_is_data_reloc_root(inode->root));

The short form is equivalent, but I'm not sure it's also on the same
level of readability. Repeating the 'zoned' condition check makes it
obvious on first sight, which is what I'd prefer.

Johannes if you'd like the new version I'll change it but otherwise I'm
fine with what we have now.

>  		ret = run_delalloc_nocow(inode, locked_page, start, end,
>  					 page_started, nr_written);
>  	} else if (!inode_can_compress(inode) ||
> -- 
> 2.20.1

  reply	other threads:[~2021-10-15 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 10:36 [PATCH] btrfs: Simplify conditional in assert Wan Jiabing
2021-10-15 10:51 ` David Sterba [this message]
2021-10-15 11:41   ` Johannes Thumshirn
2021-10-15 14:18   ` Nikolay Borisov

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=20211015105154.GC30611@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=josef@toxicpanda.com \
    --cc=kael_w@yeah.net \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wanjiabing@vivo.com \
    /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 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).