aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2012-06-22 02:25:27 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-07-20 03:58:45 -0400
commite4a9c3732cea3e3c8c704aad86636090ffe6b25f (patch)
treefaea8e91b3d917dcdb4c89adbb021ac737a6cb35 /include
parent3b661a92e869ebe2358de8f4b3230ad84f7fce51 (diff)
[SCSI] libata, libsas: introduce sched_eh and end_eh port ops
When managing shost->host_eh_scheduled libata assumes that there is a 1:1 shost-to-ata_port relationship. libsas creates a 1:N relationship so it needs to manage host_eh_scheduled cumulatively at the host level. The sched_eh and end_eh port port ops allow libsas to track when domain devices enter/leave the "eh-pending" state under ha->lock (previously named ha->state_lock, but it is no longer just a lock for ha->state changes). Since host_eh_scheduled indicates eh without backing commands pinning the device it can be deallocated at any time. Move the taking of the domain_device reference under the port_lock to guarantee that the ata_port stays around for the duration of eh. Reviewed-by: Jacek Danecki <jacek.danecki@intel.com> Acked-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/libata.h4
-rw-r--r--include/scsi/libsas.h4
-rw-r--r--include/scsi/sas_ata.h5
3 files changed, 12 insertions, 1 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6e887c742a27..53da442f892d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -846,6 +846,8 @@ struct ata_port_operations {
846 void (*error_handler)(struct ata_port *ap); 846 void (*error_handler)(struct ata_port *ap);
847 void (*lost_interrupt)(struct ata_port *ap); 847 void (*lost_interrupt)(struct ata_port *ap);
848 void (*post_internal_cmd)(struct ata_queued_cmd *qc); 848 void (*post_internal_cmd)(struct ata_queued_cmd *qc);
849 void (*sched_eh)(struct ata_port *ap);
850 void (*end_eh)(struct ata_port *ap);
849 851
850 /* 852 /*
851 * Optional features 853 * Optional features
@@ -1167,6 +1169,8 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
1167 ata_reset_fn_t softreset, ata_reset_fn_t hardreset, 1169 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
1168 ata_postreset_fn_t postreset); 1170 ata_postreset_fn_t postreset);
1169extern void ata_std_error_handler(struct ata_port *ap); 1171extern void ata_std_error_handler(struct ata_port *ap);
1172extern void ata_std_sched_eh(struct ata_port *ap);
1173extern void ata_std_end_eh(struct ata_port *ap);
1170extern int ata_link_nr_enabled(struct ata_link *link); 1174extern int ata_link_nr_enabled(struct ata_link *link);
1171 1175
1172/* 1176/*
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 10ce74f589c5..814d8cb592ad 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -179,6 +179,7 @@ struct sata_device {
179enum { 179enum {
180 SAS_DEV_GONE, 180 SAS_DEV_GONE,
181 SAS_DEV_DESTROY, 181 SAS_DEV_DESTROY,
182 SAS_DEV_EH_PENDING,
182}; 183};
183 184
184struct domain_device { 185struct domain_device {
@@ -386,7 +387,8 @@ struct sas_ha_struct {
386 struct list_head defer_q; /* work queued while draining */ 387 struct list_head defer_q; /* work queued while draining */
387 struct mutex drain_mutex; 388 struct mutex drain_mutex;
388 unsigned long state; 389 unsigned long state;
389 spinlock_t state_lock; 390 spinlock_t lock;
391 int eh_active;
390 392
391 struct mutex disco_mutex; 393 struct mutex disco_mutex;
392 394
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h
index 77670e823ed8..2dfbdaa0b34a 100644
--- a/include/scsi/sas_ata.h
+++ b/include/scsi/sas_ata.h
@@ -45,6 +45,7 @@ void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
45void sas_ata_schedule_reset(struct domain_device *dev); 45void sas_ata_schedule_reset(struct domain_device *dev);
46void sas_ata_wait_eh(struct domain_device *dev); 46void sas_ata_wait_eh(struct domain_device *dev);
47void sas_probe_sata(struct asd_sas_port *port); 47void sas_probe_sata(struct asd_sas_port *port);
48void sas_ata_end_eh(struct ata_port *ap);
48#else 49#else
49 50
50 51
@@ -85,6 +86,10 @@ static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy
85{ 86{
86 return 0; 87 return 0;
87} 88}
89
90static inline void sas_ata_end_eh(struct ata_port *ap)
91{
92}
88#endif 93#endif
89 94
90#endif /* _SAS_ATA_H_ */ 95#endif /* _SAS_ATA_H_ */