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 Mon, Feb 10, 2025 at 05:03:19PM +0800, Ming Lei wrote:
> PAGE_SIZE is applied in some block device queue limits, this way is
> very fragile and is wrong:

Can you rephrase this?  what is "some block device queue limits"?

>  	}
>  
> diff --git a/block/blk.h b/block/blk.h
> index 90fa5f28ccab..cbfa8a3d4e42 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -359,7 +359,7 @@ static inline bool bio_may_need_split(struct bio *bio,
>  		const struct queue_limits *lim)
>  {
>  	return lim->chunk_sectors || bio->bi_vcnt != 1 ||
> -		bio->bi_io_vec->bv_len + bio->bi_io_vec->bv_offset > PAGE_SIZE;
> +		bio->bi_io_vec->bv_len + bio->bi_io_vec->bv_offset > BLK_MIN_SEGMENT_SIZE;

please avoid the overly long line here.  And maybe split up the
condition to actually be readable?  I.e.

	if (lim->chunk_sectors)
		return true;
	if (bio->bi_vcnt != 1)
		return true;
	if (bio->bi_io_vec->bv_len + bio->bi_io_vec->bv_offset >
	    BLK_MIN_SEGMENT_SIZE)
		return true;
	return false;

> +	BLK_MIN_SEGMENT_SIZE	= 4096, /* min(PAGE_SIZE) */

That's a very sparse and cryptic comment.  Please write down an
actual explanation.





[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