bdev_nvme: allow bio to be null in resets.
Also, add a small callback function to display an error when reset fails. Change-Id: I74c9e9f6842cbd3b608eae2178bd3605cd642fbd Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473741 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
0cdf3f5189
commit
5ad0db1cf2
@ -280,16 +280,30 @@ bdev_nvme_flush(struct nvme_bdev *nbdev, struct nvme_bdev_io *bio,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_bdev_nvme_reset_complete(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, int rc)
|
||||
{
|
||||
if (rc) {
|
||||
SPDK_ERRLOG("Resetting controller failed.\n");
|
||||
} else {
|
||||
SPDK_NOTICELOG("Resetting controller successful.\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_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);
|
||||
void *ctx = spdk_io_channel_iter_get_ctx(i);
|
||||
int rc = SPDK_BDEV_IO_STATUS_SUCCESS;
|
||||
|
||||
if (status) {
|
||||
rc = SPDK_BDEV_IO_STATUS_FAILED;
|
||||
}
|
||||
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(ctx), rc);
|
||||
if (ctx) {
|
||||
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(ctx), rc);
|
||||
}
|
||||
_bdev_nvme_reset_complete(nvme_bdev_ctrlr, status);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -320,13 +334,19 @@ _bdev_nvme_reset(struct spdk_io_channel_iter *i, int status)
|
||||
int rc;
|
||||
|
||||
if (status) {
|
||||
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(bio), SPDK_BDEV_IO_STATUS_FAILED);
|
||||
if (bio) {
|
||||
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(bio), SPDK_BDEV_IO_STATUS_FAILED);
|
||||
}
|
||||
_bdev_nvme_reset_complete(nvme_bdev_ctrlr, status);
|
||||
return;
|
||||
}
|
||||
|
||||
rc = spdk_nvme_ctrlr_reset(nvme_bdev_ctrlr->ctrlr);
|
||||
if (rc != 0) {
|
||||
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(bio), SPDK_BDEV_IO_STATUS_FAILED);
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user