From 68bb3995aa37e171c92526fa04befe55f5074eec Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Wed, 10 Apr 2019 22:09:28 -0400 Subject: [PATCH] nvmf: trivial optimization to make the code more consistent Make the use of spdk_uuid_compare() to be consistent in the file, also change the SPDK_INFOLOG to SPDK_DEBUGLOG to avoid the repeated log messages for RESERVATION CONFLICT response. Change-Id: I72fefbd520cefcaf25182c3ca3d21e3d87d17e94 Signed-off-by: Changpeng Liu Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450884 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker --- lib/nvmf/ctrlr.c | 3 ++- lib/nvmf/subsystem.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/nvmf/ctrlr.c b/lib/nvmf/ctrlr.c index abd9f8e0c..1f1d4d82e 100644 --- a/lib/nvmf/ctrlr.c +++ b/lib/nvmf/ctrlr.c @@ -2383,7 +2383,8 @@ spdk_nvmf_ctrlr_process_io_cmd(struct spdk_nvmf_request *req) ns_info = &group->sgroups[ctrlr->subsys->id].ns_info[nsid - 1]; if (nvmf_ns_reservation_request_check(ns_info, ctrlr, req)) { - SPDK_NOTICELOG("Reservation Conflict for nsid %u, opcode %u\n", cmd->nsid, cmd->opc); + SPDK_DEBUGLOG(SPDK_LOG_NVMF, "Reservation Conflict for nsid %u, opcode %u\n", + cmd->nsid, cmd->opc); return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE; } diff --git a/lib/nvmf/subsystem.c b/lib/nvmf/subsystem.c index 15ca25db9..8d8c94bf7 100644 --- a/lib/nvmf/subsystem.c +++ b/lib/nvmf/subsystem.c @@ -1295,7 +1295,7 @@ nvmf_ns_reservation_get_registrant(struct spdk_nvmf_ns *ns, struct spdk_nvmf_registrant *reg, *tmp; TAILQ_FOREACH_SAFE(reg, &ns->registrants, link, tmp) { - if (spdk_uuid_compare(®->hostid, uuid) == 0) { + if (!spdk_uuid_compare(®->hostid, uuid)) { return reg; } }