lib/scsi: Factor out submiting pending tasks in LUN into a function

This is a preparation to the next patch. If connections detect that
LUN is removed, we have no way to spdk_scsi_lun_execute_tasks()
to the pending tasks.  Hence the next patch will call the new
function scsi_lun_execute_tasks() in that case.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifdf630bd349c7d2099a6a14accc52f77c129f641
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473610
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-11-08 13:05:34 +09:00 committed by Tomasz Zawadzki
parent b386a3a9a2
commit 74ab9f9041

View File

@ -216,23 +216,28 @@ spdk_scsi_lun_append_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task
TAILQ_INSERT_TAIL(&lun->pending_tasks, task, scsi_link);
}
void
spdk_scsi_lun_execute_tasks(struct spdk_scsi_lun *lun)
static void
scsi_lun_execute_tasks(struct spdk_scsi_lun *lun)
{
struct spdk_scsi_task *task, *task_tmp;
if (scsi_lun_has_pending_mgmt_tasks(lun)) {
/* Pending IO tasks will wait for completion of existing mgmt tasks.
*/
return;
}
TAILQ_FOREACH_SAFE(task, &lun->pending_tasks, scsi_link, task_tmp) {
TAILQ_REMOVE(&lun->pending_tasks, task, scsi_link);
_scsi_lun_execute_task(lun, task);
}
}
void
spdk_scsi_lun_execute_tasks(struct spdk_scsi_lun *lun)
{
if (scsi_lun_has_pending_mgmt_tasks(lun)) {
/* Pending IO tasks will wait for completion of existing mgmt tasks.
*/
return;
}
scsi_lun_execute_tasks(lun);
}
static void
_scsi_lun_remove(void *arg)
{