[PATCHv5 1/2] block: accumulate memory segment gaps per bio

Yu Kuai yukuai at fnnas.com
Tue Nov 11 06:03:33 PST 2025


Hi,

在 2025/11/11 21:54, Keith Busch 写道:
> On Tue, Nov 11, 2025 at 02:40:01PM +0100, Christoph Hellwig wrote:
>> On Tue, Nov 11, 2025 at 08:25:38AM -0500, Keith Busch wrote:
>>> Ah, so we're merging a discard for a device that doesn't support
>>> vectored discard. I think we still want to be able to front/back merge
>>> such requests, though.
>> Yes, but purely based on bi_sector/bi_size, not based on the payload.
> This should do it:
>
> ---
> diff --git a/block/blk-merge.c b/block/blk-merge.c
> index 3ca6fbf8b7870..d3115d7469df0 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -737,6 +737,9 @@ u8 bio_seg_gap(struct request_queue *q, struct bio *prev, struct bio *next,
>   {
>   	struct bio_vec pb, nb;
>   
> +	if (!bio_has_data(prev))
> +		return 0;
> +
>   	gaps_bit = min_not_zero(gaps_bit, prev->bi_bvec_gap_bit);
>   	gaps_bit = min_not_zero(gaps_bit, next->bi_bvec_gap_bit);
>   
> --

This looks good.

Thanks,
Kuai



More information about the Linux-nvme mailing list