[RFC PATCH v3 00/13] fs: dma-buf direct I/O for XFS and ext4

From: Nitesh Shetty

Date: Tue Dec 01 2026 - 11:54:07 EST


This series extends io_uring dma-buf registered buffers from block
devices to direct I/O on XFS and ext4 files.
It combines the XFS [1] and ext4 [3] series and builds on Pavel's work
to share a registration across files [2].

A new dma_buf_io_tag() file operation returns a tag for the device a
file does I/O to, or 0 if it can't do dma-buf I/O.
One registration serves all files with the same tag.
Block devices use the disk sequence number.
ext4 and XFS use the tag of the device holding the file's data, namely
s_bdev for ext4, and the data or realtime device for XFS.

Paths that copy data through the CPU refuse dma-buf iterators, namely
buffered fallbacks, DAX, holes inside the file, inline data, bounce
buffers, the blk-crypto fallback and integrity metadata.

Changes since [1], [2] and [3]:
- Merge the XFS and ext4 series.
- Replace the struct file field of [2] and FMODE_CAN_DMABUF_IO of [3]
with a dma_buf_io_tag() file operation.
- Refuse I/O to another device with the tag, instead of one context
per device.
- Use the disk sequence number as the block device tag instead of the
gendisk pointer.
- Step over holes past EOF in iomap (Yun Wang).

[1] https://lore.kernel.org/linux-xfs/20261016091919.971295-1-anuj1072538@xxxxxxxxx/
[2] https://lore.kernel.org/all/7165ab453cc680276b88f47f9ae89bc4967543cd.1793751001.git.asml.silence@xxxxxxxxx/
[3] https://lore.kernel.org/all/20261113070621.273953-1-mengmeng.zhao@xxxxxxxxx/

Mengmeng Zhao (4):
iomap: don't ask for a buffered fallback for dma-buf iterators
blk-crypto: refuse dma-buf bios in the fallback path
dax: refuse dma-buf iterators in dax_iomap_rw()
ext4: support dma-buf registered buffers for direct I/O

Nitesh Shetty (6):
block: factor out bdev_init_dma_buf_io_ctx()
dma-buf-io: add tags to share a context between files
block: set dma-buf-io tag for block files
dma-buf-io: require O_DIRECT and a tag in dma_buf_io_ctx_create()
iomap: add dma-buf direct I/O guards
xfs: support dma-buf registered buffers for direct I/O

Pavel Begunkov (3):
io_uring: add data to dma-buf conversion helpers
io_uring/dma-buf: switch to tag file filtering
io_uring/dma-buf: get rid of struct io_buf_dma

.../filesystems/iomap/operations.rst | 3 ++
block/bdev.c | 28 +++++++++++
block/blk-crypto.c | 8 +++
block/fops.c | 16 +++---
drivers/dma-buf/dma-buf-io.c | 16 ++++--
fs/dax.c | 4 ++
fs/ext4/ext4.h | 10 ++++
fs/ext4/file.c | 45 +++++++++++++++--
fs/iomap/direct-io.c | 49 +++++++++++++++++--
fs/xfs/xfs_file.c | 40 +++++++++++++++
include/linux/blkdev.h | 18 +++++++
include/linux/dma-buf-io.h | 19 +++++++
include/linux/fs.h | 1 +
io_uring/dma-buf.c | 19 ++-----
io_uring/dma-buf.h | 24 +++++----
15 files changed, 257 insertions(+), 43 deletions(-)


base-commit: 71da94f340e4edf35a3995f38d47bc754aeb6819
--
2.47.3