public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* bounce buffer direct I/O when stable pages are required v3
@ 2026-01-26  5:53 Christoph Hellwig
  2026-01-26  5:53 ` [PATCH 01/15] block: add a BIO_MAX_SIZE constant and use it Christoph Hellwig
                   ` (18 more replies)
  0 siblings, 19 replies; 37+ messages in thread
From: Christoph Hellwig @ 2026-01-26  5:53 UTC (permalink / raw)
  To: Jens Axboe, Christian Brauner
  Cc: Darrick J. Wong, Carlos Maiolino, Qu Wenruo, Al Viro, linux-block,
	linux-xfs, linux-fsdevel

Hi all,

[note to maintainers:  we're ready to merge I think, and Christian
already said he'd do on Friday.  If acceptable to everyone I'd like
to merge it through the block tree, or topic branch in it due to
pending work on top of this]

this series tries to address the problem that under I/O pages can be
modified during direct I/O, even when the device or file system require
stable pages during I/O to calculate checksums, parity or data
operations.  It does so by adding block layer helpers to bounce buffer
an iov_iter into a bio, then wires that up in iomap and ultimately
XFS.

The reason that the file system even needs to know about it, is because
reads need a user context to copy the data back, and the infrastructure
to defer ioends to a workqueue currently sits in XFS.  I'm going to look
into moving that into ioend and enabling it for other file systems.
Additionally btrfs already has it's own infrastructure for this, and
actually an urgent need to bounce buffer, so this should be useful there
and could be wire up easily.  In fact the idea comes from patches by
Qu that did this in btrfs.

