aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2009-05-13 18:57:48 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-05-23 16:44:12 -0400
commit1336aed10b8af791378b017f0fa8da4e5b827b8d (patch)
tree6b61863e6bfb219363a705155defe36f75390865 /drivers
parent301e0f7e4d78e956c58b66888e134dbdb44ea28e (diff)
[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: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/libiscsi.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 57eb3af40e96..dafa054537f6 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -81,7 +81,8 @@ inline void iscsi_conn_queue_work(struct iscsi_conn *conn)
81 struct Scsi_Host *shost = conn->session->host; 81 struct Scsi_Host *shost = conn->session->host;
82 struct iscsi_host *ihost = shost_priv(shost); 82 struct iscsi_host *ihost = shost_priv(shost);
83 83
84 queue_work(ihost->workq, &conn->xmitwork); 84 if (ihost->workq)
85 queue_work(ihost->workq, &conn->xmitwork);
85} 86}
86EXPORT_SYMBOL_GPL(iscsi_conn_queue_work); 87EXPORT_SYMBOL_GPL(iscsi_conn_queue_work);
87 88
@@ -110,10 +111,8 @@ iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr)
110 * xmit thread 111 * xmit thread
111 */ 112 */
112 if (!list_empty(&session->leadconn->cmdqueue) || 113 if (!list_empty(&session->leadconn->cmdqueue) ||
113 !list_empty(&session->leadconn->mgmtqueue)) { 114 !list_empty(&session->leadconn->mgmtqueue))
114 if (!(session->tt->caps & CAP_DATA_PATH_OFFLOAD)) 115 iscsi_conn_queue_work(session->leadconn);
115 iscsi_conn_queue_work(session->leadconn);
116 }
117 } 116 }
118} 117}
119EXPORT_SYMBOL_GPL(iscsi_update_cmdsn); 118EXPORT_SYMBOL_GPL(iscsi_update_cmdsn);
@@ -555,6 +554,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
555 char *data, uint32_t data_size) 554 char *data, uint32_t data_size)
556{ 555{
557 struct iscsi_session *session = conn->session; 556 struct iscsi_session *session = conn->session;
557 struct iscsi_host *ihost = shost_priv(session->host);
558 struct iscsi_task *task; 558 struct iscsi_task *task;
559 itt_t itt; 559 itt_t itt;
560 560
@@ -618,7 +618,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
618 task->conn->session->age); 618 task->conn->session->age);
619 } 619 }
620 620
621 if (session->tt->caps & CAP_DATA_PATH_OFFLOAD) { 621 if (!ihost->workq) {
622 if (iscsi_prep_mgmt_task(conn, task)) 622 if (iscsi_prep_mgmt_task(conn, task))
623 goto free_task; 623 goto free_task;
624 624
@@ -1368,6 +1368,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
1368{ 1368{
1369 struct iscsi_cls_session *cls_session; 1369 struct iscsi_cls_session *cls_session;
1370 struct Scsi_Host *host; 1370 struct Scsi_Host *host;
1371 struct iscsi_host *ihost;
1371 int reason = 0; 1372 int reason = 0;
1372 struct iscsi_session *session; 1373 struct iscsi_session *session;
1373 struct iscsi_conn *conn; 1374 struct iscsi_conn *conn;
@@ -1378,6 +1379,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
1378 sc->SCp.ptr = NULL; 1379 sc->SCp.ptr = NULL;
1379 1380
1380 host = sc->device->host; 1381 host = sc->device->host;
1382 ihost = shost_priv(host);
1381 spin_unlock(host->host_lock); 1383 spin_unlock(host->host_lock);
1382 1384
1383 cls_session = starget_to_session(scsi_target(sc->device)); 1385 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 goto reject; 1442 goto reject;
1441 } 1443 }
1442 1444
1443 if (session->tt->caps & CAP_DATA_PATH_OFFLOAD) { 1445 if (!ihost->workq) {
1444 reason = iscsi_prep_scsi_cmd_pdu(task); 1446 reason = iscsi_prep_scsi_cmd_pdu(task);
1445 if (reason) { 1447 if (reason) {
1446 if (reason == -ENOMEM) { 1448 if (reason == -ENOMEM) {
@@ -1673,7 +1675,7 @@ void iscsi_suspend_tx(struct iscsi_conn *conn)
1673 struct iscsi_host *ihost = shost_priv(shost); 1675 struct iscsi_host *ihost = shost_priv(shost);
1674 1676
1675 set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); 1677 set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
1676 if (!(conn->session->tt->caps & CAP_DATA_PATH_OFFLOAD)) 1678 if (ihost->workq)
1677 flush_workqueue(ihost->workq); 1679 flush_workqueue(ihost->workq);
1678} 1680}
1679EXPORT_SYMBOL_GPL(iscsi_suspend_tx); 1681EXPORT_SYMBOL_GPL(iscsi_suspend_tx);
@@ -1681,8 +1683,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_tx);
1681static void iscsi_start_tx(struct iscsi_conn *conn) 1683static void iscsi_start_tx(struct iscsi_conn *conn)
1682{ 1684{
1683 clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); 1685 clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
1684 if (!(conn->session->tt->caps & CAP_DATA_PATH_OFFLOAD)) 1686 iscsi_conn_queue_work(conn);
1685 iscsi_conn_queue_work(conn);
1686} 1687}
1687 1688
1688/* 1689/*