From: Dan Williams <dan.j.williams@intel.com>
To: tj@kernel.org, JBottomley@parallels.com
Cc: Mike Christie <michaelc@cs.wisc.edu>,
Robert Love <robert.w.love@intel.com>,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: [PATCH 3/3] scsi: use drain_workqueue
Date: Fri, 02 Dec 2011 15:57:01 -0800 [thread overview]
Message-ID: <20111202235700.24470.23826.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20111202235319.24470.65483.stgit@localhost6.localdomain6>
Use 'drain' versus 'flush' as the former additionally flushes chained
operations. libsas uses chained operations when it posts discovery work
in response to a port event.
As a result the hardcoded double-flush can be removed from the isci
driver.
Cc: Mike Christie <michaelc@cs.wisc.edu>
Cc: Robert Love <robert.w.love@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
drivers/scsi/hosts.c | 8 ++++----
drivers/scsi/isci/host.c | 3 ---
include/scsi/scsi_host.h | 2 +-
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 351dc0b..37155d1 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -564,19 +564,19 @@ int scsi_queue_work(struct Scsi_Host *shost, struct work_struct *work)
EXPORT_SYMBOL_GPL(scsi_queue_work);
/**
- * scsi_flush_work - Flush a Scsi_Host's workqueue.
+ * scsi_flush_work - Drain a Scsi_Host's workqueue.
* @shost: Pointer to Scsi_Host.
**/
-void scsi_flush_work(struct Scsi_Host *shost)
+int scsi_flush_work(struct Scsi_Host *shost)
{
if (!shost->work_q) {
printk(KERN_ERR
"ERROR: Scsi host '%s' attempted to flush scsi-work, "
"when no workqueue created.\n", shost->hostt->name);
dump_stack();
- return;
+ return 0;
}
- flush_workqueue(shost->work_q);
+ return drain_workqueue(shost->work_q);
}
EXPORT_SYMBOL_GPL(scsi_flush_work);
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index e7fe9c4..240779a 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -655,9 +655,6 @@ int isci_host_scan_finished(struct Scsi_Host *shost, unsigned long time)
if (test_bit(IHOST_START_PENDING, &ihost->flags))
return 0;
- /* todo: use sas_flush_discovery once it is upstream */
- scsi_flush_work(shost);
-
scsi_flush_work(shost);
dev_dbg(&ihost->pdev->dev,
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 50266c9..505bc34 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -770,7 +770,7 @@ static inline int scsi_host_in_recovery(struct Scsi_Host *shost)
}
extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
-extern void scsi_flush_work(struct Scsi_Host *);
+extern int scsi_flush_work(struct Scsi_Host *);
extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
extern int __must_check scsi_add_host_with_dma(struct Scsi_Host *,
prev parent reply other threads:[~2011-12-02 23:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-02 23:56 [PATCH 0/3] drain_workqueue vs scsi_flush_work Dan Williams
2011-12-02 23:56 ` [PATCH 1/3] workqueue: promote workqueue_lock to hard-irq safe Dan Williams
2011-12-02 23:56 ` [PATCH 2/3] workqueue: defer work to a draining queue Dan Williams
2011-12-03 1:53 ` Williams, Dan J
2011-12-04 7:12 ` Dan Williams
2011-12-02 23:57 ` Dan Williams [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111202235700.24470.23826.stgit@localhost6.localdomain6 \
--to=dan.j.williams@intel.com \
--cc=JBottomley@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=robert.w.love@intel.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox