Commit 2e3f07ac authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I8aad21a88faacecfd94bdba350059528eb62c390

Reviewed-on: https://review.gerrithub.io/362251


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent 1a2cd90c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);

/**
+4 −1
Original line number Diff line number Diff line
@@ -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);
+2 −0
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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);
}
+1 −1
Original line number Diff line number Diff line
@@ -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();
Loading