[PATCH] nvme-core: use xarray for cel storing

Keith Busch kbusch at kernel.org
Wed Sep 23 11:18:16 EDT 2020


On Tue, Sep 22, 2020 at 02:05:29PM -0700, Chaitanya Kulkarni wrote:
> When using linked list we have to open code the locking, search, and
> destroy operations with the loops even if data structure doesn't fall
> into the fast path.
> 
> One of the main advantage of having XArray to store, search, and remove
> items is that it handles all the locking by itself, avoids the loops 
> when using linked lists, provides clear API to replace the linked list's
> search and destroy loops. 
> 
> This patch replaces the ctrl->cel list with XArray and removes :-
> 
> a. Extra code needed for the linked list for ctrl->cel item management
>    such as nvme_find_cel().
> b. Destroy loop in the nvme_free_ctrl().
> c. Explicit insertion locking in the nvme_get_effects_log().
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
> ---
>  drivers/nvme/host/core.c | 31 ++++---------------------------
>  drivers/nvme/host/nvme.h |  2 +-
>  2 files changed, 5 insertions(+), 28 deletions(-)

That's some good looking change stats.

And removing the overloaded use for ctrl->lock will help avoid potential
coding errors in future patches.

So, this looks fine to me.

Reviewed-by: Keith Busch <kbusch at kernel.org>



More information about the Linux-nvme mailing list