[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <pndo72s2tri.fsf@axis.com>
Date: Wed, 6 Nov 2024 17:48:17 +0100
From: Waqar Hameed <waqar.hameed@...s.com>
To: Zhihao Cheng <chengzhihao1@...wei.com>
CC: Richard Weinberger <richard@....at>, <kernel@...s.com>,
<linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ubifs: Move update of cnt in get_znodes_to_commit
On Fri, Oct 18, 2024 at 09:24 +0800 Zhihao Cheng <chengzhihao1@...wei.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@...wei.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.
Powered by blists - more mailing lists