From: Waqar Hameed <waqar.hameed@axis.com>
To: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: Richard Weinberger <richard@nod.at>, <kernel@axis.com>,
<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ubifs: Move update of cnt in get_znodes_to_commit
Date: Wed, 6 Nov 2024 17:48:17 +0100 [thread overview]
Message-ID: <pndo72s2tri.fsf@axis.com> (raw)
In-Reply-To: <4751d3df-99a6-ec67-1175-ea5375290726@huawei.com> (Zhihao Cheng's message of "Fri, 18 Oct 2024 09:24:03 +0800")
On Fri, Oct 18, 2024 at 09:24 +0800 Zhihao Cheng <chengzhihao1@huawei.com> wrote:
> 在 2024/10/18 2:41, Waqar Hameed 写道:
>> There is no need to update `cnt` for the first dirty node just before
>> the loop, and then again update it at the end of each iteration for the
>> next dirty nodes. Just update `cnt` at the beginning of each iteration
>> instead. This way, the first iteration will count the first dirty node
>> and any subsequent iterations will count the next dirty nodes.
>
> Well, from my own view, I prefer the orignal style because it looks more
> readable.
> c->cnext = find_first_dirty(c->zroot.znode);
> znode = c->enext = c->cnext;
> cnt += 1; // We get the first one.
>
> while (1) {
> cnext = find_next_dirty(znode);
> znode = cnext;
> cnt += 1; // We get another one.
> }
>
> After applying this patch, the intention of 'cnt' updating is not so obviously.
> However, it does reduce the duplicated codes. I will add an acked-by to let
> Richard determine whether or not apply this patch.
>
> Acked-by: Zhihao Cheng <chengzhihao1@huawei.com>
[...]
As you say, there could be a subjective argument here (for me it was the
other way around :) ), and that the objective argument is that it
reduces the code.
I'm fine with either! Richard, you decide then.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Waqar Hameed <waqar.hameed@axis.com>
To: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: Richard Weinberger <richard@nod.at>, <kernel@axis.com>,
<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ubifs: Move update of cnt in get_znodes_to_commit
Date: Wed, 6 Nov 2024 17:48:17 +0100 [thread overview]
Message-ID: <pndo72s2tri.fsf@axis.com> (raw)
In-Reply-To: <4751d3df-99a6-ec67-1175-ea5375290726@huawei.com> (Zhihao Cheng's message of "Fri, 18 Oct 2024 09:24:03 +0800")
On Fri, Oct 18, 2024 at 09:24 +0800 Zhihao Cheng <chengzhihao1@huawei.com> wrote:
> 在 2024/10/18 2:41, Waqar Hameed 写道:
>> There is no need to update `cnt` for the first dirty node just before
>> the loop, and then again update it at the end of each iteration for the
>> next dirty nodes. Just update `cnt` at the beginning of each iteration
>> instead. This way, the first iteration will count the first dirty node
>> and any subsequent iterations will count the next dirty nodes.
>
> Well, from my own view, I prefer the orignal style because it looks more
> readable.
> c->cnext = find_first_dirty(c->zroot.znode);
> znode = c->enext = c->cnext;
> cnt += 1; // We get the first one.
>
> while (1) {
> cnext = find_next_dirty(znode);
> znode = cnext;
> cnt += 1; // We get another one.
> }
>
> After applying this patch, the intention of 'cnt' updating is not so obviously.
> However, it does reduce the duplicated codes. I will add an acked-by to let
> Richard determine whether or not apply this patch.
>
> Acked-by: Zhihao Cheng <chengzhihao1@huawei.com>
[...]
As you say, there could be a subjective argument here (for me it was the
other way around :) ), and that the objective argument is that it
reduces the code.
I'm fine with either! Richard, you decide then.
next prev parent reply other threads:[~2024-11-06 16:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 18:41 [PATCH] ubifs: Move update of cnt in get_znodes_to_commit Waqar Hameed
2024-10-17 18:41 ` Waqar Hameed
2024-10-18 1:24 ` Zhihao Cheng
2024-10-18 1:24 ` Zhihao Cheng
2024-11-06 16:48 ` Waqar Hameed [this message]
2024-11-06 16:48 ` Waqar Hameed
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=pndo72s2tri.fsf@axis.com \
--to=waqar.hameed@axis.com \
--cc=chengzhihao1@huawei.com \
--cc=kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
/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.