From: Brian Foster <bfoster@redhat.com>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: brauner@kernel.org, hch@infradead.org, djwong@kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v1] iomap: simplify iomap_iter_advance()
Date: Thu, 18 Sep 2025 07:31:33 -0400 [thread overview]
Message-ID: <aMvtlfIRvb9dzABh@bfoster> (raw)
In-Reply-To: <CAJnrk1ZeYWseb0rpTT7w5S-c1YuVXe-w-qMVCAiwTJRpgm+fbQ@mail.gmail.com>
On Wed, Sep 17, 2025 at 02:54:09PM -0700, Joanne Koong wrote:
> On Wed, Sep 17, 2025 at 6:08 AM Brian Foster <bfoster@redhat.com> wrote:
> >
> > On Tue, Sep 16, 2025 at 05:40:01PM -0700, Joanne Koong wrote:
> > > Most callers of iomap_iter_advance() do not need the remaining length
> > > returned. Get rid of the extra iomap_length() call that
> > > iomap_iter_advance() does. If the caller wants the remaining length,
> > > they can make the call to iomap_length().
> > >
> > > Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
> > > ---
> >
> > Indeed this does clean up some of the calls that create a local var
> > purely to work around the interface. OTOH, the reason I made the advance
> > update the length was so it was clear the remaining length would be used
> > correctly in those looping callers. Otherwise I'm not sure it's clear
> > the bytes/length value needs to be updated and that felt like an easy
> > mistake to make to me.
> >
> > I don't really have a strong preference so I'll defer to whatever the
> > majority opinion is. I wonder though if something else worth considering
> > is to rename the current helper to __iomap_iter_advance() (or whatever)
> > and make your updated variant of iomap_iter_advance() into a wrapper of
> > it.
>
> That idea sounds good to me too, though I wonder for the naming of it
> if iomap_iter_advance() should remain the current helper and
> __iomap_iter_advance() should be for this more-minimal version of it.
> From what I've seen elsewhere, it seems like the __ prefix is used for
> minimum behavior and then the non-__ version of it is for that
> behavior + extra stuff.
>
IME the __iomap_iter_advance() would be the most low level and flexible
version, whereas the wrappers simplify things. There's also the point
that the wrapper seems the more common case, so maybe that makes things
cleaner if that one is used more often.
But TBH I'm not sure there is strong precedent. I'm content if we can
retain the current variant for the callers that take advantage of it.
Another idea is you could rename the current function to
iomap_iter_advance_and_update_length_for_loopy_callers() and see what
alternative suggestions come up. ;)
Brian
>
> Thanks,
> Joanne
> >
> > Brian
>
next prev parent reply other threads:[~2025-09-18 11:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 0:40 [PATCH v1] iomap: simplify iomap_iter_advance() Joanne Koong
2025-09-17 13:12 ` Brian Foster
2025-09-17 21:54 ` Joanne Koong
2025-09-18 11:31 ` Brian Foster [this message]
2025-09-18 14:27 ` Christoph Hellwig
2025-09-18 20:18 ` Brian Foster
2025-09-18 22:10 ` Joanne Koong
2025-09-19 11:35 ` Brian Foster
2025-09-19 18:03 ` Joanne Koong
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=aMvtlfIRvb9dzABh@bfoster \
--to=bfoster@redhat.com \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/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.