Re: [PATCH] nvme_core: scan namespaces asynchronously

From: Max Gurtovoy
Date: Sat Jan 06 2024 - 19:41:04 EST




On 04/01/2024 18:47, Keith Busch wrote:
On Thu, Jan 04, 2024 at 10:38:26AM -0600, Stuart Hayes wrote:
Currently NVME namespaces are scanned serially, so it can take a long time
for all of a controller's namespaces to become available, especially with a
slower (fabrics) interface with large number (~1000) of namespaces.

Use async function calls to make namespace scanning happen in parallel,
and add a (boolean) module parameter "async_ns_scan" to enable this.

Hm, we're not doing a whole lot of blocking IO to bring up a namespace,
so I'm a little surprised it makes a noticable difference. How much time
improvement are you observing by parallelizing the scan? Is there a
tipping point in Number of Namespaces where inline scanning is better
than asynchronous? And if it is a meaningful gain, let's not introduce
another module parameter to disable it.

I don't think it is a good idea since some of the namespace characteristics must be validated during re-connection time for example.
I actually prepared a patch that makes sure we sync the ns scanning before kicking the ns blk queue to avoid that situations.
for example, if for some reason ns1 change its uuid then we must remove it and open a new bdev instead. We can't kick old request to it...