aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-07-06 15:39:27 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-06 15:39:27 -0400
commit3503e0acbfab0dbcd24ccadd5fe841f3f8290e81 (patch)
tree3a9b186c73e731fdbe74fa08ae743cbf4b061b5f /drivers
parente18ed145c7f556f1de8350c32739bf35b26df705 (diff)
Revert "ide: improve handling of Power Management requests"
This reverts commit a1317f714af7aed60ddc182d0122477cbe36ee9b.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-io.c54
1 files changed, 32 insertions, 22 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index d5f3c77beadd..db96138fefcd 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -466,14 +466,10 @@ void do_ide_request(struct request_queue *q)
466 466
467 if (!ide_lock_port(hwif)) { 467 if (!ide_lock_port(hwif)) {
468 ide_hwif_t *prev_port; 468 ide_hwif_t *prev_port;
469
470 WARN_ON_ONCE(hwif->rq);
469repeat: 471repeat:
470 prev_port = hwif->host->cur_port; 472 prev_port = hwif->host->cur_port;
471
472 if (drive->dev_flags & IDE_DFLAG_BLOCKED)
473 rq = hwif->rq;
474 else
475 WARN_ON_ONCE(hwif->rq);
476
477 if (drive->dev_flags & IDE_DFLAG_SLEEPING && 473 if (drive->dev_flags & IDE_DFLAG_SLEEPING &&
478 time_after(drive->sleep, jiffies)) { 474 time_after(drive->sleep, jiffies)) {
479 ide_unlock_port(hwif); 475 ide_unlock_port(hwif);
@@ -500,29 +496,43 @@ repeat:
500 hwif->cur_dev = drive; 496 hwif->cur_dev = drive;
501 drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); 497 drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED);
502 498
503 if (rq == NULL) { 499 spin_unlock_irq(&hwif->lock);
504 spin_unlock_irq(&hwif->lock); 500 spin_lock_irq(q->queue_lock);
505 spin_lock_irq(q->queue_lock); 501 /*
506 /* 502 * we know that the queue isn't empty, but this can happen
507 * we know that the queue isn't empty, but this can 503 * if the q->prep_rq_fn() decides to kill a request
508 * happen if ->prep_rq_fn() decides to kill a request 504 */
509 */ 505 if (!rq)
510 rq = blk_fetch_request(drive->queue); 506 rq = blk_fetch_request(drive->queue);
511 spin_unlock_irq(q->queue_lock);
512 spin_lock_irq(&hwif->lock);
513 507
514 if (rq == NULL) { 508 spin_unlock_irq(q->queue_lock);
515 ide_unlock_port(hwif); 509 spin_lock_irq(&hwif->lock);
516 goto out; 510
517 } 511 if (!rq) {
512 ide_unlock_port(hwif);
513 goto out;
518 } 514 }
519 515
520 /* 516 /*
521 * Sanity: don't accept a request that isn't a PM request 517 * Sanity: don't accept a request that isn't a PM request
522 * if we are currently power managed. 518 * if we are currently power managed. This is very important as
519 * blk_stop_queue() doesn't prevent the blk_fetch_request()
520 * above to return us whatever is in the queue. Since we call
521 * ide_do_request() ourselves, we end up taking requests while
522 * the queue is blocked...
523 *
524 * We let requests forced at head of queue with ide-preempt
525 * though. I hope that doesn't happen too much, hopefully not
526 * unless the subdriver triggers such a thing in its own PM
527 * state machine.
523 */ 528 */
524 BUG_ON((drive->dev_flags & IDE_DFLAG_BLOCKED) && 529 if ((drive->dev_flags & IDE_DFLAG_BLOCKED) &&
525 blk_pm_request(rq) == 0); 530 blk_pm_request(rq) == 0 &&
531 (rq->cmd_flags & REQ_PREEMPT) == 0) {
532 /* there should be no pending command at this point */
533 ide_unlock_port(hwif);
534 goto plug_device;
535 }
526 536
527 hwif->rq = rq; 537 hwif->rq = rq;
528 538