bdev: Remove reset_type

There is now just one type of reset, which is equivalent
to a HARD reset previously.

Change-Id: I955b219cbc5c25793d97de1cc003b30ae99313ac
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362615
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Ben Walker 2017-05-11 10:17:47 -07:00
parent 239ba69c78
commit 4fe9536de0
9 changed files with 11 additions and 44 deletions

View File

@ -84,23 +84,6 @@ enum spdk_bdev_io_type {
SPDK_BDEV_IO_TYPE_RESET,
};
/** Blockdev reset operation type */
enum spdk_bdev_reset_type {
/**
* A hard reset indicates that the blockdev layer should not
* invoke the completion callback for I/Os issued before the
* reset is issued but completed after the reset is complete.
*/
SPDK_BDEV_RESET_HARD,
/**
* A soft reset indicates that the blockdev layer should still
* invoke the completion callback for I/Os issued before the
* reset is issued but completed after the reset is complete.
*/
SPDK_BDEV_RESET_SOFT,
};
/**
* Block device completion callback
*
@ -233,7 +216,7 @@ struct spdk_bdev_io *spdk_bdev_flush(struct spdk_bdev *bdev, struct spdk_io_chan
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, struct spdk_io_channel *ch,
enum spdk_bdev_reset_type, spdk_bdev_io_completion_cb cb, void *cb_arg);
spdk_bdev_io_completion_cb cb, void *cb_arg);
struct spdk_io_channel *spdk_bdev_get_io_channel(struct spdk_bdev *bdev);
/**

View File

@ -285,9 +285,6 @@ struct spdk_bdev_io {
/** Represents the number of bytes to be flushed, starting at offset. */
uint64_t length;
} flush;
struct {
enum spdk_bdev_reset_type type;
} reset;
} u;
/** Status for the IO */

View File

@ -912,7 +912,6 @@ spdk_bdev_flush(struct spdk_bdev *bdev, struct spdk_io_channel *ch,
int
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;
@ -928,7 +927,6 @@ spdk_bdev_reset(struct spdk_bdev *bdev, struct spdk_io_channel *ch,
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);
rc = spdk_bdev_io_submit(bdev_io);
@ -1006,10 +1004,8 @@ spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, enum spdk_bdev_io_status sta
if (bdev_io->type == SPDK_BDEV_IO_TYPE_RESET) {
/* Successful reset */
if (status == SPDK_BDEV_IO_STATUS_SUCCESS) {
/* Increase the blockdev generation if it is a hard reset */
if (bdev_io->u.reset.type == SPDK_BDEV_RESET_HARD) {
bdev_io->bdev->gencnt++;
}
/* Increase the blockdev generation */
bdev_io->bdev->gencnt++;
}
} else {
/*

View File

@ -78,9 +78,7 @@ vbdev_error_reset(struct vbdev_error_disk *error_disk, struct spdk_bdev_io *bdev
* since the spdk_bdev_io_complete() path that normally updates it will not execute
* after we resubmit the I/O to the base_bdev.
*/
if (bdev_io->u.reset.type == SPDK_BDEV_RESET_HARD) {
error_disk->disk.gencnt++;
}
error_disk->disk.gencnt++;
}
static void

View File

@ -104,9 +104,7 @@ split_reset(struct split_disk *split_disk, struct spdk_bdev_io *bdev_io)
* since the spdk_bdev_io_complete() path that normally updates it will not execute
* after we resubmit the I/O to the base_bdev.
*/
if (bdev_io->u.reset.type == SPDK_BDEV_RESET_HARD) {
split_disk->disk.gencnt++;
}
split_disk->disk.gencnt++;
}
static void

View File

@ -1954,6 +1954,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, task->ch, SPDK_BDEV_RESET_SOFT,
return spdk_bdev_reset(bdev, task->ch,
spdk_bdev_scsi_task_complete_mgmt, task);
}

View File

@ -656,11 +656,10 @@ static void
__blockdev_reset(void *arg1, void *arg2)
{
struct bdevio_request *req = arg1;
enum spdk_bdev_reset_type *reset_type = arg2;
struct io_target *target = req->target;
int rc;
rc = spdk_bdev_reset(target->bdev, target->ch, *reset_type, quick_test_complete, NULL);
rc = spdk_bdev_reset(target->bdev, target->ch, quick_test_complete, NULL);
if (rc < 0) {
g_completion_success = false;
wake_ut_thread();
@ -668,7 +667,7 @@ __blockdev_reset(void *arg1, void *arg2)
}
static void
blockdev_reset(struct io_target *target, enum spdk_bdev_reset_type reset_type)
blockdev_reset(struct io_target *target)
{
struct bdevio_request req;
@ -676,7 +675,7 @@ blockdev_reset(struct io_target *target, enum spdk_bdev_reset_type reset_type)
g_completion_success = false;
execute_spdk_function(__blockdev_reset, &req, &reset_type);
execute_spdk_function(__blockdev_reset, &req, NULL);
}
static void
@ -686,10 +685,7 @@ blockdev_test_reset(void)
target = g_io_targets;
while (target != NULL) {
blockdev_reset(target, SPDK_BDEV_RESET_HARD);
CU_ASSERT_EQUAL(g_completion_success, true);
blockdev_reset(target, SPDK_BDEV_RESET_SOFT);
blockdev_reset(target);
CU_ASSERT_EQUAL(g_completion_success, true);
target = target->next;

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, target->ch, SPDK_BDEV_RESET_SOFT,
spdk_bdev_reset(target->bdev, target->ch,
reset_cb, task);
}

View File

@ -225,7 +225,6 @@ spdk_bdev_unmap(struct spdk_bdev *bdev, struct spdk_io_channel *ch,
int
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;