aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/libsas.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-12-19 19:42:34 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-02-19 14:48:51 -0500
commitb1124cd3ec97406c767b90bf7e93ecd2d2915592 (patch)
treed0936775aacff4492177c14a73175738dfb51ee0 /include/scsi/libsas.h
parentf8daa6e6d83f60a721752cb53433bfdc1503b45f (diff)
[SCSI] libsas: introduce sas_drain_work()
When an lldd invokes ->notify_port_event() it can trigger a chain of libsas events to: 1/ form the port and find the direct attached device 2/ if the attached device is an expander perform domain discovery A call to flush_workqueue() will only flush the initial port formation work. Currently libsas users need to call scsi_flush_work() up to the max depth of chain (which will grow from 2 to 3 when ata discovery is moved to its own discovery event). Instead of open coding multiple calls switch to use drain_workqueue() to flush sas work. drain_workqueue() does not handle new work submitted during the drain so libsas needs a bit of infrastructure to hold off unchained work submissions while a drain is in flight. A lldd ->notify() event is considered 'unchained' while a sas_discover_event() is 'chained'. As Tejun notes: "For now, I think it would be best to add private wrapper in libsas to support deferring unchained work items while draining." Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'include/scsi/libsas.h')
-rw-r--r--include/scsi/libsas.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 8e402d5a0640..42900fa95a03 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -330,6 +330,7 @@ struct sas_ha_event {
330 330
331enum sas_ha_state { 331enum sas_ha_state {
332 SAS_HA_REGISTERED, 332 SAS_HA_REGISTERED,
333 SAS_HA_DRAINING,
333}; 334};
334 335
335struct sas_ha_struct { 336struct sas_ha_struct {
@@ -337,6 +338,8 @@ struct sas_ha_struct {
337 struct sas_ha_event ha_events[HA_NUM_EVENTS]; 338 struct sas_ha_event ha_events[HA_NUM_EVENTS];
338 unsigned long pending; 339 unsigned long pending;
339 340
341 struct list_head defer_q; /* work queued while draining */
342 struct mutex drain_mutex;
340 unsigned long state; 343 unsigned long state;
341 spinlock_t state_lock; 344 spinlock_t state_lock;
342 345
@@ -657,6 +660,7 @@ int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd);
657extern void sas_target_destroy(struct scsi_target *); 660extern void sas_target_destroy(struct scsi_target *);
658extern int sas_slave_alloc(struct scsi_device *); 661extern int sas_slave_alloc(struct scsi_device *);
659extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg); 662extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg);
663extern int sas_drain_work(struct sas_ha_struct *ha);
660 664
661extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, 665extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
662 struct request *req); 666 struct request *req);