mirror-linux/block
Keith Busch 203247c5cb blk-integrity: support arbitrary buffer alignment
A bio segment may have partial interval block data with the rest
continuing into the next segments because direct-io data payloads only
need to align in memory to the device's DMA limits.

At the same time, the protection information may also be split in
multiple segments. The most likely way that may happen is if two
requests merge, or if we're directly using the io_uring user metadata.
The generate/verify, however, only ever accessed the first bip_vec.

Further, it may be possible to unalign the protection fields from the
user space buffer, or if there are odd additional opaque bytes in front
or in back of the protection information metadata region.

Change up the iteration to allow spanning multiple segments. This patch
is mostly a re-write of the protection information handling to allow any
arbitrary alignments, so it's probably easier to review the end result
rather than the diff.

Many controllers are not able to handle interval data composed of
multiple segments when PI is used, so this patch introduces a new
integrity limit that a low level driver can set to notify that it is
capable, default to false. The nvme driver is the first one to enable it
in this patch. Everyone else will force DMA alignment to the logical
block size as before to ensure interval data is always aligned within a
single segment.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Link: https://patch.msgid.link/20260313144701.1221652-2-kbusch@meta.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-03-14 07:44:30 -06:00
..
partitions Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
Kconfig block: Remove obsolete configs BLK_MQ_{PCI,VIRTIO} 2025-05-14 05:43:56 -06:00
Kconfig.iosched block: Default to use cgroup support for BFQ 2023-01-30 09:42:42 -07:00
Makefile block: add fs_bio_integrity helpers 2026-03-09 07:47:02 -06:00
badblocks.c badblocks: Fix a nonsense WARN_ON() which checks whether a u64 variable < 0 2025-03-10 07:41:58 -06:00
bdev.c block: remove redundant kill_bdev() call in set_blocksize() 2026-02-04 09:28:18 -07:00
bfq-cgroup.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
bfq-iosched.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
bfq-iosched.h block, bfq: update outdated comment 2026-01-01 08:57:37 -07:00
bfq-wf2q.c block, bfq: inject I/O to underutilized actuators 2023-01-29 15:18:33 -07:00
bio-integrity-auto.c block: prepare generation / verification helpers for fs usage 2026-03-09 07:47:02 -06:00
bio-integrity-fs.c block: add fs_bio_integrity helpers 2026-03-09 07:47:02 -06:00
bio-integrity.c block: factor out a bio_integrity_setup_default helper 2026-03-09 07:47:02 -06:00
bio.c Merge branch 'for-7.1/block-integrity' into for-7.1/block 2026-03-09 14:30:14 -06:00
blk-cgroup-fc-appid.c block: Replace all non-returning strlcpy with strscpy 2023-06-01 09:13:31 -06:00
blk-cgroup-rwstat.c blk-cgroup: use group allocation/free of per-cpu counters API 2024-04-03 09:10:17 -06:00
blk-cgroup-rwstat.h blk-cgroup: rwstat: fix kernel-doc warnings in header file 2025-01-13 07:47:09 -07:00
blk-cgroup.c blk-cgroup: wait for blkcg cleanup before initializing new disk 2026-03-11 08:30:30 -06:00
blk-cgroup.h block: initialize bio issue time in blk_mq_submit_bio() 2025-09-10 05:23:45 -06:00
blk-core.c blk-mq: add a new queue sysfs attribute async_depth 2026-02-03 07:45:36 -07:00
blk-crypto-fallback.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
blk-crypto-internal.h blk-crypto: handle the fallback above the block layer 2026-01-11 12:55:41 -07:00
blk-crypto-profile.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
blk-crypto-sysfs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
blk-crypto.c blk-crypto: handle the fallback above the block layer 2026-01-11 12:55:41 -07:00
blk-flush.c block: pass io_comp_batch to rq_end_io_fn callback 2026-01-20 10:12:54 -07:00
blk-ia-ranges.c block: get rid of request queue ->sysfs_dir_lock 2025-01-29 07:16:47 -07:00
blk-integrity.c block: don't merge bios with different app_tags 2026-01-06 19:10:08 -07:00
blk-ioc.c copy_process: pass clone_flags as u64 across calltree 2025-09-01 15:31:34 +02:00
blk-iocost.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
blk-iolatency.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
blk-ioprio.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
blk-ioprio.h blk-ioprio: remove per-disk structure 2024-07-28 16:47:51 -06:00
blk-lib.c block: change return type to void 2026-02-12 04:23:53 -07:00
blk-map.c block-7.0-20260305 2026-03-06 08:36:18 -08:00
blk-merge.c for-7.0/block-stable-pages-20260206 2026-02-09 18:14:52 -08:00
blk-mq-cpumap.c blk-mq: add number of queue calc helper 2025-07-01 10:24:19 -06:00
blk-mq-debugfs.c block: allow submitting all zone writes from a single context 2026-03-09 14:30:00 -06:00
blk-mq-debugfs.h blk-mq-debugfs: remove blk_mq_debugfs_unregister_rqos() 2026-02-02 07:05:19 -07:00
blk-mq-dma.c block: fix partial IOVA mapping cleanup in blk_rq_dma_map_iova 2026-02-12 04:23:31 -07:00
blk-mq-sched.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
blk-mq-sched.h blk-mq-sched: unify elevators checking for async requests 2026-02-03 07:45:36 -07:00
blk-mq-sysfs.c blk-mq: Move flush queue allocation into blk_mq_init_hctx() 2025-09-08 08:05:32 -06:00
blk-mq-tag.c blk-mq: use array manage hctx map instead of xarray 2025-11-28 09:09:19 -07:00
blk-mq.c block: clear BIO_QOS flags in blk_steal_bios() 2026-03-10 07:11:09 -06:00
blk-mq.h blk-mq: use queue_hctx in blk_mq_map_queue_type 2025-12-01 07:18:31 -07:00
blk-pm.c block: force noio scope in blk_mq_freeze_queue 2025-01-31 07:20:08 -07:00
blk-pm.h
blk-rq-qos.c blk-mq-debugfs: remove blk_mq_debugfs_unregister_rqos() 2026-02-02 07:05:19 -07:00
blk-rq-qos.h blk-rq-qos: Remove unlikely() hints from QoS checks 2026-01-06 19:08:23 -07:00
blk-settings.c blk-integrity: support arbitrary buffer alignment 2026-03-14 07:44:30 -06:00
blk-stat.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
blk-stat.h blk-stat: convert struct blk_stat_callback to kernel-doc 2026-02-16 10:21:06 -07:00
blk-sysfs.c block: default to QD=1 writes for blk-mq rotational zoned devices 2026-03-09 14:30:00 -06:00
blk-throttle.c block/blk-throttle: Remove throtl_slice from struct throtl_data 2025-11-17 09:39:48 -07:00
blk-throttle.h blk-throttle: fix access race during throttle policy activation 2025-09-08 08:24:44 -06:00
blk-timeout.c
blk-wbt.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
blk-wbt.h blk-wbt: factor out a helper wbt_set_lat() 2026-02-02 07:05:19 -07:00
blk-zoned.c block: allow submitting all zone writes from a single context 2026-03-09 14:30:00 -06:00
blk.h block: prepare generation / verification helpers for fs usage 2026-03-09 07:47:02 -06:00
bsg-lib.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
bsg.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
disk-events.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
early-lookup.c wrapper for access to ->bd_partno 2024-05-02 17:48:09 -04:00
elevator.c block: use trylock to avoid lockdep circular dependency in sysfs 2026-03-05 04:01:42 -07:00
elevator.h block: fix race between wbt_enable_default and IO submission 2025-12-12 12:51:11 -07:00
fops.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
genhd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
holder.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ioctl.c block: allow IOC_PR_READ_* ioctls with BLK_OPEN_READ 2026-02-11 10:36:54 -07:00
ioprio.c block: remove test of incorrect io priority level 2025-05-08 09:04:12 -06:00
kyber-iosched.c kyber: covert to use request_queue->async_depth 2026-02-03 07:45:36 -07:00
mq-deadline.c mq-deadline: covert to use request_queue->async_depth 2026-02-03 07:45:36 -07:00
opal_proto.h sed-opal: add IOC_OPAL_REACTIVATE_LSP. 2026-03-09 14:29:59 -06:00
sed-opal.c sed-opal: add IOC_OPAL_GET_SUM_STATUS ioctl. 2026-03-09 14:29:59 -06:00
t10-pi.c blk-integrity: support arbitrary buffer alignment 2026-03-14 07:44:30 -06:00