[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200219053544.GN24185@bombadil.infradead.org>
Date: Tue, 18 Feb 2020 21:35:44 -0800
From: Matthew Wilcox <willy@...radead.org>
To: John Hubbard <jhubbard@...dia.com>
Cc: linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-erofs@...ts.ozlabs.org, linux-ext4@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net, cluster-devel@...hat.com,
ocfs2-devel@....oracle.com, linux-xfs@...r.kernel.org
Subject: Re: [PATCH v6 17/19] iomap: Restructure iomap_readpages_actor
On Tue, Feb 18, 2020 at 07:17:18PM -0800, John Hubbard wrote:
> > - for (done = 0; done < length; done += ret) {
>
> nit: this "for" loop was perfect just the way it was. :) I'd vote here for reverting
> the change to a "while" loop. Because with this change, now the code has to
> separately initialize "done", separately increment "done", and the beauty of a
> for loop is that the loop init and control is all clearly in one place. For things
> that follow that model (as in this case!), that's a Good Thing.
>
> And I don't see any technical reason (even in the following patch) that requires
> this change.
It's doing the increment in the wrong place. We want the increment done in
the middle of the loop, before we check whether we've got to the end of
the page. Not at the end of the loop.
> > + BUG_ON(ctx.cur_page);
>
> Is a full BUG_ON() definitely called for here? Seems like a WARN might suffice...
Dave made a similar comment; I'll pick this up there.
Powered by blists - more mailing lists