From: Jan Kara <jack@suse.cz>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH -next] ext4: Simplify if condition
Date: Thu, 12 Sep 2024 11:07:22 +0200 [thread overview]
Message-ID: <20240912090722.4e7o4l462y6hccau@quack3> (raw)
In-Reply-To: <20240830071713.40565-1-jiapeng.chong@linux.alibaba.com>
On Fri 30-08-24 15:17:13, Jiapeng Chong wrote:
> The if condition !A || A && B can be simplified to !A || B.
>
> ./fs/ext4/fast_commit.c:362:21-23: WARNING !A || A && B is equivalent to !A || B.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9837
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/fast_commit.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> index 326c16a4e51e..53a77172dc9f 100644
> --- a/fs/ext4/fast_commit.c
> +++ b/fs/ext4/fast_commit.c
> @@ -357,9 +357,7 @@ void ext4_fc_mark_ineligible(struct super_block *sb, int reason, handle_t *handl
> }
> spin_lock(&sbi->s_fc_lock);
> is_ineligible = ext4_test_mount_flag(sb, EXT4_MF_FC_INELIGIBLE);
> - if (has_transaction &&
> - (!is_ineligible ||
> - (is_ineligible && tid_gt(tid, sbi->s_fc_ineligible_tid))))
> + if (has_transaction && (!is_ineligible || tid_gt(tid, sbi->s_fc_ineligible_tid)))
> sbi->s_fc_ineligible_tid = tid;
> ext4_set_mount_flag(sb, EXT4_MF_FC_INELIGIBLE);
> spin_unlock(&sbi->s_fc_lock);
> --
> 2.32.0.3.g01195cf9f
>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2024-09-12 9:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 7:17 [PATCH -next] ext4: Simplify if condition Jiapeng Chong
2024-09-12 9:07 ` Jan Kara [this message]
2024-11-07 15:12 ` Theodore Ts'o
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=20240912090722.4e7o4l462y6hccau@quack3 \
--to=jack@suse.cz \
--cc=abaci@linux.alibaba.com \
--cc=adilger.kernel@dilger.ca \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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