[PATCHv4 0/9] direct io dma alignment

Keith Busch
2022-05-26T01:06:34Z

From: Keith Busch <kbusch@kernel.org>

This is mostly the same as v3, but with more code comments, prep
patches, replace '9' with 'SECTOR_SHIFT', and added reviews.

The biggest thing is I brought fs support back in the last patch.

For testing, I used 'fio', which has an 'iomem_align' parameter that can
force arbitrary memory offsets, even with direct-io. I created two data
integrity verifying profiles: one for raw block, the other for
filesystems, and ran each of them on two nvme namespaces. One namespace
was formatted 512b, the other was 4k.

The profile has different jobs: one smaller transfers, and one larger.
This to exercise both the simple and normal direct io cases, as well as
bio_split() conditions.

For filesystems testing, I used xfs, ext4 and btrfs to represent iomap,
and just ext2 for the older direct io. Note, btrfs falls back to
buffered anyway (see check_direct_IO()), so btrfs was essentially not
testing the direct io path.

Here is an example of one of the profiles for the raw block test:

[global]
filename=/dev/nvme0n1
ioengine=io_uring
verify=crc32c
rw=randwrite
iodepth=64
direct=1

[small]
stonewall
bsrange=4k-64k
iomem_align=4

[large]
stonewall
bsrange=512k-4M
iomem_align=100

Keith Busch (9):
block: fix infiniate loop for invalid zone append
block/bio: remove duplicate append pages code
block: export dma_alignment attribute
block: introduce bdev_dma_alignment helper
block: add a helper function for dio alignment
block/merge: count bytes instead of sectors
block/bounce: count bytes instead of sectors
block: relax direct io memory alignment
fs: add support for dma aligned direct-io

Documentation/ABI/stable/sysfs-block | 9 +++
block/bio.c | 117 +++++++++++++--------------
block/blk-merge.c | 41 ++++++----
block/blk-sysfs.c | 7 ++
block/bounce.c | 12 ++-
block/fops.c | 40 ++++++---
fs/direct-io.c | 11 ++-
fs/iomap/direct-io.c | 3 +-
include/linux/blkdev.h | 5 ++
9 files changed, 146 insertions(+), 99 deletions(-)

--
2.30.2