diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:31 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:31 -0500 |
commit | 2a2ca6a96194c4744a2adeefbc09ce881f3c5abe (patch) | |
tree | 50b43d823d4a589fbfb8f8751278d6101cd3ecf3 /drivers/scsi | |
parent | 6ea52226ca131a99bb619bd56fbeee566ea5a966 (diff) |
ide: replace the global ide_lock spinlock by per-hwgroup spinlocks (v2)
Now that (almost) all host drivers have been fixed not to abuse ide_lock
and core code usage of ide_lock has been sanitized we may safely replace
ide_lock by per-hwgroup locks.
This patch is partially based on earlier patch from Ravikiran G Thirumalai.
While at it:
- don't use deprecated HWIF() and HWGROUP() macros
- update locking documentation in ide.h
v2:
Add missing spin_lock_init(&hwgroup->lock). (Noticed by Elias Oltmanns)
Cc: Vaibhav V. Nivargi <vaibhav.nivargi@gmail.com>
Cc: Alok N. Kataria <alokk@calsoftinc.com>
Cc: Shai Fultheim <shai@scalex86.org>
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Cc: Elias Oltmanns <eo@nebensachen.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ide-scsi.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 2370fd82ebfe..c24140aff8e7 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -578,6 +578,8 @@ static int idescsi_eh_abort (struct scsi_cmnd *cmd) | |||
578 | { | 578 | { |
579 | idescsi_scsi_t *scsi = scsihost_to_idescsi(cmd->device->host); | 579 | idescsi_scsi_t *scsi = scsihost_to_idescsi(cmd->device->host); |
580 | ide_drive_t *drive = scsi->drive; | 580 | ide_drive_t *drive = scsi->drive; |
581 | ide_hwif_t *hwif; | ||
582 | ide_hwgroup_t *hwgroup; | ||
581 | int busy; | 583 | int busy; |
582 | int ret = FAILED; | 584 | int ret = FAILED; |
583 | 585 | ||
@@ -594,13 +596,16 @@ static int idescsi_eh_abort (struct scsi_cmnd *cmd) | |||
594 | goto no_drive; | 596 | goto no_drive; |
595 | } | 597 | } |
596 | 598 | ||
597 | /* First give it some more time, how much is "right" is hard to say :-( */ | 599 | hwif = drive->hwif; |
600 | hwgroup = hwif->hwgroup; | ||
598 | 601 | ||
599 | busy = ide_wait_not_busy(HWIF(drive), 100); /* FIXME - uses mdelay which causes latency? */ | 602 | /* First give it some more time, how much is "right" is hard to say :-( |
603 | FIXME - uses mdelay which causes latency? */ | ||
604 | busy = ide_wait_not_busy(hwif, 100); | ||
600 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) | 605 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) |
601 | printk (KERN_WARNING "ide-scsi: drive did%s become ready\n", busy?" not":""); | 606 | printk (KERN_WARNING "ide-scsi: drive did%s become ready\n", busy?" not":""); |
602 | 607 | ||
603 | spin_lock_irq(&ide_lock); | 608 | spin_lock_irq(&hwgroup->lock); |
604 | 609 | ||
605 | /* If there is no pc running we're done (our interrupt took care of it) */ | 610 | /* If there is no pc running we're done (our interrupt took care of it) */ |
606 | pc = drive->pc; | 611 | pc = drive->pc; |
@@ -629,7 +634,7 @@ static int idescsi_eh_abort (struct scsi_cmnd *cmd) | |||
629 | } | 634 | } |
630 | 635 | ||
631 | ide_unlock: | 636 | ide_unlock: |
632 | spin_unlock_irq(&ide_lock); | 637 | spin_unlock_irq(&hwgroup->lock); |
633 | no_drive: | 638 | no_drive: |
634 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) | 639 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) |
635 | printk (KERN_WARNING "ide-scsi: abort returns %s\n", ret == SUCCESS?"success":"failed"); | 640 | printk (KERN_WARNING "ide-scsi: abort returns %s\n", ret == SUCCESS?"success":"failed"); |
@@ -642,6 +647,7 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
642 | struct request *req; | 647 | struct request *req; |
643 | idescsi_scsi_t *scsi = scsihost_to_idescsi(cmd->device->host); | 648 | idescsi_scsi_t *scsi = scsihost_to_idescsi(cmd->device->host); |
644 | ide_drive_t *drive = scsi->drive; | 649 | ide_drive_t *drive = scsi->drive; |
650 | ide_hwgroup_t *hwgroup; | ||
645 | int ready = 0; | 651 | int ready = 0; |
646 | int ret = SUCCESS; | 652 | int ret = SUCCESS; |
647 | 653 | ||
@@ -658,14 +664,18 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
658 | return FAILED; | 664 | return FAILED; |
659 | } | 665 | } |
660 | 666 | ||
667 | hwgroup = drive->hwif->hwgroup; | ||
668 | |||
661 | spin_lock_irq(cmd->device->host->host_lock); | 669 | spin_lock_irq(cmd->device->host->host_lock); |
662 | spin_lock(&ide_lock); | 670 | spin_lock(&hwgroup->lock); |
663 | 671 | ||
664 | pc = drive->pc; | 672 | pc = drive->pc; |
673 | if (pc) | ||
674 | req = pc->rq; | ||
665 | 675 | ||
666 | if (pc == NULL || (req = pc->rq) != HWGROUP(drive)->rq || !HWGROUP(drive)->handler) { | 676 | if (pc == NULL || req != hwgroup->rq || hwgroup->handler == NULL) { |
667 | printk (KERN_WARNING "ide-scsi: No active request in idescsi_eh_reset\n"); | 677 | printk (KERN_WARNING "ide-scsi: No active request in idescsi_eh_reset\n"); |
668 | spin_unlock(&ide_lock); | 678 | spin_unlock(&hwgroup->lock); |
669 | spin_unlock_irq(cmd->device->host->host_lock); | 679 | spin_unlock_irq(cmd->device->host->host_lock); |
670 | return FAILED; | 680 | return FAILED; |
671 | } | 681 | } |
@@ -685,10 +695,10 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
685 | BUG(); | 695 | BUG(); |
686 | } | 696 | } |
687 | 697 | ||
688 | HWGROUP(drive)->rq = NULL; | 698 | hwgroup->rq = NULL; |
689 | HWGROUP(drive)->handler = NULL; | 699 | hwgroup->handler = NULL; |
690 | HWGROUP(drive)->busy = 1; /* will set this to zero when ide reset finished */ | 700 | hwgroup->busy = 1; /* will set this to zero when ide reset finished */ |
691 | spin_unlock(&ide_lock); | 701 | spin_unlock(&hwgroup->lock); |
692 | 702 | ||
693 | ide_do_reset(drive); | 703 | ide_do_reset(drive); |
694 | 704 | ||