bdev/nvme: Rename ch by nvme_ch of create_cb() and destroy_cb()

This change will make the next patch smaller and its review easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2784fa74dce98676958180bbf80a9a4f938454db
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5101
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Shuhei Matsumoto 2020-11-13 20:59:40 +09:00 committed by Tomasz Zawadzki
parent 012bd3b942
commit 0768aa10e3

View File

@ -754,7 +754,7 @@ static int
bdev_nvme_create_cb(void *io_device, void *ctx_buf) bdev_nvme_create_cb(void *io_device, void *ctx_buf)
{ {
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = io_device; struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = io_device;
struct nvme_io_channel *ch = ctx_buf; struct nvme_io_channel *nvme_ch = ctx_buf;
struct spdk_nvme_io_qpair_opts opts; struct spdk_nvme_io_qpair_opts opts;
struct spdk_io_channel *pg_ch = NULL; struct spdk_io_channel *pg_ch = NULL;
int rc; int rc;
@ -765,14 +765,14 @@ bdev_nvme_create_cb(void *io_device, void *ctx_buf)
opts.create_only = true; opts.create_only = true;
g_opts.io_queue_requests = opts.io_queue_requests; g_opts.io_queue_requests = opts.io_queue_requests;
ch->qpair = spdk_nvme_ctrlr_alloc_io_qpair(nvme_bdev_ctrlr->ctrlr, &opts, sizeof(opts)); nvme_ch->qpair = spdk_nvme_ctrlr_alloc_io_qpair(nvme_bdev_ctrlr->ctrlr, &opts, sizeof(opts));
if (ch->qpair == NULL) { if (nvme_ch->qpair == NULL) {
return -1; return -1;
} }
if (spdk_nvme_ctrlr_is_ocssd_supported(nvme_bdev_ctrlr->ctrlr)) { if (spdk_nvme_ctrlr_is_ocssd_supported(nvme_bdev_ctrlr->ctrlr)) {
if (bdev_ocssd_create_io_channel(ch)) { if (bdev_ocssd_create_io_channel(nvme_ch)) {
goto err; goto err;
} }
} }
@ -782,31 +782,31 @@ bdev_nvme_create_cb(void *io_device, void *ctx_buf)
goto err; goto err;
} }
ch->group = spdk_io_channel_get_ctx(pg_ch); nvme_ch->group = spdk_io_channel_get_ctx(pg_ch);
if (spdk_nvme_poll_group_add(ch->group->group, ch->qpair) != 0) { if (spdk_nvme_poll_group_add(nvme_ch->group->group, nvme_ch->qpair) != 0) {
goto err; goto err;
} }
rc = spdk_nvme_ctrlr_connect_io_qpair(nvme_bdev_ctrlr->ctrlr, ch->qpair); rc = spdk_nvme_ctrlr_connect_io_qpair(nvme_bdev_ctrlr->ctrlr, nvme_ch->qpair);
if (rc) { if (rc) {
spdk_nvme_poll_group_remove(ch->group->group, ch->qpair); spdk_nvme_poll_group_remove(nvme_ch->group->group, nvme_ch->qpair);
goto err; goto err;
} }
#ifdef SPDK_CONFIG_VTUNE #ifdef SPDK_CONFIG_VTUNE
ch->group->collect_spin_stat = true; nvme_ch->group->collect_spin_stat = true;
#else #else
ch->group->collect_spin_stat = false; nvme_ch->group->collect_spin_stat = false;
#endif #endif
TAILQ_INIT(&ch->pending_resets); TAILQ_INIT(&nvme_ch->pending_resets);
return 0; return 0;
err: err:
if (pg_ch) { if (pg_ch) {
spdk_put_io_channel(pg_ch); spdk_put_io_channel(pg_ch);
} }
spdk_nvme_ctrlr_free_io_qpair(ch->qpair); spdk_nvme_ctrlr_free_io_qpair(nvme_ch->qpair);
return -1; return -1;
} }
@ -814,22 +814,22 @@ static void
bdev_nvme_destroy_cb(void *io_device, void *ctx_buf) bdev_nvme_destroy_cb(void *io_device, void *ctx_buf)
{ {
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = io_device; struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = io_device;
struct nvme_io_channel *ch = ctx_buf; struct nvme_io_channel *nvme_ch = ctx_buf;
struct nvme_bdev_poll_group *group; struct nvme_bdev_poll_group *group;
group = ch->group; group = nvme_ch->group;
assert(group != NULL); assert(group != NULL);
if (spdk_nvme_ctrlr_is_ocssd_supported(nvme_bdev_ctrlr->ctrlr)) { if (spdk_nvme_ctrlr_is_ocssd_supported(nvme_bdev_ctrlr->ctrlr)) {
bdev_ocssd_destroy_io_channel(ch); bdev_ocssd_destroy_io_channel(nvme_ch);
} }
if (ch->qpair != NULL) { if (nvme_ch->qpair != NULL) {
spdk_nvme_poll_group_remove(group->group, ch->qpair); spdk_nvme_poll_group_remove(group->group, nvme_ch->qpair);
} }
spdk_put_io_channel(spdk_io_channel_from_ctx(group)); spdk_put_io_channel(spdk_io_channel_from_ctx(group));
spdk_nvme_ctrlr_free_io_qpair(ch->qpair); spdk_nvme_ctrlr_free_io_qpair(nvme_ch->qpair);
} }
static int static int