scsi: Differentiate callback function about LUN reset from other TMFs

Current SPDK SCSI supports only LUN RESET in task management function.
Upcoming patches will support other functions too but differentiate
the callback function about LUN reset from other task management
functions for now to avoid misunderstanding.

Change-Id: If8f00ce413fbcc54b12dd885cbf01597f83a2af9
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/434763
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2018-11-26 12:03:38 +09:00 committed by Jim Harris
parent b60923191d
commit b7adc8fe83
4 changed files with 18 additions and 9 deletions

View File

@ -50,10 +50,9 @@ spdk_scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *ta
}
void
spdk_scsi_lun_complete_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
spdk_scsi_lun_complete_reset_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
{
if (task->function == SPDK_SCSI_TASK_FUNC_LUN_RESET &&
task->status == SPDK_SCSI_STATUS_GOOD) {
if (task->status == SPDK_SCSI_STATUS_GOOD) {
/*
* The backend LUN device was just reset. If there are active tasks
* in the backend, it means that LUN reset fails, and we set failure
@ -64,6 +63,15 @@ spdk_scsi_lun_complete_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_tas
task->response = SPDK_SCSI_TASK_MGMT_RESP_TARGET_FAILURE;
}
}
task->cpl_fn(task);
}
static void
spdk_scsi_lun_complete_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
{
assert(task->function != SPDK_SCSI_TASK_FUNC_LUN_RESET);
task->cpl_fn(task);
}

View File

@ -1284,7 +1284,7 @@ spdk_bdev_scsi_task_complete_cmd(struct spdk_bdev_io *bdev_io, bool success,
}
static void
spdk_bdev_scsi_task_complete_mgmt(struct spdk_bdev_io *bdev_io, bool success,
spdk_bdev_scsi_task_complete_reset(struct spdk_bdev_io *bdev_io, bool success,
void *cb_arg)
{
struct spdk_scsi_task *task = cb_arg;
@ -1295,7 +1295,7 @@ spdk_bdev_scsi_task_complete_mgmt(struct spdk_bdev_io *bdev_io, bool success,
task->response = SPDK_SCSI_TASK_MGMT_RESP_SUCCESS;
}
spdk_scsi_lun_complete_mgmt_task(task->lun, task);
spdk_scsi_lun_complete_reset_task(task->lun, task);
}
static void
@ -2111,7 +2111,8 @@ spdk_bdev_scsi_reset(struct spdk_scsi_task *task)
struct spdk_scsi_lun *lun = task->lun;
int rc;
rc = spdk_bdev_reset(lun->bdev_desc, lun->io_channel, spdk_bdev_scsi_task_complete_mgmt, task);
rc = spdk_bdev_reset(lun->bdev_desc, lun->io_channel, spdk_bdev_scsi_task_complete_reset,
task);
if (rc == -ENOMEM) {
spdk_bdev_scsi_queue_io(task, spdk_bdev_scsi_reset_resubmit, task);
}

View File

@ -139,7 +139,7 @@ void spdk_scsi_lun_destruct(struct spdk_scsi_lun *lun);
void spdk_scsi_lun_execute_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
int spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task);
void spdk_scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
void spdk_scsi_lun_complete_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
void spdk_scsi_lun_complete_reset_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
bool spdk_scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun);
int _spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun);
void _spdk_scsi_lun_free_io_channel(struct spdk_scsi_lun *lun);

View File

@ -128,7 +128,7 @@ spdk_scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *ta
}
void
spdk_scsi_lun_complete_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
spdk_scsi_lun_complete_reset_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
{
}