Re: [PATCH V2] block: make segment size limit workable for > 4K PAGE_SIZE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13/02/2025 10:35, Ming Lei wrote:
BLK_MIN_SEGMENT_SIZE is just one hint which can be used to check if one
bvec can fit in single segment quickly, otherwise the normal split code
path is run into.
So consider we have PAGE_SIZE > 4k and max_segment_size=4k, if an iovec has
PAGE_SIZE then a bvec can also have PAGE_SIZE but then we need to split into
multiple segments, right?
Yes, hardware limit needs to be respected.

Looks one write atomic application trouble in case of 64K page size,
and it can't work w/wo this patchset.

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

Thanks,
John




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux