block: cap atomic write size by PI buffer size constraints

As Sashiko points out, limiting the I/O size by the size of the available
PI buffer can cause inconsistencies for atomic writes.  This also limit
atomic_write_max_sectors in blk_validate_integrity_limits.

Fixes: ec7f31b2a2 ("block: make bio auto-integrity deadlock safe")
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Martin K. Petersen <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
Christoph Hellwig
2026-09-11 07:24:54 -06:00
committed by Jens Axboe
parent d952f6acb7
commit 1418b5633c
+6
View File
@@ -206,6 +206,12 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
lim->max_sectors = min(lim->max_sectors,
max_integrity_io_size(lim) >> SECTOR_SHIFT);
if (lim->features & BLK_FEAT_ATOMIC_WRITES) {
lim->atomic_write_max_sectors =
min(lim->atomic_write_max_sectors,
max_integrity_io_size(lim) >> SECTOR_SHIFT);
}
return 0;
}