block: apply the segment size to the integrity buffer

The integrity buffer is a single segment and must not exceed
max_segment_size. max_integrity_io_size() applies that limit to the data
size instead, which is off by a factor of 64 for 8 bytes of PI per 512
bytes of data. A SCSI host that doesn't set a maximum segment size gets
64KiB, lpfc and qla2xxx among them, so a DIX disk behind one of those
does no IO above 64KiB.

Limit the buffer and derive the data size from that, which makes it 4MiB
for that case.

Fixes: ec7f31b2a2 ("block: make bio auto-integrity deadlock safe")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261028164415.1262013-45-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Josef Bacik 2026-10-28 10:41:47 -06:00 committed by Jens Axboe
parent 10b249e9b0
commit 26edfdee11

View File

@ -1819,11 +1819,12 @@ static inline int bio_split_rw_at(struct bio *bio,
*/
static inline unsigned int max_integrity_io_size(struct queue_limits *lim)
{
u64 max_intervals;
unsigned int buf_size = min_t(unsigned int, lim->max_segment_size,
BLK_INTEGRITY_MAX_SIZE);
max_intervals = BLK_INTEGRITY_MAX_SIZE / lim->integrity.metadata_size;
return min_t(u64, lim->max_segment_size,
max_intervals << lim->integrity.interval_exp);
return min_t(u64, UINT_MAX,
(u64)(buf_size / lim->integrity.metadata_size) <<
lim->integrity.interval_exp);
}
#define DEFINE_IO_COMP_BATCH(name) struct io_comp_batch name = { }