On 13/02/2025 09:58, Ming Lei wrote:
On Thu, Feb 13, 2025 at 08:45:18AM +0000, John Garry wrote:
On 10/02/2025 09:03, Ming Lei wrote:
PAGE_SIZE is applied in some block device queue limits, this way is
very fragile and is wrong:
- queue limits are read from hardware, which is often one readonly
hardware property
- PAGE_SIZE is one config option which can be changed during build time.
In RH lab, it has been found that max segment size of some mmc card is
less than 64K, then this kind of card can't work in case of 64K PAGE_SIZE.
Fix this issue by using BLK_MIN_SEGMENT_SIZE in related code for dealing
with queue limits and checking if bio needn't split. Define BLK_MIN_SEGMENT_SIZE
as 4K(minimized PAGE_SIZE).
Please note that blk_queue_max_quaranteed_bio() for atomic writes assumes
that we can fit a PAGE_SIZE in a segment. I suppose that if the
max_segment_size < PAGE_SIZE is supported, then the calculation there needs
to change.
It isn't related with blk_queue_max_guaranteed_bio() which calculates the max
allowed ubuf bytes which can fit in a bio, so PAGE_SIZE has to be used here.
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?
Thanks,
John