nvme: use the most appropriate is_active() function
There are two different is_active() functions. spdk_nvme_ctrlr_is_active_ns() which iterates through the active_ns_list, and spdk_nvme_ns_is_active(), which simply checks the nsdata. There is an event callback that refreshes active_ns_list when a relevant events has occured. In nvme_ns_construct(), nvme_ctrlr_identify_ns() has just been called, so we know that nsdata is as fresh as possible. Hence, there is no reason to iterate through a less fresh active_ns_list. Since we know that the nvme_ctrlr_identify_ns() call was done through the same controller, we also know that the active/inactive is from the perspective of the correct controller, so that is not a reason to use the less efficient is_active() function. Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> Change-Id: I185f59b53e16e70163e33a3909f4b55ebf631cc4 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4293 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
743271d92d
commit
726ac67c55
@ -413,7 +413,7 @@ int nvme_ns_construct(struct spdk_nvme_ns *ns, uint32_t id,
|
||||
}
|
||||
|
||||
/* skip Identify NS ID Descriptor List for inactive NS */
|
||||
if (!spdk_nvme_ctrlr_is_active_ns(ctrlr, id)) {
|
||||
if (!spdk_nvme_ns_is_active(ns)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,6 @@ DEFINE_STUB(nvme_wait_for_completion_robust_lock, int,
|
||||
struct nvme_completion_poll_status *status,
|
||||
pthread_mutex_t *robust_mutex), 0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_ctrlr_is_active_ns, bool,
|
||||
(struct spdk_nvme_ctrlr *ctrlr, uint32_t nsid), 1);
|
||||
|
||||
int
|
||||
nvme_ctrlr_cmd_identify(struct spdk_nvme_ctrlr *ctrlr, uint8_t cns, uint16_t cntid, uint32_t nsid,
|
||||
void *payload, size_t payload_size,
|
||||
|
Loading…
Reference in New Issue
Block a user