From: Christoph Hellwig <hch@lst.de>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: willy@infradead.org, djwong@kernel.org,
linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org,
Fengnan <changfengnan@bytedance.com>
Subject: Re: [RFC PATCH v1 3/3] xfs: example of devirtualizing buffered write iomap callbacks
Date: Thu, 25 Jun 2026 15:00:52 +0200 [thread overview]
Message-ID: <20260625130052.GB22620@lst.de> (raw)
In-Reply-To: <20260625024723.1611000-4-joannelkoong@gmail.com>
On Wed, Jun 24, 2026 at 07:47:23PM -0700, Joanne Koong wrote:
> This is an example of what removing the indirect call would look like.
> With the inlined iomap_buffered_write_inline() that gets passed
> xfs_buffered_write_iomap_begin() and xfs_buffered_write_iomap_end() as
> constant callbacks, the compiler is able to call the callbacks directly
> and drop the indirect call through struct iomap_ops:
Nice. Btw, a more critical path would be direct I/O.
Fengnan, maybe you can play around with this series and your direct read
fast path?
> + /*
> + * Call inlined iomap buffered write and pass constant begin/end
> + * function pointers so the compiler can devirtualize them and avoid the
> + * indirect call through struct iomap_ops.
> + */
> + iter = (struct iomap_iter){
> + .inode = inode,
> + .pos = iocb->ki_pos,
> + .len = iov_iter_count(from),
> + .flags = IOMAP_WRITE,
> + };
> + if (iocb->ki_flags & IOCB_NOWAIT)
> + iter.flags |= IOMAP_NOWAIT;
> + if (iocb->ki_flags & IOCB_DONTCACHE)
> + iter.flags |= IOMAP_DONTCACHE;
We'll probably want a helper for this initializion boilerplate.
Or make it part of iomap_buffered_write_inline somehow?
> + ret = iomap_buffered_write_inline(&iter, from,
> + xfs_buffered_write_iomap_begin,
> + xfs_buffered_write_iomap_end,
So we're not even doing the _next scheme here and already get
results, nice!
> + if (ret > 0)
> + iocb->ki_pos = iter.pos;
Similarly here, it would be great if we could somehow avoid
too much boilerplate.
next prev parent reply other threads:[~2026-06-25 13:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 2:47 [RFC PATCH v1 0/3] iomap: convert to in-iter ->iomap_next() model Joanne Koong
2026-06-25 2:47 ` [RFC PATCH v1 1/3] iomap: add ->iomap_next() and iomap_process() helper Joanne Koong
2026-06-25 12:56 ` Christoph Hellwig
2026-06-25 21:03 ` Joanne Koong
2026-06-26 5:12 ` Christoph Hellwig
2026-06-25 2:47 ` [RFC PATCH v1 2/3] xfs: convert read and buffered write iomap ops to ->iomap_next() Joanne Koong
2026-06-25 2:47 ` [RFC PATCH v1 3/3] xfs: example of devirtualizing buffered write iomap callbacks Joanne Koong
2026-06-25 13:00 ` Christoph Hellwig [this message]
2026-06-25 20:46 ` Joanne Koong
2026-06-29 12:15 ` Fengnan
2026-06-25 3:25 ` [RFC PATCH v1 0/3] iomap: convert to in-iter ->iomap_next() model Gao Xiang
2026-06-25 3:37 ` Gao Xiang
2026-06-25 13:02 ` Christoph Hellwig
2026-06-25 13:21 ` Gao Xiang
2026-06-25 21:33 ` Joanne Koong
2026-06-26 2:22 ` Gao Xiang
2026-06-26 5:10 ` Christoph Hellwig
2026-06-26 5:35 ` Gao Xiang
2026-06-26 5:38 ` Christoph Hellwig
2026-06-25 13:03 ` Christoph Hellwig
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=20260625130052.GB22620@lst.de \
--to=hch@lst.de \
--cc=changfengnan@bytedance.com \
--cc=djwong@kernel.org \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox