linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joanne Koong <joannelkoong@gmail.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: miklos@szeredi.hu, djwong@kernel.org, brauner@kernel.org,
	 linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org,
	 bernd.schubert@fastmail.fm, kernel-team@meta.com
Subject: Re: [PATCH v1 4/8] iomap: add writepages support for IOMAP_IN_MEM iomaps
Date: Tue, 10 Jun 2025 11:58:42 -0700	[thread overview]
Message-ID: <CAJnrk1a4VmaBhmjAjhBtcjFoa0hUgOQLj7dQc0x0C70a-Ms+5g@mail.gmail.com> (raw)
In-Reply-To: <CAJnrk1YNM5fotdoRmmHi3ZTig_3GDb-kcSce9haZDxG97insKw@mail.gmail.com>

On Tue, Jun 10, 2025 at 11:23 AM Joanne Koong <joannelkoong@gmail.com> wrote:
>
> On Mon, Jun 9, 2025 at 8:58 PM Christoph Hellwig <hch@infradead.org> wrote:
> >
> > On Mon, Jun 09, 2025 at 04:15:27PM -0700, Joanne Koong wrote:
> > > ioends are used in fuse for cleaning up state. fuse implements a
> > > ->submit_ioend() callback in fuse_iomap_submit_ioend() (in patch 7/8).
> >
> > But do you use struct iomap_ioend at all?  (Sorry, still don't have a
> > whole tree with the patches applied in front of me).
>
> I don't use struct iomap_ioend at all and I'm realizing now that I
> should just have fuse manually do the end-of-io submission after it
> calls iomap_writepages() / iomap_writeback_dirty_folio() instead of
> defining a ->submit_ioend(). Then, we can get rid of this
>
>  int iomap_submit_ioend(struct iomap_writepage_ctx *wpc, int error)
>  {
> +    if (wpc->iomap.type == IOMAP_IN_MEM) {
> +       if (wpc->ops->submit_ioend)
> +          error = wpc->ops->submit_ioend(wpc, error);
> +       return error;
> +    }
>
> that was added and leave the iomap_submit_ioend() logic untouched.

Actually, nvm. You're right, it's cleaner to just have ioend stuff be totally
abstracted away like you suggested below. I'll make that change for
v2.

>
> >
> > > > Given that the patch that moved things around already wrapped the
> > > > error propagation to the bio into a helpr, how does this differ
> > > > from the main path in the function now?
> > > >
> > >
> > > If we don't add this special casing for IOMAP_IN_MEM here, then in
> > > this function it'll hit the "if (!wpc->ioend)" case right in the
> > > beginning and return error without calling the ->submit_ioend()
> >
> > So this suggests you don't use struct iomap_ioend at all.  Given that
> > you add a private field to iomap_writepage_ctx I guess that is where
> > you chain the fuse requests?
> >
> > Either way I think we should clean this up one way or another.  If the
> > non-block iomap writeback code doesn't use ioends we should probably move
> > the ioend chain into the private field, and hide everything using it (or
> > even the ioend name) in proper abstraction.  In this case this means
> > finding another way to check for a non-empty wpc.  One way would be to
> > check nr_folios as any non-empty wbc must have a number of folios
> > attached to it, the other would be to move the check into the
> > ->submit_ioend method including the block fallback.  For a proper split
> > the method should probably be renamed, and we'd probably want to require
> > every use to provide the submit method, even if the trivial block
> > users set it to the default one provided.
> >
> > > > > -             if (!count)
> > > > > +             /*
> > > > > +              * If wpc->ops->writeback_folio is set, then it is responsible
> > > > > +              * for ending the writeback itself.
> > > > > +              */
> > > > > +             if (!count && !wpc->ops->writeback_folio)
> > > > >                       folio_end_writeback(folio);
> > > >
> > > > This fails to explain why writeback_folio does the unlocking itself.
> > >
> > > writeback_folio needs to do the unlocking itself because the writeback
> > > may be done asynchronously (as in the case for fuse). I'll add that as
> > > a comment in v2.
> >
> > So how do you end up with a zero count here and still want
> > the fuse code to unlock?
> >
>
> count is unused by ->writeback_folio(), so it's always just zero. But
> I see what you're saying now. I should just increment count after
> doing the ->writeback_folio() call and then we could just leave the
> "if (!count)" check untouched. I like this suggestion a lot, i'll make
> this change in v2.

  reply	other threads:[~2025-06-10 18:58 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06 23:37 [PATCH v1 0/8] fuse: use iomap for buffered writes + writeback Joanne Koong
2025-06-06 23:37 ` [PATCH v1 1/8] iomap: move buffered io bio logic into separate file Joanne Koong
2025-06-08 19:17   ` Anuj gupta
2025-06-09  4:44   ` Christoph Hellwig
2025-06-09 20:01     ` Joanne Koong
2025-06-06 23:37 ` [PATCH v1 2/8] iomap: add IOMAP_IN_MEM iomap type Joanne Koong
2025-06-09  4:45   ` Christoph Hellwig
2025-06-09 21:45     ` Joanne Koong
2025-06-10  3:39       ` Christoph Hellwig
2025-06-10 13:27         ` Christoph Hellwig
2025-06-10 20:13           ` Joanne Koong
2025-06-11  4:04             ` Christoph Hellwig
2025-06-11  6:00               ` Joanne Koong
2025-06-11  6:08                 ` Christoph Hellwig
2025-06-11 18:33                 ` Joanne Koong
2025-06-11 18:50                   ` Darrick J. Wong
2025-06-11 23:08                     ` Joanne Koong
2025-06-12  4:42                       ` Christoph Hellwig
2025-06-09 16:24   ` Darrick J. Wong
2025-06-09 21:28     ` Joanne Koong
2025-06-12  3:53       ` Darrick J. Wong
2025-06-06 23:37 ` [PATCH v1 3/8] iomap: add buffered write support for IOMAP_IN_MEM iomaps Joanne Koong
2025-06-09  4:56   ` Christoph Hellwig
2025-06-09 22:45     ` Joanne Koong
2025-06-10  3:44       ` Christoph Hellwig
2025-06-09 16:38   ` Darrick J. Wong
2025-06-09 22:03     ` Joanne Koong
2025-06-12  3:54       ` Darrick J. Wong
2025-06-06 23:37 ` [PATCH v1 4/8] iomap: add writepages " Joanne Koong
2025-06-09  5:32   ` Christoph Hellwig
2025-06-09 16:57     ` Darrick J. Wong
2025-06-10  3:49       ` Christoph Hellwig
2025-06-12  3:56         ` Darrick J. Wong
2025-06-09 23:15     ` Joanne Koong
2025-06-10  3:58       ` Christoph Hellwig
2025-06-10 18:23         ` Joanne Koong
2025-06-10 18:58           ` Joanne Koong [this message]
2025-06-11  4:01           ` Christoph Hellwig
2025-06-06 23:38 ` [PATCH v1 5/8] iomap: add iomap_writeback_dirty_folio() Joanne Koong
2025-06-09  4:51   ` Christoph Hellwig
2025-06-09 17:14     ` Darrick J. Wong
2025-06-09 23:54       ` Joanne Koong
2025-06-10  3:59       ` Christoph Hellwig
2025-06-11  4:34         ` Matthew Wilcox
2025-06-18  4:47           ` does fuse need ->launder_folios, was: " Christoph Hellwig
2025-06-18 12:17           ` Jeff Layton
2025-06-20 18:15             ` Matthew Wilcox
2025-06-25  5:26               ` Joanne Koong
2025-06-25  6:26                 ` Christoph Hellwig
2025-06-25 16:44                   ` Joanne Koong
2025-07-01  5:41                     ` Darrick J. Wong
2025-07-02 21:36                       ` Joanne Koong
2025-07-02 21:47                         ` Joanne Koong
2025-07-01  6:23                     ` Miklos Szeredi
2025-06-09 23:30     ` Joanne Koong
2025-06-10  4:03       ` Christoph Hellwig
2025-06-06 23:38 ` [PATCH v1 6/8] fuse: use iomap for buffered writes Joanne Koong
2025-06-06 23:38 ` [PATCH v1 7/8] fuse: use iomap for writeback Joanne Koong
2025-06-08 19:20   ` Anuj gupta
2025-06-06 23:38 ` [PATCH v1 8/8] fuse: use iomap for folio laundering Joanne Koong
2025-06-08 19:12 ` [PATCH v1 0/8] fuse: use iomap for buffered writes + writeback Anuj gupta
2025-06-09 19:59   ` Joanne Koong
2025-06-14 14:22     ` Anuj gupta
2025-06-09  4:40 ` Christoph Hellwig
2025-06-09 12:38   ` Anuj gupta
2025-06-09 19:47     ` Joanne Koong
2025-06-10  4:04     ` Christoph Hellwig
2025-06-10  0:47 ` Dave Chinner
2025-06-10  4:06   ` Christoph Hellwig
2025-06-10 20:33   ` 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=CAJnrk1a4VmaBhmjAjhBtcjFoa0hUgOQLj7dQc0x0C70a-Ms+5g@mail.gmail.com \
    --to=joannelkoong@gmail.com \
    --cc=bernd.schubert@fastmail.fm \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=kernel-team@meta.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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;
as well as URLs for NNTP newsgroup(s).