All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	Uday Shankar <ushankar@purestorage.com>,
	Alexander Atanasov <alex@zazolabs.com>,
	Yoav Cohen <yoav@nvidia.com>
Subject: Re: [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag
Date: Thu, 29 Jan 2026 16:21:46 +0800	[thread overview]
Message-ID: <aXsYmhdCLBSN704-@fedora> (raw)
In-Reply-To: <CADUfDZoYtEjVjqQDnHXQynZUp3NJv+bgWuFJuvOUS_hJcOy3qg@mail.gmail.com>

On Wed, Jan 28, 2026 at 08:44:58PM -0800, Caleb Sander Mateos wrote:
> On Wed, Jan 28, 2026 at 7:15 PM Ming Lei <ming.lei@redhat.com> wrote:
> >
> > Add a new feature flag UBLK_F_NO_AUTO_PART_SCAN to allow users to suppress
> > automatic partition scanning when starting a ublk device.
> >
> > This is useful for some cases in which use don't want to scan
> > partitions.
> >
> > Users still can manually trigger partition scanning later when appropriate
> > using standard tools (e.g., partprobe, blockdev --rereadpt).
> >
> > Reported-by: Yoav Cohen <yoav@nvidia.com>
> > Link: https://lore.kernel.org/linux-block/DM4PR12MB63280C5637917C071C2F0D65A9A8A@DM4PR12MB6328.namprd12.prod.outlook.com/
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > ---
> >  drivers/block/ublk_drv.c      | 7 ++++++-
> >  include/uapi/linux/ublk_cmd.h | 3 +++
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> > index 94470a2ec05e..0b98ab0f8257 100644
> > --- a/drivers/block/ublk_drv.c
> > +++ b/drivers/block/ublk_drv.c
> > @@ -80,7 +80,8 @@
> >                 | UBLK_F_BUF_REG_OFF_DAEMON \
> >                 | (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) ? UBLK_F_INTEGRITY : 0) \
> >                 | UBLK_F_SAFE_STOP_DEV \
> > -               | UBLK_F_BATCH_IO)
> > +               | UBLK_F_BATCH_IO \
> > +               | UBLK_F_NO_AUTO_PART_SCAN)
> >
> >  #define UBLK_F_ALL_RECOVERY_FLAGS (UBLK_F_USER_RECOVERY \
> >                 | UBLK_F_USER_RECOVERY_REISSUE \
> > @@ -2364,6 +2365,10 @@ static void ublk_partition_scan_work(struct work_struct *work)
> >                                              &disk->state)))
> >                 goto out;
> >
> > +       /* Skip partition scan if disabled by user */
> > +       if (ub->dev_info.flags & UBLK_F_NO_AUTO_PART_SCAN)
> > +               goto out;
> 
> Seems like it's not necessary to schedule ublk_partition_scan_work()
> in this case? Could just clear_bit(GD_SUPPRESS_PART_SCAN,
> &disk->state) in ublk_ctrl_start_dev()?

OK, we can do it by saving one time of wq schedule.

> Is it actually necessary to clear GD_SUPPRESS_PART_SCAN at all? Does
> that flag block partprobe too?

Yes, the flag is totally controlled by user side.


Thanks, 
Ming


  reply	other threads:[~2026-01-29  8:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29  3:14 [PATCH 0/5] ublk: misc improvement in driver and selftests Ming Lei
2026-01-29  3:14 ` [PATCH 1/5] ublk: check list membership before cancelling batch fetch command Ming Lei
2026-01-29  3:14 ` [PATCH 2/5] ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag Ming Lei
2026-01-29  4:44   ` Caleb Sander Mateos
2026-01-29  8:21     ` Ming Lei [this message]
2026-01-29  5:45   ` Alexander Atanasov
2026-01-29  3:14 ` [PATCH 3/5] selftests: ublk: derive TID automatically from script name Ming Lei
2026-01-29  4:46   ` Caleb Sander Mateos
2026-01-29  9:50   ` Alexander Atanasov
2026-01-29 11:45     ` Ming Lei
2026-01-29  3:14 ` [PATCH 4/5] selftests: ublk: mark each test start and end time in dmesg Ming Lei
2026-01-29  3:14 ` [PATCH 5/5] selftests: ublk: add selftest for UBLK_F_NO_AUTO_PART_SCAN Ming Lei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aXsYmhdCLBSN704-@fedora \
    --to=ming.lei@redhat.com \
    --cc=alex@zazolabs.com \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ushankar@purestorage.com \
    --cc=yoav@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.