bdev/nvme: Factor out destroy qpair operation into a helper function
Factor out the operation to destroy qpair into a helper function bdev_nvme_destroy_qpair(). Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I5ac9215407e0b4f4368a68bc58d8e3daac029393 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6783 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
444677f3b4
commit
90f434b9a0
@ -378,6 +378,22 @@ err:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
bdev_nvme_destroy_qpair(struct nvme_io_channel *nvme_ch)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (nvme_ch->qpair == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = spdk_nvme_ctrlr_free_io_qpair(nvme_ch->qpair);
|
||||
if (!rc) {
|
||||
nvme_ch->qpair = NULL;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
_bdev_nvme_check_pending_destruct(struct spdk_io_channel_iter *i, int status)
|
||||
{
|
||||
@ -534,10 +550,7 @@ _bdev_nvme_reset_destroy_qpair(struct spdk_io_channel_iter *i)
|
||||
struct nvme_io_channel *nvme_ch = spdk_io_channel_get_ctx(ch);
|
||||
int rc;
|
||||
|
||||
rc = spdk_nvme_ctrlr_free_io_qpair(nvme_ch->qpair);
|
||||
if (!rc) {
|
||||
nvme_ch->qpair = NULL;
|
||||
}
|
||||
rc = bdev_nvme_destroy_qpair(nvme_ch);
|
||||
|
||||
spdk_for_each_channel_continue(i, rc);
|
||||
}
|
||||
@ -1038,9 +1051,7 @@ bdev_nvme_destroy_cb(void *io_device, void *ctx_buf)
|
||||
bdev_ocssd_destroy_io_channel(nvme_ch);
|
||||
}
|
||||
|
||||
if (nvme_ch->qpair != NULL) {
|
||||
spdk_nvme_ctrlr_free_io_qpair(nvme_ch->qpair);
|
||||
}
|
||||
bdev_nvme_destroy_qpair(nvme_ch);
|
||||
|
||||
spdk_put_io_channel(spdk_io_channel_from_ctx(nvme_ch->group));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user