On 13/02/2025 11:33, Ming Lei wrote:
I think that we need to take max_segment_size into account in
blk_queue_max_guaranteed_bio(), like:
static unsigned int blk_queue_max_guaranteed_bio(struct queue_limits *lim)
{
unsigned int max_segments = min(BIO_MAX_VECS, lim->max_segments);
unsigned int length;
length = min(max_segments, 2) * lim->logical_block_size;
if (max_segments > 2)
length += (max_segments - 2) * min(PAGE_SIZE, lim->max_segment_size);
return length;
}
Note that blk_queue_max_guaranteed_bio() is only really relevant to dio, so
assumes that the iov_iter follows the bdev dio rules
It can't work because ITER_UBUF from pwritev2(iovcnt=1) is virtually-contiguous,
Right
and the middle segment size has to be PAGE_SIZE.
I would have thought that those PAGE_SIZE-sized middle iovecs should be
split into multiple segments, no?
Thanks,
John