lib/scsi: Change current function to check pending tasks to private
When closing iSCSI connection, if we check pending tasks, we must check tasks only from the corresponding initiator. We have to add new API to do that. On the other hand, during IO submission or LUN hotplug, we must check all tasks. The latter case is done only in SCSI LUN, and the function is not necessary to be public. As a preparation, change scsi_lun_has_pending_tasks/_mgmt_tasks from public to private. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I2d7d77109ed317435b6768fffb0bf4e21dd60f9f Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471335 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
562178af9c
commit
4787395283
@ -61,6 +61,21 @@ scsi_lun_complete_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *ta
|
||||
spdk_scsi_lun_execute_mgmt_task(lun);
|
||||
}
|
||||
|
||||
static bool
|
||||
scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun)
|
||||
{
|
||||
return !TAILQ_EMPTY(&lun->pending_mgmt_tasks) ||
|
||||
!TAILQ_EMPTY(&lun->mgmt_tasks);
|
||||
}
|
||||
|
||||
/* This check includes both pending and submitted (outstanding) tasks. */
|
||||
static bool
|
||||
scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun)
|
||||
{
|
||||
return !TAILQ_EMPTY(&lun->pending_tasks) ||
|
||||
!TAILQ_EMPTY(&lun->tasks);
|
||||
}
|
||||
|
||||
static bool
|
||||
scsi_lun_has_outstanding_tasks(struct spdk_scsi_lun *lun)
|
||||
{
|
||||
@ -206,7 +221,7 @@ spdk_scsi_lun_execute_tasks(struct spdk_scsi_lun *lun)
|
||||
{
|
||||
struct spdk_scsi_task *task, *task_tmp;
|
||||
|
||||
if (spdk_scsi_lun_has_pending_mgmt_tasks(lun)) {
|
||||
if (scsi_lun_has_pending_mgmt_tasks(lun)) {
|
||||
/* Pending IO tasks will wait for completion of existing mgmt tasks.
|
||||
*/
|
||||
return;
|
||||
@ -277,8 +292,8 @@ scsi_lun_check_pending_tasks(void *arg)
|
||||
{
|
||||
struct spdk_scsi_lun *lun = (struct spdk_scsi_lun *)arg;
|
||||
|
||||
if (spdk_scsi_lun_has_pending_tasks(lun) ||
|
||||
spdk_scsi_lun_has_pending_mgmt_tasks(lun)) {
|
||||
if (scsi_lun_has_pending_tasks(lun) ||
|
||||
scsi_lun_has_pending_mgmt_tasks(lun)) {
|
||||
return -1;
|
||||
}
|
||||
spdk_poller_unregister(&lun->hotremove_poller);
|
||||
@ -292,8 +307,8 @@ _scsi_lun_hot_remove(void *arg1)
|
||||
{
|
||||
struct spdk_scsi_lun *lun = arg1;
|
||||
|
||||
if (spdk_scsi_lun_has_pending_tasks(lun) ||
|
||||
spdk_scsi_lun_has_pending_mgmt_tasks(lun)) {
|
||||
if (scsi_lun_has_pending_tasks(lun) ||
|
||||
scsi_lun_has_pending_mgmt_tasks(lun)) {
|
||||
lun->hotremove_poller = spdk_poller_register(scsi_lun_check_pending_tasks,
|
||||
lun, 10);
|
||||
} else {
|
||||
@ -491,16 +506,13 @@ spdk_scsi_lun_get_dev(const struct spdk_scsi_lun *lun)
|
||||
bool
|
||||
spdk_scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun)
|
||||
{
|
||||
return !TAILQ_EMPTY(&lun->pending_mgmt_tasks) ||
|
||||
!TAILQ_EMPTY(&lun->mgmt_tasks);
|
||||
return scsi_lun_has_pending_mgmt_tasks(lun);
|
||||
}
|
||||
|
||||
/* This check includes both pending and submitted (outstanding) tasks. */
|
||||
bool
|
||||
spdk_scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun)
|
||||
{
|
||||
return !TAILQ_EMPTY(&lun->pending_tasks) ||
|
||||
!TAILQ_EMPTY(&lun->tasks);
|
||||
return scsi_lun_has_pending_tasks(lun);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user