Commit 1336aed1 authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[SCSI] libiscsi: check if iscsi host has work queue before queueing work

Instead of having libiscsi check if the offload bit is set, have
it check if the lld created a work queue. I think this is more
clear.
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 301e0f7e
...@@ -81,7 +81,8 @@ inline void iscsi_conn_queue_work(struct iscsi_conn *conn) ...@@ -81,7 +81,8 @@ inline void iscsi_conn_queue_work(struct iscsi_conn *conn)
struct Scsi_Host *shost = conn->session->host; struct Scsi_Host *shost = conn->session->host;
struct iscsi_host *ihost = shost_priv(shost); struct iscsi_host *ihost = shost_priv(shost);
queue_work(ihost->workq, &conn->xmitwork); if (ihost->workq)
queue_work(ihost->workq, &conn->xmitwork);
} }
EXPORT_SYMBOL_GPL(iscsi_conn_queue_work); EXPORT_SYMBOL_GPL(iscsi_conn_queue_work);
...@@ -110,10 +111,8 @@ iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr) ...@@ -110,10 +111,8 @@ iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr)
* xmit thread * xmit thread
*/ */
if (!list_empty(&session->leadconn->cmdqueue) || if (!list_empty(&session->leadconn->cmdqueue) ||
!list_empty(&session->leadconn->mgmtqueue)) { !list_empty(&session->leadconn->mgmtqueue))
if (!(session->tt->caps & CAP_DATA_PATH_OFFLOAD)) iscsi_conn_queue_work(session->leadconn);
iscsi_conn_queue_work(session->leadconn);
}
} }
} }
EXPORT_SYMBOL_GPL(iscsi_update_cmdsn); EXPORT_SYMBOL_GPL(iscsi_update_cmdsn);
...@@ -555,6 +554,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ...@@ -555,6 +554,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
char *data, uint32_t data_size) char *data, uint32_t data_size)
{ {
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
struct iscsi_host *ihost = shost_priv(session->host);
struct iscsi_task *task; struct iscsi_task *task;
itt_t itt; itt_t itt;
...@@ -618,7 +618,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ...@@ -618,7 +618,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
task->conn->session->age); task->conn->session->age);
} }
if (session->tt->caps & CAP_DATA_PATH_OFFLOAD) { if (!ihost->workq) {
if (iscsi_prep_mgmt_task(conn, task)) if (iscsi_prep_mgmt_task(conn, task))
goto free_task; goto free_task;
...@@ -1368,6 +1368,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) ...@@ -1368,6 +1368,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
{ {
struct iscsi_cls_session *cls_session; struct iscsi_cls_session *cls_session;
struct Scsi_Host *host; struct Scsi_Host *host;
struct iscsi_host *ihost;
int reason = 0; int reason = 0;
struct iscsi_session *session; struct iscsi_session *session;
struct iscsi_conn *conn; struct iscsi_conn *conn;
...@@ -1378,6 +1379,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) ...@@ -1378,6 +1379,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
sc->SCp.ptr = NULL; sc->SCp.ptr = NULL;
host = sc->device->host; host = sc->device->host;
ihost = shost_priv(host);
spin_unlock(host->host_lock); spin_unlock(host->host_lock);
cls_session = starget_to_session(scsi_target(sc->device)); cls_session = starget_to_session(scsi_target(sc->device));
...@@ -1440,7 +1442,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) ...@@ -1440,7 +1442,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
goto reject; goto reject;
} }
if (session->tt->caps & CAP_DATA_PATH_OFFLOAD) { if (!ihost->workq) {
reason = iscsi_prep_scsi_cmd_pdu(task); reason = iscsi_prep_scsi_cmd_pdu(task);
if (reason) { if (reason) {
if (reason == -ENOMEM) { if (reason == -ENOMEM) {
...@@ -1673,7 +1675,7 @@ void iscsi_suspend_tx(struct iscsi_conn *conn) ...@@ -1673,7 +1675,7 @@ void iscsi_suspend_tx(struct iscsi_conn *conn)
struct iscsi_host *ihost = shost_priv(shost); struct iscsi_host *ihost = shost_priv(shost);
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
if (!(conn->session->tt->caps & CAP_DATA_PATH_OFFLOAD)) if (ihost->workq)
flush_workqueue(ihost->workq); flush_workqueue(ihost->workq);
} }
EXPORT_SYMBOL_GPL(iscsi_suspend_tx); EXPORT_SYMBOL_GPL(iscsi_suspend_tx);
...@@ -1681,8 +1683,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_tx); ...@@ -1681,8 +1683,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_tx);
static void iscsi_start_tx(struct iscsi_conn *conn) static void iscsi_start_tx(struct iscsi_conn *conn)
{ {
clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
if (!(conn->session->tt->caps & CAP_DATA_PATH_OFFLOAD)) iscsi_conn_queue_work(conn);
iscsi_conn_queue_work(conn);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment