Commit 74ab9f90 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifdf630bd349c7d2099a6a14accc52f77c129f641
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473610


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent b386a3a9
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -216,21 +216,26 @@ 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;

	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;
	}

	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);
	}
	scsi_lun_execute_tasks(lun);
}

static void