OSDN Git Service

nvme: use an xarray to lookup the Commands Supported and Effects log
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Tue, 22 Sep 2020 21:05:29 +0000 (14:05 -0700)
committerChristoph Hellwig <hch@lst.de>
Sun, 27 Sep 2020 07:14:18 +0000 (09:14 +0200)
commit1cf7a12e09aa48512404bf3f0f429b73182ce793
treee10d72b76baadf6dba04d74b4c1c833f06fd1360
parentb2702aaaa45c2d1028bc8c51b49106041be7aae5
nvme: use an xarray to lookup the Commands Supported and Effects log

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@wdc.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c
drivers/nvme/host/nvme.h