bdev/nvme: Consolidate error paths of _bdev_nvme_reset_create_qpairs_done()
Clarify the operation done in the error paths for readability. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Icb8a1a7c569e88d474737d0449c8eef73759a633 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4989 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
4e8f5d39ec
commit
460bd99a28
@ -405,14 +405,14 @@ static void
|
|||||||
_bdev_nvme_reset_create_qpairs_done(struct spdk_io_channel_iter *i, int status)
|
_bdev_nvme_reset_create_qpairs_done(struct spdk_io_channel_iter *i, int status)
|
||||||
{
|
{
|
||||||
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = spdk_io_channel_iter_get_io_device(i);
|
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = spdk_io_channel_iter_get_io_device(i);
|
||||||
void *ctx = spdk_io_channel_iter_get_ctx(i);
|
struct nvme_bdev_io *bio = spdk_io_channel_iter_get_ctx(i);
|
||||||
int rc = SPDK_BDEV_IO_STATUS_SUCCESS;
|
int rc = SPDK_BDEV_IO_STATUS_SUCCESS;
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
rc = SPDK_BDEV_IO_STATUS_FAILED;
|
rc = SPDK_BDEV_IO_STATUS_FAILED;
|
||||||
}
|
}
|
||||||
if (ctx) {
|
if (bio) {
|
||||||
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(ctx), rc);
|
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(bio), rc);
|
||||||
}
|
}
|
||||||
_bdev_nvme_reset_complete(nvme_bdev_ctrlr, status);
|
_bdev_nvme_reset_complete(nvme_bdev_ctrlr, status);
|
||||||
}
|
}
|
||||||
@ -438,20 +438,13 @@ _bdev_nvme_reset(struct spdk_io_channel_iter *i, int status)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
if (bio) {
|
rc = status;
|
||||||
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(bio), SPDK_BDEV_IO_STATUS_FAILED);
|
goto err;
|
||||||
}
|
|
||||||
_bdev_nvme_reset_complete(nvme_bdev_ctrlr, status);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = spdk_nvme_ctrlr_reset(nvme_bdev_ctrlr->ctrlr);
|
rc = spdk_nvme_ctrlr_reset(nvme_bdev_ctrlr->ctrlr);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
if (bio) {
|
goto err;
|
||||||
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(bio), SPDK_BDEV_IO_STATUS_FAILED);
|
|
||||||
}
|
|
||||||
_bdev_nvme_reset_complete(nvme_bdev_ctrlr, rc);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recreate all of the I/O queue pairs */
|
/* Recreate all of the I/O queue pairs */
|
||||||
@ -459,6 +452,13 @@ _bdev_nvme_reset(struct spdk_io_channel_iter *i, int status)
|
|||||||
_bdev_nvme_reset_create_qpair,
|
_bdev_nvme_reset_create_qpair,
|
||||||
bio,
|
bio,
|
||||||
_bdev_nvme_reset_create_qpairs_done);
|
_bdev_nvme_reset_create_qpairs_done);
|
||||||
|
return;
|
||||||
|
|
||||||
|
err:
|
||||||
|
if (bio) {
|
||||||
|
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(bio), SPDK_BDEV_IO_STATUS_FAILED);
|
||||||
|
}
|
||||||
|
_bdev_nvme_reset_complete(nvme_bdev_ctrlr, rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user