[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<DU2PR04MB85671D007A045527195EC5F9ED98A@DU2PR04MB8567.eurprd04.prod.outlook.com>
Date: Wed, 4 Feb 2026 02:28:52 +0000
From: Luke Wang <ziniu.wang_1@....com>
To: Ulf Hansson <ulf.hansson@...aro.org>
CC: "axboe@...nel.dk" <axboe@...nel.dk>, "hch@...radead.org"
<hch@...radead.org>, "linux-block@...r.kernel.org"
<linux-block@...r.kernel.org>, "linux-mmc@...r.kernel.org"
<linux-mmc@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>
Subject: RE: [EXT] Re: [PATCH v3 1/2] block: decouple secure erase size limit
from discard size limit
> -----Original Message-----
> From: Ulf Hansson <ulf.hansson@...aro.org>
> Sent: Tuesday, February 3, 2026 7:55 PM
> To: Luke Wang <ziniu.wang_1@....com>
> Cc: axboe@...nel.dk; hch@...radead.org; linux-block@...r.kernel.org; linux-
> mmc@...r.kernel.org; linux-kernel@...r.kernel.org; imx@...ts.linux.dev
> Subject: [EXT] Re: [PATCH v3 1/2] block: decouple secure erase size limit from
> discard size limit
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report this
> email' button
>
>
> On Tue, 3 Feb 2026 at 11:27, <ziniu.wang_1@....com> wrote:
> >
> > From: Luke Wang <ziniu.wang_1@....com>
> >
> > Secure erase should use max_secure_erase_sectors instead of being limited
> > by max_discard_sectors. Separate the handling of REQ_OP_SECURE_ERASE
> from
> > REQ_OP_DISCARD to allow each operation to use its own size limit.
>
> I don't know this code well enough, but is this change really sufficient?
>
> Don't we need to adjust blk_queue_get_max_sectors() as well?
Oh, I focus on the helper function and forget to adjust blk_queue_get_max_sectors()
I will add this change back.
Thanks
Luke
>
> Kind regards
> Uffe
>
> >
> > Signed-off-by: Luke Wang <ziniu.wang_1@....com>
> > ---
> > block/blk-merge.c | 21 +++++++++++++++++----
> > 1 file changed, 17 insertions(+), 4 deletions(-)
> >
> > diff --git a/block/blk-merge.c b/block/blk-merge.c
> > index 0eb0aef97197..fcf09325b22e 100644
> > --- a/block/blk-merge.c
> > +++ b/block/blk-merge.c
> > @@ -158,8 +158,9 @@ static struct bio *bio_submit_split(struct bio *bio, int
> split_sectors)
> > return bio;
> > }
> >
> > -struct bio *bio_split_discard(struct bio *bio, const struct queue_limits *lim,
> > - unsigned *nsegs)
> > +static struct bio *__bio_split_discard(struct bio *bio,
> > + const struct queue_limits *lim, unsigned *nsegs,
> > + unsigned int max_sectors)
> > {
> > unsigned int max_discard_sectors, granularity;
> > sector_t tmp;
> > @@ -169,8 +170,7 @@ 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));
> > + max_discard_sectors = min(max_sectors,
> bio_allowed_max_sectors(lim));
> > max_discard_sectors -= max_discard_sectors % granularity;
> > if (unlikely(!max_discard_sectors))
> > return bio;
> > @@ -194,6 +194,19 @@ struct bio *bio_split_discard(struct bio *bio, const
> struct queue_limits *lim,
> > return bio_submit_split(bio, split_sectors);
> > }
> >
> > +struct bio *bio_split_discard(struct bio *bio, const struct queue_limits *lim,
> > + unsigned *nsegs)
> > +{
> > + unsigned int max_sectors;
> > +
> > + if (bio_op(bio) == REQ_OP_SECURE_ERASE)
> > + max_sectors = lim->max_secure_erase_sectors;
> > + else
> > + max_sectors = lim->max_discard_sectors;
> > +
> > + return __bio_split_discard(bio, lim, nsegs, max_sectors);
> > +}
> > +
> > static inline unsigned int blk_boundary_sectors(const struct queue_limits
> *lim,
> > bool is_atomic)
> > {
> > --
> > 2.34.1
> >
Powered by blists - more mailing lists