From 9e1c13c5f107e6d672a30b688623576b3a095b1a Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 12 May 2021 16:22:58 +0900 Subject: [PATCH] bdev/nvme: Move bdev_nvme_compare_ns() up in a file bdev_nvme_compare_ns() will be used to check if all namespaces of one nvme_bdev are identical, and this is the convenient location. Signed-off-by: Shuhei Matsumoto Change-Id: I3fa6072c1cceec53268e53bf398fa1e8f069035e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7169 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Tomasz Zawadzki --- module/bdev/nvme/bdev_nvme.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 1576bb5c51..544209a280 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -1418,6 +1418,17 @@ nvme_bdev_create(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, struct nvme_bdev_ns *n return 0; } +static bool +bdev_nvme_compare_ns(struct spdk_nvme_ns *ns1, struct spdk_nvme_ns *ns2) +{ + const struct spdk_nvme_ns_data *nsdata1, *nsdata2; + + nsdata1 = spdk_nvme_ns_get_data(ns1); + nsdata2 = spdk_nvme_ns_get_data(ns2); + + return memcmp(nsdata1->nguid, nsdata2->nguid, sizeof(nsdata1->nguid)); +} + static void nvme_ctrlr_populate_standard_namespace(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, struct nvme_bdev_ns *nvme_ns, struct nvme_async_probe_ctx *ctx) @@ -2134,17 +2145,6 @@ bdev_nvme_compare_trids(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, return 0; } -static bool -bdev_nvme_compare_ns(struct spdk_nvme_ns *ns1, struct spdk_nvme_ns *ns2) -{ - const struct spdk_nvme_ns_data *nsdata1, *nsdata2; - - nsdata1 = spdk_nvme_ns_get_data(ns1); - nsdata2 = spdk_nvme_ns_get_data(ns2); - - return memcmp(nsdata1->nguid, nsdata2->nguid, sizeof(nsdata1->nguid)); -} - static int bdev_nvme_compare_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, struct spdk_nvme_ctrlr *new_ctrlr)