bdev/nvme: Factor out the internal of _bdev_nvme_check_pending_destruct()

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I27d7e81fe0ecc35b374277c8e40233db2a3ed914
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7273
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Shuhei Matsumoto 2021-05-11 07:31:47 +09:00 committed by Tomasz Zawadzki
parent a0ea252399
commit 9391bc33a7

View File

@ -430,10 +430,8 @@ bdev_nvme_destroy_qpair(struct nvme_io_channel *nvme_ch)
}
static void
_bdev_nvme_check_pending_destruct(struct spdk_io_channel_iter *i, int status)
_bdev_nvme_check_pending_destruct(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
{
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = spdk_io_channel_iter_get_ctx(i);
pthread_mutex_lock(&nvme_bdev_ctrlr->mutex);
if (nvme_bdev_ctrlr->destruct_after_reset) {
assert(nvme_bdev_ctrlr->ref == 0 && nvme_bdev_ctrlr->destruct);
@ -446,6 +444,14 @@ _bdev_nvme_check_pending_destruct(struct spdk_io_channel_iter *i, int status)
}
}
static void
bdev_nvme_check_pending_destruct(struct spdk_io_channel_iter *i, int status)
{
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = spdk_io_channel_iter_get_ctx(i);
_bdev_nvme_check_pending_destruct(nvme_bdev_ctrlr);
}
static void
_bdev_nvme_complete_pending_resets(struct nvme_io_channel *nvme_ch,
enum spdk_bdev_io_status status)
@ -498,7 +504,7 @@ bdev_nvme_reset_io_complete(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
rc == 0 ? bdev_nvme_complete_pending_resets :
bdev_nvme_abort_pending_resets,
nvme_bdev_ctrlr,
_bdev_nvme_check_pending_destruct);
bdev_nvme_check_pending_destruct);
}
static void
@ -540,7 +546,7 @@ _bdev_nvme_reset_complete(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, int rc)
rc == 0 ? bdev_nvme_complete_pending_resets :
bdev_nvme_abort_pending_resets,
nvme_bdev_ctrlr,
_bdev_nvme_check_pending_destruct);
bdev_nvme_check_pending_destruct);
}
}