From b96c0b270704330b23373acae83de093f6c91ce3 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Sun, 11 Apr 2021 02:50:50 +0900 Subject: [PATCH] ut/bdev_nvme: Populate namespaces by default when attaching ctrlr Previously when attaching a ctrlr, all namespaces had not been populated. Hence we had to populate each namespace manually. It is more normal if all namespaces are populated when attaching the corresponding ctrlr. This patch does such change. Signed-off-by: Shuhei Matsumoto Change-Id: I55d9c444c492ba6e44a609eac81b1ef25a7190a8 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7313 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Changpeng Liu Reviewed-by: Reviewed-by: Aleksey Marchuk --- test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c b/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c index 98448808b..ddd64077c 100644 --- a/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c +++ b/test/unit/lib/bdev/nvme/bdev_nvme.c/bdev_nvme_ut.c @@ -388,6 +388,8 @@ ut_attach_ctrlr(const struct spdk_nvme_transport_id *trid, uint32_t num_ns) for (i = 0; i < num_ns; i++) { ctrlr->ns[i].id = i + 1; ctrlr->ns[i].ctrlr = ctrlr; + ctrlr->ns[i].is_active = true; + ctrlr->nsdata[i].nsze = 1024; } } @@ -1501,7 +1503,6 @@ test_attach_ctrlr(void) ctrlr = ut_attach_ctrlr(&trid, 1); SPDK_CU_ASSERT_FATAL(ctrlr != NULL); - ctrlr->ns[0].is_active = true; g_ut_attach_bdev_count = 1; rc = bdev_nvme_create(&trid, &hostid, "nvme0", attached_names, 32, NULL, 0, @@ -1536,7 +1537,6 @@ test_attach_ctrlr(void) ctrlr = ut_attach_ctrlr(&trid, 1); SPDK_CU_ASSERT_FATAL(ctrlr != NULL); - ctrlr->ns[0].is_active = true; g_ut_register_bdev_status = -EINVAL; g_ut_attach_bdev_count = 0; @@ -1643,11 +1643,7 @@ test_aer_cb(void) ctrlr = ut_attach_ctrlr(&trid, 4); SPDK_CU_ASSERT_FATAL(ctrlr != NULL); - ctrlr->ns[1].is_active = true; - ctrlr->ns[2].is_active = true; - ctrlr->ns[3].is_active = true; - - ctrlr->nsdata[3].nsze = 1024; + ctrlr->ns[0].is_active = false; g_ut_attach_ctrlr_status = 0; g_ut_attach_bdev_count = 3; @@ -1825,7 +1821,6 @@ test_submit_nvme_cmd(void) ctrlr = ut_attach_ctrlr(&trid, 1); SPDK_CU_ASSERT_FATAL(ctrlr != NULL); - ctrlr->ns[0].is_active = true; g_ut_attach_ctrlr_status = 0; g_ut_attach_bdev_count = 1; @@ -1990,7 +1985,6 @@ test_abort(void) ctrlr = ut_attach_ctrlr(&trid, 1); SPDK_CU_ASSERT_FATAL(ctrlr != NULL); - ctrlr->ns[0].is_active = true; g_ut_attach_ctrlr_status = 0; g_ut_attach_bdev_count = 1; @@ -2195,8 +2189,6 @@ test_bdev_unregister(void) ctrlr = ut_attach_ctrlr(&trid, 2); SPDK_CU_ASSERT_FATAL(ctrlr != NULL); - ctrlr->ns[0].is_active = true; - ctrlr->ns[1].is_active = true; g_ut_attach_ctrlr_status = 0; g_ut_attach_bdev_count = 2;