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 <shuhei.matsumoto.xt@hitachi.com>
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 <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Shuhei Matsumoto 2021-05-12 16:22:58 +09:00 committed by Tomasz Zawadzki
parent 9391bc33a7
commit 9e1c13c5f1

View File

@ -1418,6 +1418,17 @@ nvme_bdev_create(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, struct nvme_bdev_ns *n
return 0; 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 static void
nvme_ctrlr_populate_standard_namespace(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, nvme_ctrlr_populate_standard_namespace(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
struct nvme_bdev_ns *nvme_ns, struct nvme_async_probe_ctx *ctx) 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; 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 static int
bdev_nvme_compare_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, bdev_nvme_compare_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
struct spdk_nvme_ctrlr *new_ctrlr) struct spdk_nvme_ctrlr *new_ctrlr)