This patch fixes all but one xfstests failures on T10 PI capable devices
(generic/095 seems to have issues with a mix of mmap and splice still,
I'm looking into that separate), and make qemu VMs running Windows,
or Linux with swap enabled fine on an XFS file on a device using PI.

Performance numbers on my (not exactly state of the art) NVMe PI test
setup:

  Sequential reads using io_uring, QD=16.
  Bandwidth and CPU usage (usr/sys):

  | size |        zero copy         |          bounce          |
  +------+--------------------------+--------------------------+
  |   4k | 1316MiB/s (12.65/55.40%) | 1081MiB/s (11.76/49.78%) |
  |  64K | 3370MiB/s ( 5.46/18.20%) | 3365MiB/s ( 4.47/15.68%) |
  |   1M | 3401MiB/s ( 0.76/23.05%) | 3400MiB/s ( 0.80/09.06%) |
  +------+--------------------------+--------------------------+

  Sequential writes using io_uring, QD=16.
  Bandwidth and CPU usage (usr/sys):

  | size |        zero copy         |          bounce          |
  +------+--------------------------+--------------------------+
  |   4k |  882MiB/s (11.83/33.88%) |  750MiB/s (10.53/34.08%) |
  |  64K | 2009MiB/s ( 7.33/15.80%) | 2007MiB/s ( 7.47/24.71%) |
  |   1M | 1992MiB/s ( 7.26/ 9.13%) | 1992MiB/s ( 9.21/19.11%) |
  +------+--------------------------+--------------------------+

Note that the 64k read numbers look really odd to me for the baseline
zero copy case, but are reproducible over many repeated runs.

The bounce read numbers should further improve when moving the PI
validation to the file system and removing the double context switch,
which I have patches for that will sent out soon.

Changes since v2:
 - add a BIO_MAX_SIZE constant and use it
 - remove a pointless repeated page_folio call
 - fix a comment typo
 - add a new comment about copying to a pinned iter

Changes since v1:
 - spelling fixes
 - add more details to some commit messages
 - add a new code comment about freeing the bio early in the I/O
   completion handler

Diffstat:
 block/bio.c               |  332 ++++++++++++++++++++++++++++------------------
 block/blk-lib.c           |    9 -
 block/blk-merge.c         |    8 -
 block/blk.h               |   11 -
 fs/iomap/direct-io.c      |  191 ++++++++++++++------------
 fs/iomap/ioend.c          |    8 +
 fs/xfs/xfs_aops.c         |    8 -
 fs/xfs/xfs_file.c         |   41 +++++
 include/linux/bio.h       |   26 +++
 include/linux/blk_types.h |    3 
 include/linux/iomap.h     |    9 +
 include/linux/uio.h       |    3 
 lib/iov_iter.c            |   98 +++++++++++++
 13 files changed, 507 insertions(+), 240 deletions(-)

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2026-01-28 12:17 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-26  5:53 bounce buffer direct I/O when stable pages are required v3 Christoph Hellwig
2026-01-26  5:53 ` [PATCH 01/15] block: add a BIO_MAX_SIZE constant and use it Christoph Hellwig
2026-01-26  6:20   ` Damien Le Moal
2026-01-26 10:24   ` Johannes Thumshirn
2026-01-26 10:55   ` Anuj gupta
2026-01-26 19:36   ` Darrick J. Wong
2026-01-27 14:22   ` Martin K. Petersen
2026-01-26  5:53 ` [PATCH 02/15] block: refactor get_contig_folio_len Christoph Hellwig
2026-01-26 10:59   ` Anuj gupta
2026-01-27 14:24   ` Martin K. Petersen
2026-01-26  5:53 ` [PATCH 03/15] block: open code bio_add_page and fix handling of mismatching P2P ranges Christoph Hellwig
2026-01-27 14:25   ` Martin K. Petersen
2026-01-26  5:53 ` [PATCH 04/15] iov_iter: extract a iov_iter_extract_bvecs helper from bio code Christoph Hellwig
2026-01-26  6:27   ` Damien Le Moal
2026-01-26 11:48     ` Christoph Hellwig
2026-01-27 14:26   ` Martin K. Petersen
2026-01-26  5:53 ` [PATCH 05/15] block: remove bio_release_page Christoph Hellwig
2026-01-27 14:27   ` Martin K. Petersen
2026-01-26  5:53 ` [PATCH 06/15] block: add helpers to bounce buffer an iov_iter into bios Christoph Hellwig
2026-01-26 19:39   ` Darrick J. Wong
2026-01-27 14:29   ` Martin K. Petersen
2026-01-26  5:53 ` [PATCH 07/15] iomap: fix submission side handling of completion side errors Christoph Hellwig
2026-01-26  5:53 ` [PATCH 08/15] iomap: simplify iomap_dio_bio_iter Christoph Hellwig
2026-01-26  5:53 ` [PATCH 09/15] iomap: split out the per-bio logic from iomap_dio_bio_iter Christoph Hellwig
2026-01-26  5:53 ` [PATCH 10/15] iomap: share code between iomap_dio_bio_end_io and iomap_finish_ioend_direct Christoph Hellwig
2026-01-26  5:53 ` [PATCH 11/15] iomap: free the bio before completing the dio Christoph Hellwig
2026-01-26  6:22   ` Damien Le Moal
2026-01-26 11:49     ` Christoph Hellwig
2026-01-26  5:53 ` [PATCH 12/15] iomap: rename IOMAP_DIO_DIRTY to IOMAP_DIO_USER_BACKED Christoph Hellwig
2026-01-26  5:53 ` [PATCH 13/15] iomap: support ioends for direct reads Christoph Hellwig
2026-01-26  5:53 ` [PATCH 14/15] iomap: add a flag to bounce buffer direct I/O Christoph Hellwig
2026-01-26  5:53 ` [PATCH 15/15] xfs: use bounce buffering direct I/O when the device requires stable pages Christoph Hellwig
2026-01-26 10:54 ` bounce buffer direct I/O when stable pages are required v3 Anuj gupta
2026-01-26 12:47   ` Christoph Hellwig
2026-01-28  9:50 ` Carlos Maiolino
2026-01-28 12:17 ` Jens Axboe
2026-01-28 12:17 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox