Re: [PATCH v4] nvme_core: scan namespaces asynchronously

From: Keith Busch
Date: Thu Jul 18 2024 - 15:16:57 EST


On Wed, Jul 17, 2024 at 11:16:19PM +0200, Thomas Weißschuh wrote:
> On 2024-07-17 13:55:50+0000, Stuart Hayes wrote:
> > +static void nvme_scan_ns_async(void *data, async_cookie_t cookie)
> > +{
> > + struct async_scan_info *scan_info = data;
> > + int idx;
> > + u32 nsid;
> > +
> > + idx = (u32)atomic_fetch_add(1, &scan_info->next_nsid);
>
> atomic_fetch_inc() ?

Good call. Also, that returns an int, and 'idx' is an int too, so the
(u32) cast inbetween is unnecessary. The highest 'next_nsid' could
possibly be anyway is 1023, so int is fine.