lazy bounce buffering for checksummed reads v3

From
Christoph Hellwig <hch@lst.de>
Date
2026-09-09 06:09:32
Also in
linux-fsdevel, linux-xfs
Hi all,

this series improves performance and resource usage for reads from
devices that require stable pages due to checksumming on XFS.

Currently XFS unconditionally bounce buffers reads on such devices to
prevent user modifications to the buffer from corrupting the data,
leading to checksum failures.

This uses DRAM bandwidth and CPU cycles for copies that are not needed
most of the time, and due to the use of a bio_vec for the bounce
buffer to smaller than wanted and unaligned I/O sizes when using 4k
user pages (i.e. 1MB-4k I/O).

This series addresses this by reading without the bounce buffer first,
and then only allocating a buffer and reading into that again on an
initial checksum failure.  To accommodate for rare (or hypothetical?)
applications that have legitimate needs to frequently modify in-flight
buffers, a sysfs know is provided to revert to the old behavior.

NOTE/QUESTION TO SUBSYSTEM MAINTAINERS: The patches in this series are
split over 3 subsystems, and I'd love to hear from the maintainers
about their preferences for merging this.

The baseline of this series is mainline with the
"misc block PI / bounce buffering fixes" series.


A git tree is available to help with the review here:

    git://git.infradead.org/users/hch/misc.git lazy-bounce

Gitweb:

    https://git.infradead.org/?p=users/hch/misc.git;a=shortlog;h=refs/heads/lazy-bounce

Changes since v2:
 - break out of bio_iov_iter_get_pages when bi_size reaches maxlen
 - various fixes for pre-existing issues pointed out by Sashiko
 - generate zone PI a bit earlier
 - initialize the csum dir in sysfs unconditionally to protect against the
   rather theoretical case of the flag changing underneath us
 - redo sysfs initialization order to avoid a cleanup bug
 - use NOFS allocations in xfs_read_bounce_and_resubmit
 - rework bio setup for reissue to not leave land mines for other uses
 - fix commit message typos
 - fix comment typos

Changes since v1:
 - rebase on 7.3rc-1 and xfs for-next, which has the bio complete in
   task support merged
 - remove the now unused IOMAP_DIO_BOUNCE support for reads
 - fix compilation with integrity disabled
 - make I/O size limitation actually work
 - clear REQ_POLLED when bounce buffering
 - use sysfs string match helpers to allow non -n echo
Thread (30 messages) 30 messages, 6 authors, last reply 2026-09-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help