bdev: add spdk_io_channel parameter to spdk_bdev_reset

This ensures that all spdk_bdev_io structures now have
an attached channel, simplifying some future work around
things like counting the number of outstanding IOs for
a given channel (which otherwise would have had to
account specially for resets).

Reset semantics are still that they affect the entire bdev
and not just the channel it was submitted on.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8aad21a88faacecfd94bdba350059528eb62c390

Reviewed-on: https://review.gerrithub.io/362251
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Jim Harris 2017-05-23 10:51:50 -07:00 committed by Daniel Verkamp
parent 1a2cd90c98
commit 2e3f07ac40
7 changed files with 13 additions and 7 deletions

View File

@ -232,8 +232,8 @@ struct spdk_bdev_io *spdk_bdev_flush(struct spdk_bdev *bdev, struct spdk_io_chan
uint64_t offset, uint64_t length,
spdk_bdev_io_completion_cb cb, void *cb_arg);
int spdk_bdev_free_io(struct spdk_bdev_io *bdev_io);
int spdk_bdev_reset(struct spdk_bdev *bdev, enum spdk_bdev_reset_type,
spdk_bdev_io_completion_cb cb, void *cb_arg);
int spdk_bdev_reset(struct spdk_bdev *bdev, struct spdk_io_channel *ch,
enum spdk_bdev_reset_type, spdk_bdev_io_completion_cb cb, void *cb_arg);
struct spdk_io_channel *spdk_bdev_get_io_channel(struct spdk_bdev *bdev, uint32_t priority);
/**

View File

@ -830,10 +830,12 @@ spdk_bdev_flush(struct spdk_bdev *bdev, struct spdk_io_channel *ch,
}
int
spdk_bdev_reset(struct spdk_bdev *bdev, enum spdk_bdev_reset_type reset_type,
spdk_bdev_reset(struct spdk_bdev *bdev, struct spdk_io_channel *ch,
enum spdk_bdev_reset_type reset_type,
spdk_bdev_io_completion_cb cb, void *cb_arg)
{
struct spdk_bdev_io *bdev_io;
struct spdk_bdev_channel *channel = spdk_io_channel_get_ctx(ch);
int rc;
assert(bdev->status != SPDK_BDEV_STATUS_UNCLAIMED);
@ -843,6 +845,7 @@ spdk_bdev_reset(struct spdk_bdev *bdev, enum spdk_bdev_reset_type reset_type,
return -1;
}
bdev_io->ch = channel;
bdev_io->type = SPDK_BDEV_IO_TYPE_RESET;
bdev_io->u.reset.type = reset_type;
spdk_bdev_io_init(bdev_io, bdev, cb_arg, cb);

View File

@ -104,6 +104,8 @@ spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task,
return -1;
}
task->ch = task->lun->io_channel;
switch (func) {
case SPDK_SCSI_TASK_FUNC_ABORT_TASK:
task->response = SPDK_SCSI_TASK_MGMT_RESP_REJECT_FUNC_NOT_SUPPORTED;

View File

@ -1947,6 +1947,6 @@ spdk_bdev_scsi_execute(struct spdk_bdev *bdev, struct spdk_scsi_task *task)
int
spdk_bdev_scsi_reset(struct spdk_bdev *bdev, struct spdk_scsi_task *task)
{
return spdk_bdev_reset(bdev, SPDK_BDEV_RESET_SOFT,
return spdk_bdev_reset(bdev, task->ch, SPDK_BDEV_RESET_SOFT,
spdk_bdev_scsi_task_complete_mgmt, task);
}

View File

@ -660,7 +660,7 @@ __blockdev_reset(void *arg1, void *arg2)
struct io_target *target = req->target;
int rc;
rc = spdk_bdev_reset(target->bdev, *reset_type, quick_test_complete, NULL);
rc = spdk_bdev_reset(target->bdev, target->ch, *reset_type, quick_test_complete, NULL);
if (rc < 0) {
g_completion_success = false;
wake_ut_thread();

View File

@ -394,7 +394,7 @@ reset_target(void *arg)
/* Do reset. */
rte_mempool_get(task_pool, (void **)&task);
task->target = target;
spdk_bdev_reset(target->bdev, SPDK_BDEV_RESET_SOFT,
spdk_bdev_reset(target->bdev, target->ch, SPDK_BDEV_RESET_SOFT,
reset_cb, task);
}

View File

@ -224,7 +224,8 @@ spdk_bdev_unmap(struct spdk_bdev *bdev, struct spdk_io_channel *ch,
}
int
spdk_bdev_reset(struct spdk_bdev *bdev, enum spdk_bdev_reset_type reset_type,
spdk_bdev_reset(struct spdk_bdev *bdev, struct spdk_io_channel *ch,
enum spdk_bdev_reset_type reset_type,
spdk_bdev_io_completion_cb cb, void *cb_arg)
{
return 0;