Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6:
Revert "ide: improve handling of Power Management requests"

+32 -22
+32 -22
drivers/ide/ide-io.c
··· 466 466 467 467 if (!ide_lock_port(hwif)) { 468 468 ide_hwif_t *prev_port; 469 + 470 + WARN_ON_ONCE(hwif->rq); 469 471 repeat: 470 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 473 if (drive->dev_flags & IDE_DFLAG_SLEEPING && 478 474 time_after(drive->sleep, jiffies)) { 479 475 ide_unlock_port(hwif); ··· 496 500 hwif->cur_dev = drive; 497 501 drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); 498 502 499 - if (rq == NULL) { 500 - spin_unlock_irq(&hwif->lock); 501 - spin_lock_irq(q->queue_lock); 502 - /* 503 - * we know that the queue isn't empty, but this can 504 - * happen if ->prep_rq_fn() decides to kill a request 505 - */ 503 + spin_unlock_irq(&hwif->lock); 504 + spin_lock_irq(q->queue_lock); 505 + /* 506 + * we know that the queue isn't empty, but this can happen 507 + * if the q->prep_rq_fn() decides to kill a request 508 + */ 509 + if (!rq) 506 510 rq = blk_fetch_request(drive->queue); 507 - spin_unlock_irq(q->queue_lock); 508 - spin_lock_irq(&hwif->lock); 509 511 510 - if (rq == NULL) { 511 - ide_unlock_port(hwif); 512 - goto out; 513 - } 512 + spin_unlock_irq(q->queue_lock); 513 + spin_lock_irq(&hwif->lock); 514 + 515 + if (!rq) { 516 + ide_unlock_port(hwif); 517 + goto out; 514 518 } 515 519 516 520 /* 517 521 * Sanity: don't accept a request that isn't a PM request 518 - * if we are currently power managed. 522 + * if we are currently power managed. This is very important as 523 + * blk_stop_queue() doesn't prevent the blk_fetch_request() 524 + * above to return us whatever is in the queue. Since we call 525 + * ide_do_request() ourselves, we end up taking requests while 526 + * the queue is blocked... 527 + * 528 + * We let requests forced at head of queue with ide-preempt 529 + * though. I hope that doesn't happen too much, hopefully not 530 + * unless the subdriver triggers such a thing in its own PM 531 + * state machine. 519 532 */ 520 - BUG_ON((drive->dev_flags & IDE_DFLAG_BLOCKED) && 521 - blk_pm_request(rq) == 0); 533 + if ((drive->dev_flags & IDE_DFLAG_BLOCKED) && 534 + blk_pm_request(rq) == 0 && 535 + (rq->cmd_flags & REQ_PREEMPT) == 0) { 536 + /* there should be no pending command at this point */ 537 + ide_unlock_port(hwif); 538 + goto plug_device; 539 + } 522 540 523 541 hwif->rq = rq; 524 542