diff options
| author | Josef Bacik <josef@toxicpanda.com> | 2026-10-28 10:41:47 -0600 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-10-29 07:15:47 -0600 |
| commit | 26edfdee11eb2afe08fb5f874edcdf0786d6b66c (patch) | |
| tree | 1e3bb66341d2f3598e75a0ad20e6788b0aaa6dbd | |
| parent | 10b249e9b05eed0c4c65b9b89dfc2cf33d68d19a (diff) | |
| download | linux-26edfdee11eb2afe08fb5f874edcdf0786d6b66c.tar.gz linux-26edfdee11eb2afe08fb5f874edcdf0786d6b66c.zip | |
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: ec7f31b2a2d3 ("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>
| -rw-r--r-- | include/linux/blkdev.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index d003a9d2d1f6..1a965fb5ae6f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -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 = { } |
