diff options
| author | Tejun Heo <htejun@gmail.com> | 2006-07-02 14:02:15 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-07-05 22:05:34 -0400 |
| commit | e30349d27e093f32ef517b5416d9dce1998d4676 (patch) | |
| tree | 4979a58ac85db319abfc295aa8c4534f65ecc676 | |
| parent | 0662c58b3265f52f708a6d59476bc7862b01f9c0 (diff) | |
[PATCH] libata: replace ap_lock w/ ap->lock in ata_scsi_error()
ap_lock was used because &ap->host_set->lock was too long and used a
lot. Now that &ap->host_set->lock is replaced with ap->lock, there's
no reason to keep ap_lock.
[ed. note: that's not entirely true. ap_lock is a local variable,
caching the results of a de-ref. In theory, if the compiler is smart
enough, this patch is cosmetic. However, since this is not a fast
path (it is the error path), this patch is nonetheless acceptable,
even though it _may_ introduce a performance regression.]
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
| -rw-r--r-- | drivers/scsi/libata-eh.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/scsi/libata-eh.c b/drivers/scsi/libata-eh.c index 4a670db9aa05..d19666c376ad 100644 --- a/drivers/scsi/libata-eh.c +++ b/drivers/scsi/libata-eh.c | |||
| @@ -190,7 +190,6 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd) | |||
| 190 | void ata_scsi_error(struct Scsi_Host *host) | 190 | void ata_scsi_error(struct Scsi_Host *host) |
| 191 | { | 191 | { |
| 192 | struct ata_port *ap = ata_shost_to_port(host); | 192 | struct ata_port *ap = ata_shost_to_port(host); |
| 193 | spinlock_t *ap_lock = ap->lock; | ||
| 194 | int i, repeat_cnt = ATA_EH_MAX_REPEAT; | 193 | int i, repeat_cnt = ATA_EH_MAX_REPEAT; |
| 195 | unsigned long flags; | 194 | unsigned long flags; |
| 196 | 195 | ||
| @@ -217,7 +216,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
| 217 | struct scsi_cmnd *scmd, *tmp; | 216 | struct scsi_cmnd *scmd, *tmp; |
| 218 | int nr_timedout = 0; | 217 | int nr_timedout = 0; |
| 219 | 218 | ||
| 220 | spin_lock_irqsave(ap_lock, flags); | 219 | spin_lock_irqsave(ap->lock, flags); |
| 221 | 220 | ||
| 222 | list_for_each_entry_safe(scmd, tmp, &host->eh_cmd_q, eh_entry) { | 221 | list_for_each_entry_safe(scmd, tmp, &host->eh_cmd_q, eh_entry) { |
| 223 | struct ata_queued_cmd *qc; | 222 | struct ata_queued_cmd *qc; |
| @@ -256,15 +255,15 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
| 256 | if (nr_timedout) | 255 | if (nr_timedout) |
| 257 | __ata_port_freeze(ap); | 256 | __ata_port_freeze(ap); |
| 258 | 257 | ||
| 259 | spin_unlock_irqrestore(ap_lock, flags); | 258 | spin_unlock_irqrestore(ap->lock, flags); |
| 260 | } else | 259 | } else |
| 261 | spin_unlock_wait(ap_lock); | 260 | spin_unlock_wait(ap->lock); |
| 262 | 261 | ||
| 263 | repeat: | 262 | repeat: |
| 264 | /* invoke error handler */ | 263 | /* invoke error handler */ |
| 265 | if (ap->ops->error_handler) { | 264 | if (ap->ops->error_handler) { |
| 266 | /* fetch & clear EH info */ | 265 | /* fetch & clear EH info */ |
| 267 | spin_lock_irqsave(ap_lock, flags); | 266 | spin_lock_irqsave(ap->lock, flags); |
| 268 | 267 | ||
| 269 | memset(&ap->eh_context, 0, sizeof(ap->eh_context)); | 268 | memset(&ap->eh_context, 0, sizeof(ap->eh_context)); |
| 270 | ap->eh_context.i = ap->eh_info; | 269 | ap->eh_context.i = ap->eh_info; |
| @@ -273,7 +272,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
| 273 | ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; | 272 | ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; |
| 274 | ap->pflags &= ~ATA_PFLAG_EH_PENDING; | 273 | ap->pflags &= ~ATA_PFLAG_EH_PENDING; |
| 275 | 274 | ||
| 276 | spin_unlock_irqrestore(ap_lock, flags); | 275 | spin_unlock_irqrestore(ap->lock, flags); |
| 277 | 276 | ||
| 278 | /* invoke EH. if unloading, just finish failed qcs */ | 277 | /* invoke EH. if unloading, just finish failed qcs */ |
| 279 | if (!(ap->pflags & ATA_PFLAG_UNLOADING)) | 278 | if (!(ap->pflags & ATA_PFLAG_UNLOADING)) |
| @@ -285,14 +284,14 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
| 285 | * recovered the port but before this point. Repeat | 284 | * recovered the port but before this point. Repeat |
| 286 | * EH in such case. | 285 | * EH in such case. |
| 287 | */ | 286 | */ |
| 288 | spin_lock_irqsave(ap_lock, flags); | 287 | spin_lock_irqsave(ap->lock, flags); |
| 289 | 288 | ||
| 290 | if (ap->pflags & ATA_PFLAG_EH_PENDING) { | 289 | if (ap->pflags & ATA_PFLAG_EH_PENDING) { |
| 291 | if (--repeat_cnt) { | 290 | if (--repeat_cnt) { |
| 292 | ata_port_printk(ap, KERN_INFO, | 291 | ata_port_printk(ap, KERN_INFO, |
| 293 | "EH pending after completion, " | 292 | "EH pending after completion, " |
| 294 | "repeating EH (cnt=%d)\n", repeat_cnt); | 293 | "repeating EH (cnt=%d)\n", repeat_cnt); |
| 295 | spin_unlock_irqrestore(ap_lock, flags); | 294 | spin_unlock_irqrestore(ap->lock, flags); |
| 296 | goto repeat; | 295 | goto repeat; |
| 297 | } | 296 | } |
| 298 | ata_port_printk(ap, KERN_ERR, "EH pending after %d " | 297 | ata_port_printk(ap, KERN_ERR, "EH pending after %d " |
| @@ -302,14 +301,14 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
| 302 | /* this run is complete, make sure EH info is clear */ | 301 | /* this run is complete, make sure EH info is clear */ |
| 303 | memset(&ap->eh_info, 0, sizeof(ap->eh_info)); | 302 | memset(&ap->eh_info, 0, sizeof(ap->eh_info)); |
| 304 | 303 | ||
| 305 | /* Clear host_eh_scheduled while holding ap_lock such | 304 | /* Clear host_eh_scheduled while holding ap->lock such |
| 306 | * that if exception occurs after this point but | 305 | * that if exception occurs after this point but |
| 307 | * before EH completion, SCSI midlayer will | 306 | * before EH completion, SCSI midlayer will |
| 308 | * re-initiate EH. | 307 | * re-initiate EH. |
| 309 | */ | 308 | */ |
| 310 | host->host_eh_scheduled = 0; | 309 | host->host_eh_scheduled = 0; |
| 311 | 310 | ||
| 312 | spin_unlock_irqrestore(ap_lock, flags); | 311 | spin_unlock_irqrestore(ap->lock, flags); |
| 313 | } else { | 312 | } else { |
| 314 | WARN_ON(ata_qc_from_tag(ap, ap->active_tag) == NULL); | 313 | WARN_ON(ata_qc_from_tag(ap, ap->active_tag) == NULL); |
| 315 | ap->ops->eng_timeout(ap); | 314 | ap->ops->eng_timeout(ap); |
| @@ -321,7 +320,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
| 321 | scsi_eh_flush_done_q(&ap->eh_done_q); | 320 | scsi_eh_flush_done_q(&ap->eh_done_q); |
| 322 | 321 | ||
| 323 | /* clean up */ | 322 | /* clean up */ |
| 324 | spin_lock_irqsave(ap_lock, flags); | 323 | spin_lock_irqsave(ap->lock, flags); |
| 325 | 324 | ||
| 326 | if (ap->pflags & ATA_PFLAG_LOADING) { | 325 | if (ap->pflags & ATA_PFLAG_LOADING) { |
| 327 | ap->pflags &= ~ATA_PFLAG_LOADING; | 326 | ap->pflags &= ~ATA_PFLAG_LOADING; |
| @@ -338,7 +337,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
| 338 | ap->pflags &= ~ATA_PFLAG_EH_IN_PROGRESS; | 337 | ap->pflags &= ~ATA_PFLAG_EH_IN_PROGRESS; |
| 339 | wake_up_all(&ap->eh_wait_q); | 338 | wake_up_all(&ap->eh_wait_q); |
| 340 | 339 | ||
| 341 | spin_unlock_irqrestore(ap_lock, flags); | 340 | spin_unlock_irqrestore(ap->lock, flags); |
| 342 | 341 | ||
| 343 | DPRINTK("EXIT\n"); | 342 | DPRINTK("EXIT\n"); |
| 344 | } | 343 | } |
