Re: [PATCH v2 1/2] block: decouple secure erase size limit from discard size limit

From: Christoph Hellwig

Date: Mon Dec 15 2025 - 10:43:13 EST


> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -169,8 +169,13 @@ struct bio *bio_split_discard(struct bio *bio, const struct queue_limits *lim,
>
> granularity = max(lim->discard_granularity >> 9, 1U);
>
> - max_discard_sectors =
> - min(lim->max_discard_sectors, bio_allowed_max_sectors(lim));
> + if (bio_op(bio) == REQ_OP_SECURE_ERASE)
> + max_discard_sectors = min(lim->max_secure_erase_sectors,
> + bio_allowed_max_sectors(lim));
> + else
> + max_discard_sectors = min(lim->max_discard_sectors,
> + bio_allowed_max_sectors(lim));

Please factor our a low-level helper and pass the max_sectors
as argument.