From 42bb8ae84291a4da83ea48b24da71c8a9e6a517a Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 3 Dec 2021 22:02:28 +0000 Subject: [PATCH] nvmf: don't update discovery log on subsystem create/delete The discovery log isn't updated when a subsystem is created or deleted, it's only updated when a listener for a subsystem is added or removed. So remove the nvmf_update_discovery_log() in the subsystem create and delete paths. They just generate extra AER completions that potentially cause the host to do unneeded work. Note that if a subsystem is deleted with active listeners, the subsystem delete path will remove each of the listeners before deleting the subsystem itself. So the discovery log will still get updated when those listeners are removed. Signed-off-by: Jim Harris Change-Id: Id01bbfa3b24d3e1279a614a2fd60be41387a03b1 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10545 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Dong Yi Reviewed-by: Jacek Kalwas Reviewed-by: Aleksey Marchuk --- lib/nvmf/subsystem.c | 2 -- test/unit/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/nvmf/subsystem.c b/lib/nvmf/subsystem.c index 621566a25..668c7664e 100644 --- a/lib/nvmf/subsystem.c +++ b/lib/nvmf/subsystem.c @@ -323,7 +323,6 @@ spdk_nvmf_subsystem_create(struct spdk_nvmf_tgt *tgt, MODEL_NUMBER_DEFAULT); tgt->subsystems[sid] = subsystem; - nvmf_update_discovery_log(tgt, NULL); return subsystem; } @@ -403,7 +402,6 @@ _nvmf_subsystem_destroy(struct spdk_nvmf_subsystem *subsystem) free(subsystem->ana_group); subsystem->tgt->subsystems[subsystem->id] = NULL; - nvmf_update_discovery_log(subsystem->tgt, NULL); pthread_mutex_destroy(&subsystem->mutex); diff --git a/test/unit/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut.c b/test/unit/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut.c index 095bc0943..fb29e1917 100644 --- a/test/unit/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut.c +++ b/test/unit/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut.c @@ -324,14 +324,14 @@ test_discovery_log(void) disc_log = (struct spdk_nvmf_discovery_log_page *)buffer; nvmf_get_discovery_log_page(&tgt, "nqn.2016-06.io.spdk:host1", &iov, 1, 0, sizeof(disc_log->genctr), &trid); - CU_ASSERT(disc_log->genctr == 2); /* one added subsystem and listener */ + CU_ASSERT(disc_log->genctr == 1); /* one added subsystem and listener */ /* Get only the header, no entries */ memset(buffer, 0xCC, sizeof(buffer)); disc_log = (struct spdk_nvmf_discovery_log_page *)buffer; nvmf_get_discovery_log_page(&tgt, "nqn.2016-06.io.spdk:host1", &iov, 1, 0, sizeof(*disc_log), &trid); - CU_ASSERT(disc_log->genctr == 2); + CU_ASSERT(disc_log->genctr == 1); CU_ASSERT(disc_log->numrec == 1); /* Offset 0, exact size match */