aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 22:54:06 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:52:16 -0400
commitb12d4f82c1a3cdcb2441c803a3368a9426f2f47f (patch)
tree043c804960c3192076737411c1a6854f2b49ded9
parent2d75ce084eec2a8154225c7e978191b364029003 (diff)
paride: dequeue in-flight request
pd/pf/pcd have track in-flight request by pd/pf/pcd_req. They can be converted to dequeueing model by updating fetching and completion paths. Convert them. Note that removal of elv_next_request() call from pf_next_buf() doesn't make any functional difference. The path is traveled only during partial completion of a request and elv_next_request() call must return the same request anyway. [ Impact: dequeue in-flight request ] Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Tim Waugh <tim@cyberelk.net> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--drivers/block/paride/pcd.c18
-rw-r--r--drivers/block/paride/pd.c14
-rw-r--r--drivers/block/paride/pf.c14
3 files changed, 28 insertions, 18 deletions
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 2d5dc0af55e4..425f81586a31 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -719,9 +719,12 @@ static void do_pcd_request(struct request_queue * q)
719 if (pcd_busy) 719 if (pcd_busy)
720 return; 720 return;
721 while (1) { 721 while (1) {
722 pcd_req = elv_next_request(q); 722 if (!pcd_req) {
723 if (!pcd_req) 723 pcd_req = elv_next_request(q);
724 return; 724 if (!pcd_req)
725 return;
726 blkdev_dequeue_request(pcd_req);
727 }
725 728
726 if (rq_data_dir(pcd_req) == READ) { 729 if (rq_data_dir(pcd_req) == READ) {
727 struct pcd_unit *cd = pcd_req->rq_disk->private_data; 730 struct pcd_unit *cd = pcd_req->rq_disk->private_data;
@@ -734,8 +737,10 @@ static void do_pcd_request(struct request_queue * q)
734 pcd_busy = 1; 737 pcd_busy = 1;
735 ps_set_intr(do_pcd_read, NULL, 0, nice); 738 ps_set_intr(do_pcd_read, NULL, 0, nice);
736 return; 739 return;
737 } else 740 } else {
738 __blk_end_request_cur(pcd_req, -EIO); 741 __blk_end_request_all(pcd_req, -EIO);
742 pcd_req = NULL;
743 }
739 } 744 }
740} 745}
741 746
@@ -744,7 +749,8 @@ static inline void next_request(int err)
744 unsigned long saved_flags; 749 unsigned long saved_flags;
745 750
746 spin_lock_irqsave(&pcd_lock, saved_flags); 751 spin_lock_irqsave(&pcd_lock, saved_flags);
747 __blk_end_request_cur(pcd_req, err); 752 if (!__blk_end_request_cur(pcd_req, err))
753 pcd_req = NULL;
748 pcd_busy = 0; 754 pcd_busy = 0;
749 do_pcd_request(pcd_queue); 755 do_pcd_request(pcd_queue);
750 spin_unlock_irqrestore(&pcd_lock, saved_flags); 756 spin_unlock_irqrestore(&pcd_lock, saved_flags);
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 9ec5d4ac0b64..d2ca3f552061 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -410,11 +410,14 @@ static void run_fsm(void)
410 pd_claimed = 0; 410 pd_claimed = 0;
411 phase = NULL; 411 phase = NULL;
412 spin_lock_irqsave(&pd_lock, saved_flags); 412 spin_lock_irqsave(&pd_lock, saved_flags);
413 __blk_end_request_cur(pd_req, 413 if (!__blk_end_request_cur(pd_req,
414 res == Ok ? 0 : -EIO); 414 res == Ok ? 0 : -EIO)) {
415 pd_req = elv_next_request(pd_queue); 415 pd_req = elv_next_request(pd_queue);
416 if (!pd_req) 416 if (!pd_req)
417 stop = 1; 417 stop = 1;
418 else
419 blkdev_dequeue_request(pd_req);
420 }
418 spin_unlock_irqrestore(&pd_lock, saved_flags); 421 spin_unlock_irqrestore(&pd_lock, saved_flags);
419 if (stop) 422 if (stop)
420 return; 423 return;
@@ -706,6 +709,7 @@ static void do_pd_request(struct request_queue * q)
706 pd_req = elv_next_request(q); 709 pd_req = elv_next_request(q);
707 if (!pd_req) 710 if (!pd_req)
708 return; 711 return;
712 blkdev_dequeue_request(pd_req);
709 713
710 schedule_fsm(); 714 schedule_fsm();
711} 715}
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index e88c889aa7f2..d6f7bd84ed39 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -752,10 +752,8 @@ static struct request_queue *pf_queue;
752 752
753static void pf_end_request(int err) 753static void pf_end_request(int err)
754{ 754{
755 if (pf_req) { 755 if (pf_req && !__blk_end_request_cur(pf_req, err))
756 __blk_end_request_cur(pf_req, err);
757 pf_req = NULL; 756 pf_req = NULL;
758 }
759} 757}
760 758
761static void do_pf_request(struct request_queue * q) 759static void do_pf_request(struct request_queue * q)
@@ -763,9 +761,12 @@ static void do_pf_request(struct request_queue * q)
763 if (pf_busy) 761 if (pf_busy)
764 return; 762 return;
765repeat: 763repeat:
766 pf_req = elv_next_request(q); 764 if (!pf_req) {
767 if (!pf_req) 765 pf_req = elv_next_request(q);
768 return; 766 if (!pf_req)
767 return;
768 blkdev_dequeue_request(pf_req);
769 }
769 770
770 pf_current = pf_req->rq_disk->private_data; 771 pf_current = pf_req->rq_disk->private_data;
771 pf_block = blk_rq_pos(pf_req); 772 pf_block = blk_rq_pos(pf_req);
@@ -806,7 +807,6 @@ static int pf_next_buf(void)
806 if (!pf_count) { 807 if (!pf_count) {
807 spin_lock_irqsave(&pf_spin_lock, saved_flags); 808 spin_lock_irqsave(&pf_spin_lock, saved_flags);
808 pf_end_request(0); 809 pf_end_request(0);
809 pf_req = elv_next_request(pf_queue);
810 spin_unlock_irqrestore(&pf_spin_lock, saved_flags); 810 spin_unlock_irqrestore(&pf_spin_lock, saved_flags);
811 if (!pf_req) 811 if (!pf_req)
812 return 1; 812 return 1;