diff options
author | Tejun Heo <tj@kernel.org> | 2009-05-07 22:54:16 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-11 03:52:18 -0400 |
commit | 9934c8c04561413609d2bc38c6b9f268cba774a4 (patch) | |
tree | 30dd8f7be54f9b2e03094de9cd03b6a9ee2909cd /drivers/block | |
parent | 2343046826a8ca426b07601d9593ee046c298b68 (diff) |
block: implement and enforce request peek/start/fetch
Till now block layer allowed two separate modes of request execution.
A request is always acquired from the request queue via
elv_next_request(). After that, drivers are free to either dequeue it
or process it without dequeueing. Dequeue allows elv_next_request()
to return the next request so that multiple requests can be in flight.
Executing requests without dequeueing has its merits mostly in
allowing drivers for simpler devices which can't do sg to deal with
segments only without considering request boundary. However, the
benefit this brings is dubious and declining while the cost of the API
ambiguity is increasing. Segment based drivers are usually for very
old or limited devices and as converting to dequeueing model isn't
difficult, it doesn't justify the API overhead it puts on block layer
and its more modern users.
Previous patches converted all block low level drivers to dequeueing
model. This patch completes the API transition by...
* renaming elv_next_request() to blk_peek_request()
* renaming blkdev_dequeue_request() to blk_start_request()
* adding blk_fetch_request() which is combination of peek and start
* disallowing completion of queued (not started) requests
* applying new API to all LLDs
Renamings are for consistency and to break out of tree code so that
it's apparent that out of tree drivers need updating.
[ Impact: block request issue API cleanup, no functional change ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: unsik Kim <donari75@gmail.com>
Cc: Paul Clements <paul.clements@steeleye.com>
Cc: Tim Waugh <tim@cyberelk.net>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Laurent Vivier <Laurent@lvivier.info>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: Pierre Ossman <drzeus@drzeus.cx>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: Stefan Weinhuber <wein@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/DAC960.c | 4 | ||||
-rw-r--r-- | drivers/block/amiflop.c | 3 | ||||
-rw-r--r-- | drivers/block/ataflop.c | 3 | ||||
-rw-r--r-- | drivers/block/cciss.c | 4 | ||||
-rw-r--r-- | drivers/block/cpqarray.c | 4 | ||||
-rw-r--r-- | drivers/block/floppy.c | 6 | ||||
-rw-r--r-- | drivers/block/hd.c | 3 | ||||
-rw-r--r-- | drivers/block/mg_disk.c | 12 | ||||
-rw-r--r-- | drivers/block/nbd.c | 4 | ||||
-rw-r--r-- | drivers/block/paride/pcd.c | 3 | ||||
-rw-r--r-- | drivers/block/paride/pd.c | 7 | ||||
-rw-r--r-- | drivers/block/paride/pf.c | 3 | ||||
-rw-r--r-- | drivers/block/ps3disk.c | 4 | ||||
-rw-r--r-- | drivers/block/sunvdc.c | 3 | ||||
-rw-r--r-- | drivers/block/swim.c | 12 | ||||
-rw-r--r-- | drivers/block/swim3.c | 3 | ||||
-rw-r--r-- | drivers/block/sx8.c | 8 | ||||
-rw-r--r-- | drivers/block/ub.c | 8 | ||||
-rw-r--r-- | drivers/block/viodasd.c | 4 | ||||
-rw-r--r-- | drivers/block/virtio_blk.c | 4 | ||||
-rw-r--r-- | drivers/block/xd.c | 12 | ||||
-rw-r--r-- | drivers/block/xen-blkfront.c | 4 | ||||
-rw-r--r-- | drivers/block/xsysace.c | 10 | ||||
-rw-r--r-- | drivers/block/z2ram.c | 12 |
24 files changed, 48 insertions, 92 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 774ab05973a9..668dc234b8e2 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -3321,7 +3321,7 @@ static int DAC960_process_queue(DAC960_Controller_T *Controller, struct request_ | |||
3321 | DAC960_Command_T *Command; | 3321 | DAC960_Command_T *Command; |
3322 | 3322 | ||
3323 | while(1) { | 3323 | while(1) { |
3324 | Request = elv_next_request(req_q); | 3324 | Request = blk_peek_request(req_q); |
3325 | if (!Request) | 3325 | if (!Request) |
3326 | return 1; | 3326 | return 1; |
3327 | 3327 | ||
@@ -3341,7 +3341,7 @@ static int DAC960_process_queue(DAC960_Controller_T *Controller, struct request_ | |||
3341 | Command->BlockNumber = blk_rq_pos(Request); | 3341 | Command->BlockNumber = blk_rq_pos(Request); |
3342 | Command->BlockCount = blk_rq_sectors(Request); | 3342 | Command->BlockCount = blk_rq_sectors(Request); |
3343 | Command->Request = Request; | 3343 | Command->Request = Request; |
3344 | blkdev_dequeue_request(Request); | 3344 | blk_start_request(Request); |
3345 | Command->SegmentCount = blk_rq_map_sg(req_q, | 3345 | Command->SegmentCount = blk_rq_map_sg(req_q, |
3346 | Command->Request, Command->cmd_sglist); | 3346 | Command->Request, Command->cmd_sglist); |
3347 | /* pci_map_sg MAY change the value of SegCount */ | 3347 | /* pci_map_sg MAY change the value of SegCount */ |
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index 80a68b2e0451..9c6e5b0fe894 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -1342,12 +1342,11 @@ static void redo_fd_request(void) | |||
1342 | int err; | 1342 | int err; |
1343 | 1343 | ||
1344 | next_req: | 1344 | next_req: |
1345 | rq = elv_next_request(floppy_queue); | 1345 | rq = blk_fetch_request(floppy_queue); |
1346 | if (!rq) { | 1346 | if (!rq) { |
1347 | /* Nothing left to do */ | 1347 | /* Nothing left to do */ |
1348 | return; | 1348 | return; |
1349 | } | 1349 | } |
1350 | blkdev_dequeue_request(rq); | ||
1351 | 1350 | ||
1352 | floppy = rq->rq_disk->private_data; | 1351 | floppy = rq->rq_disk->private_data; |
1353 | drive = floppy - unit; | 1352 | drive = floppy - unit; |
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 89a591d9c83b..f5e7180d7f47 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -1404,10 +1404,9 @@ static void redo_fd_request(void) | |||
1404 | 1404 | ||
1405 | repeat: | 1405 | repeat: |
1406 | if (!fd_request) { | 1406 | if (!fd_request) { |
1407 | fd_request = elv_next_request(floppy_queue); | 1407 | fd_request = blk_fetch_request(floppy_queue); |
1408 | if (!fd_request) | 1408 | if (!fd_request) |
1409 | goto the_end; | 1409 | goto the_end; |
1410 | blkdev_dequeue_request(fd_request); | ||
1411 | } | 1410 | } |
1412 | 1411 | ||
1413 | floppy = fd_request->rq_disk->private_data; | 1412 | floppy = fd_request->rq_disk->private_data; |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index ab7b04c0db70..e714e7cce6f2 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -2801,7 +2801,7 @@ static void do_cciss_request(struct request_queue *q) | |||
2801 | goto startio; | 2801 | goto startio; |
2802 | 2802 | ||
2803 | queue: | 2803 | queue: |
2804 | creq = elv_next_request(q); | 2804 | creq = blk_peek_request(q); |
2805 | if (!creq) | 2805 | if (!creq) |
2806 | goto startio; | 2806 | goto startio; |
2807 | 2807 | ||
@@ -2810,7 +2810,7 @@ static void do_cciss_request(struct request_queue *q) | |||
2810 | if ((c = cmd_alloc(h, 1)) == NULL) | 2810 | if ((c = cmd_alloc(h, 1)) == NULL) |
2811 | goto full; | 2811 | goto full; |
2812 | 2812 | ||
2813 | blkdev_dequeue_request(creq); | 2813 | blk_start_request(creq); |
2814 | 2814 | ||
2815 | spin_unlock_irq(q->queue_lock); | 2815 | spin_unlock_irq(q->queue_lock); |
2816 | 2816 | ||
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index a5caeff4718e..a02dcfc00f13 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -903,7 +903,7 @@ static void do_ida_request(struct request_queue *q) | |||
903 | goto startio; | 903 | goto startio; |
904 | 904 | ||
905 | queue_next: | 905 | queue_next: |
906 | creq = elv_next_request(q); | 906 | creq = blk_peek_request(q); |
907 | if (!creq) | 907 | if (!creq) |
908 | goto startio; | 908 | goto startio; |
909 | 909 | ||
@@ -912,7 +912,7 @@ queue_next: | |||
912 | if ((c = cmd_alloc(h,1)) == NULL) | 912 | if ((c = cmd_alloc(h,1)) == NULL) |
913 | goto startio; | 913 | goto startio; |
914 | 914 | ||
915 | blkdev_dequeue_request(creq); | 915 | blk_start_request(creq); |
916 | 916 | ||
917 | c->ctlr = h->ctlr; | 917 | c->ctlr = h->ctlr; |
918 | c->hdr.unit = (drv_info_t *)(creq->rq_disk->private_data) - h->drv; | 918 | c->hdr.unit = (drv_info_t *)(creq->rq_disk->private_data) - h->drv; |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index e2c70d2085ae..90877fee0ee0 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -931,7 +931,7 @@ static inline void unlock_fdc(void) | |||
931 | del_timer(&fd_timeout); | 931 | del_timer(&fd_timeout); |
932 | cont = NULL; | 932 | cont = NULL; |
933 | clear_bit(0, &fdc_busy); | 933 | clear_bit(0, &fdc_busy); |
934 | if (current_req || elv_next_request(floppy_queue)) | 934 | if (current_req || blk_peek_request(floppy_queue)) |
935 | do_fd_request(floppy_queue); | 935 | do_fd_request(floppy_queue); |
936 | spin_unlock_irqrestore(&floppy_lock, flags); | 936 | spin_unlock_irqrestore(&floppy_lock, flags); |
937 | wake_up(&fdc_wait); | 937 | wake_up(&fdc_wait); |
@@ -2912,9 +2912,7 @@ static void redo_fd_request(void) | |||
2912 | struct request *req; | 2912 | struct request *req; |
2913 | 2913 | ||
2914 | spin_lock_irq(floppy_queue->queue_lock); | 2914 | spin_lock_irq(floppy_queue->queue_lock); |
2915 | req = elv_next_request(floppy_queue); | 2915 | req = blk_fetch_request(floppy_queue); |
2916 | if (req) | ||
2917 | blkdev_dequeue_request(req); | ||
2918 | spin_unlock_irq(floppy_queue->queue_lock); | 2916 | spin_unlock_irq(floppy_queue->queue_lock); |
2919 | if (!req) { | 2917 | if (!req) { |
2920 | do_floppy = NULL; | 2918 | do_floppy = NULL; |
diff --git a/drivers/block/hd.c b/drivers/block/hd.c index 288ab63c1029..961de56d00a9 100644 --- a/drivers/block/hd.c +++ b/drivers/block/hd.c | |||
@@ -592,12 +592,11 @@ repeat: | |||
592 | del_timer(&device_timer); | 592 | del_timer(&device_timer); |
593 | 593 | ||
594 | if (!hd_req) { | 594 | if (!hd_req) { |
595 | hd_req = elv_next_request(hd_queue); | 595 | hd_req = blk_fetch_request(hd_queue); |
596 | if (!hd_req) { | 596 | if (!hd_req) { |
597 | do_hd = NULL; | 597 | do_hd = NULL; |
598 | return; | 598 | return; |
599 | } | 599 | } |
600 | blkdev_dequeue_request(hd_req); | ||
601 | } | 600 | } |
602 | req = hd_req; | 601 | req = hd_req; |
603 | 602 | ||
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index 1ca5d1423fa3..c0cd0a03f698 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c | |||
@@ -671,10 +671,8 @@ static void mg_request_poll(struct request_queue *q) | |||
671 | 671 | ||
672 | while (1) { | 672 | while (1) { |
673 | if (!host->req) { | 673 | if (!host->req) { |
674 | host->req = elv_next_request(q); | 674 | host->req = blk_fetch_request(q); |
675 | if (host->req) | 675 | if (!host->req) |
676 | blkdev_dequeue_request(host->req); | ||
677 | else | ||
678 | break; | 676 | break; |
679 | } | 677 | } |
680 | 678 | ||
@@ -744,10 +742,8 @@ static void mg_request(struct request_queue *q) | |||
744 | 742 | ||
745 | while (1) { | 743 | while (1) { |
746 | if (!host->req) { | 744 | if (!host->req) { |
747 | host->req = elv_next_request(q); | 745 | host->req = blk_fetch_request(q); |
748 | if (host->req) | 746 | if (!host->req) |
749 | blkdev_dequeue_request(host->req); | ||
750 | else | ||
751 | break; | 747 | break; |
752 | } | 748 | } |
753 | req = host->req; | 749 | req = host->req; |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index fad167de23b4..5d23ffad7c77 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -533,11 +533,9 @@ static void do_nbd_request(struct request_queue *q) | |||
533 | { | 533 | { |
534 | struct request *req; | 534 | struct request *req; |
535 | 535 | ||
536 | while ((req = elv_next_request(q)) != NULL) { | 536 | while ((req = blk_fetch_request(q)) != NULL) { |
537 | struct nbd_device *lo; | 537 | struct nbd_device *lo; |
538 | 538 | ||
539 | blkdev_dequeue_request(req); | ||
540 | |||
541 | spin_unlock_irq(q->queue_lock); | 539 | spin_unlock_irq(q->queue_lock); |
542 | 540 | ||
543 | dprintk(DBG_BLKDEV, "%s: request %p: dequeued (flags=%x)\n", | 541 | dprintk(DBG_BLKDEV, "%s: request %p: dequeued (flags=%x)\n", |
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index 425f81586a31..911dfd98d813 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
@@ -720,10 +720,9 @@ static void do_pcd_request(struct request_queue * q) | |||
720 | return; | 720 | return; |
721 | while (1) { | 721 | while (1) { |
722 | if (!pcd_req) { | 722 | if (!pcd_req) { |
723 | pcd_req = elv_next_request(q); | 723 | pcd_req = blk_fetch_request(q); |
724 | if (!pcd_req) | 724 | if (!pcd_req) |
725 | return; | 725 | return; |
726 | blkdev_dequeue_request(pcd_req); | ||
727 | } | 726 | } |
728 | 727 | ||
729 | if (rq_data_dir(pcd_req) == READ) { | 728 | if (rq_data_dir(pcd_req) == READ) { |
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index d2ca3f552061..bf5955b3d873 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c | |||
@@ -412,11 +412,9 @@ static void run_fsm(void) | |||
412 | spin_lock_irqsave(&pd_lock, saved_flags); | 412 | spin_lock_irqsave(&pd_lock, saved_flags); |
413 | if (!__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 = blk_fetch_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 | } |
421 | spin_unlock_irqrestore(&pd_lock, saved_flags); | 419 | spin_unlock_irqrestore(&pd_lock, saved_flags); |
422 | if (stop) | 420 | if (stop) |
@@ -706,10 +704,9 @@ static void do_pd_request(struct request_queue * q) | |||
706 | { | 704 | { |
707 | if (pd_req) | 705 | if (pd_req) |
708 | return; | 706 | return; |
709 | pd_req = elv_next_request(q); | 707 | pd_req = blk_fetch_request(q); |
710 | if (!pd_req) | 708 | if (!pd_req) |
711 | return; | 709 | return; |
712 | blkdev_dequeue_request(pd_req); | ||
713 | 710 | ||
714 | schedule_fsm(); | 711 | schedule_fsm(); |
715 | } | 712 | } |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index d6f7bd84ed39..68a90834e993 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -762,10 +762,9 @@ static void do_pf_request(struct request_queue * q) | |||
762 | return; | 762 | return; |
763 | repeat: | 763 | repeat: |
764 | if (!pf_req) { | 764 | if (!pf_req) { |
765 | pf_req = elv_next_request(q); | 765 | pf_req = blk_fetch_request(q); |
766 | if (!pf_req) | 766 | if (!pf_req) |
767 | return; | 767 | return; |
768 | blkdev_dequeue_request(pf_req); | ||
769 | } | 768 | } |
770 | 769 | ||
771 | pf_current = pf_req->rq_disk->private_data; | 770 | pf_current = pf_req->rq_disk->private_data; |
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index f4d8db944e7d..338cee4cc0ba 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c | |||
@@ -194,9 +194,7 @@ static void ps3disk_do_request(struct ps3_storage_device *dev, | |||
194 | 194 | ||
195 | dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__); | 195 | dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__); |
196 | 196 | ||
197 | while ((req = elv_next_request(q))) { | 197 | while ((req = blk_fetch_request(q))) { |
198 | blkdev_dequeue_request(req); | ||
199 | |||
200 | if (blk_fs_request(req)) { | 198 | if (blk_fs_request(req)) { |
201 | if (ps3disk_submit_request_sg(dev, req)) | 199 | if (ps3disk_submit_request_sg(dev, req)) |
202 | break; | 200 | break; |
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c index 9f351bfa15ea..cbfd9c0aef03 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c | |||
@@ -441,12 +441,11 @@ out: | |||
441 | static void do_vdc_request(struct request_queue *q) | 441 | static void do_vdc_request(struct request_queue *q) |
442 | { | 442 | { |
443 | while (1) { | 443 | while (1) { |
444 | struct request *req = elv_next_request(q); | 444 | struct request *req = blk_fetch_request(q); |
445 | 445 | ||
446 | if (!req) | 446 | if (!req) |
447 | break; | 447 | break; |
448 | 448 | ||
449 | blkdev_dequeue_request(req); | ||
450 | if (__send_request(req) < 0) | 449 | if (__send_request(req) < 0) |
451 | __blk_end_request_all(req, -EIO); | 450 | __blk_end_request_all(req, -EIO); |
452 | } | 451 | } |
diff --git a/drivers/block/swim.c b/drivers/block/swim.c index dedd4893f5ea..cf7877fb8a7d 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c | |||
@@ -528,10 +528,7 @@ static void redo_fd_request(struct request_queue *q) | |||
528 | struct request *req; | 528 | struct request *req; |
529 | struct floppy_state *fs; | 529 | struct floppy_state *fs; |
530 | 530 | ||
531 | req = elv_next_request(q); | 531 | req = blk_fetch_request(q); |
532 | if (req) | ||
533 | blkdev_dequeue_request(req); | ||
534 | |||
535 | while (req) { | 532 | while (req) { |
536 | int err = -EIO; | 533 | int err = -EIO; |
537 | 534 | ||
@@ -554,11 +551,8 @@ static void redo_fd_request(struct request_queue *q) | |||
554 | break; | 551 | break; |
555 | } | 552 | } |
556 | done: | 553 | done: |
557 | if (!__blk_end_request_cur(req, err)) { | 554 | if (!__blk_end_request_cur(req, err)) |
558 | req = elv_next_request(q); | 555 | req = blk_fetch_request(q); |
559 | if (req) | ||
560 | blkdev_dequeue_request(req); | ||
561 | } | ||
562 | } | 556 | } |
563 | } | 557 | } |
564 | 558 | ||
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index f48c6dd47e04..80df93e3cdd0 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
@@ -326,10 +326,9 @@ static void start_request(struct floppy_state *fs) | |||
326 | } | 326 | } |
327 | while (fs->state == idle) { | 327 | while (fs->state == idle) { |
328 | if (!fd_req) { | 328 | if (!fd_req) { |
329 | fd_req = elv_next_request(swim3_queue); | 329 | fd_req = blk_fetch_request(swim3_queue); |
330 | if (!fd_req) | 330 | if (!fd_req) |
331 | break; | 331 | break; |
332 | blkdev_dequeue_request(fd_req); | ||
333 | } | 332 | } |
334 | req = fd_req; | 333 | req = fd_req; |
335 | #if 0 | 334 | #if 0 |
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index 087c94c8b2da..da403b6a7f43 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c | |||
@@ -810,12 +810,10 @@ static void carm_oob_rq_fn(struct request_queue *q) | |||
810 | 810 | ||
811 | while (1) { | 811 | while (1) { |
812 | DPRINTK("get req\n"); | 812 | DPRINTK("get req\n"); |
813 | rq = elv_next_request(q); | 813 | rq = blk_fetch_request(q); |
814 | if (!rq) | 814 | if (!rq) |
815 | break; | 815 | break; |
816 | 816 | ||
817 | blkdev_dequeue_request(rq); | ||
818 | |||
819 | crq = rq->special; | 817 | crq = rq->special; |
820 | assert(crq != NULL); | 818 | assert(crq != NULL); |
821 | assert(crq->rq == rq); | 819 | assert(crq->rq == rq); |
@@ -846,7 +844,7 @@ static void carm_rq_fn(struct request_queue *q) | |||
846 | 844 | ||
847 | queue_one_request: | 845 | queue_one_request: |
848 | VPRINTK("get req\n"); | 846 | VPRINTK("get req\n"); |
849 | rq = elv_next_request(q); | 847 | rq = blk_peek_request(q); |
850 | if (!rq) | 848 | if (!rq) |
851 | return; | 849 | return; |
852 | 850 | ||
@@ -857,7 +855,7 @@ queue_one_request: | |||
857 | } | 855 | } |
858 | crq->rq = rq; | 856 | crq->rq = rq; |
859 | 857 | ||
860 | blkdev_dequeue_request(rq); | 858 | blk_start_request(rq); |
861 | 859 | ||
862 | if (rq_data_dir(rq) == WRITE) { | 860 | if (rq_data_dir(rq) == WRITE) { |
863 | writing = 1; | 861 | writing = 1; |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 40d03cf63f2e..178f459a50ed 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -627,7 +627,7 @@ static void ub_request_fn(struct request_queue *q) | |||
627 | struct ub_lun *lun = q->queuedata; | 627 | struct ub_lun *lun = q->queuedata; |
628 | struct request *rq; | 628 | struct request *rq; |
629 | 629 | ||
630 | while ((rq = elv_next_request(q)) != NULL) { | 630 | while ((rq = blk_peek_request(q)) != NULL) { |
631 | if (ub_request_fn_1(lun, rq) != 0) { | 631 | if (ub_request_fn_1(lun, rq) != 0) { |
632 | blk_stop_queue(q); | 632 | blk_stop_queue(q); |
633 | break; | 633 | break; |
@@ -643,13 +643,13 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq) | |||
643 | int n_elem; | 643 | int n_elem; |
644 | 644 | ||
645 | if (atomic_read(&sc->poison)) { | 645 | if (atomic_read(&sc->poison)) { |
646 | blkdev_dequeue_request(rq); | 646 | blk_start_request(rq); |
647 | ub_end_rq(rq, DID_NO_CONNECT << 16, blk_rq_bytes(rq)); | 647 | ub_end_rq(rq, DID_NO_CONNECT << 16, blk_rq_bytes(rq)); |
648 | return 0; | 648 | return 0; |
649 | } | 649 | } |
650 | 650 | ||
651 | if (lun->changed && !blk_pc_request(rq)) { | 651 | if (lun->changed && !blk_pc_request(rq)) { |
652 | blkdev_dequeue_request(rq); | 652 | blk_start_request(rq); |
653 | ub_end_rq(rq, SAM_STAT_CHECK_CONDITION, blk_rq_bytes(rq)); | 653 | ub_end_rq(rq, SAM_STAT_CHECK_CONDITION, blk_rq_bytes(rq)); |
654 | return 0; | 654 | return 0; |
655 | } | 655 | } |
@@ -660,7 +660,7 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq) | |||
660 | return -1; | 660 | return -1; |
661 | memset(cmd, 0, sizeof(struct ub_scsi_cmd)); | 661 | memset(cmd, 0, sizeof(struct ub_scsi_cmd)); |
662 | 662 | ||
663 | blkdev_dequeue_request(rq); | 663 | blk_start_request(rq); |
664 | 664 | ||
665 | urq = &lun->urq; | 665 | urq = &lun->urq; |
666 | memset(urq, 0, sizeof(struct ub_request)); | 666 | memset(urq, 0, sizeof(struct ub_request)); |
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index 2086cb12d3ec..390d69bb7c48 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -361,11 +361,9 @@ static void do_viodasd_request(struct request_queue *q) | |||
361 | * back later. | 361 | * back later. |
362 | */ | 362 | */ |
363 | while (num_req_outstanding < VIOMAXREQ) { | 363 | while (num_req_outstanding < VIOMAXREQ) { |
364 | req = elv_next_request(q); | 364 | req = blk_fetch_request(q); |
365 | if (req == NULL) | 365 | if (req == NULL) |
366 | return; | 366 | return; |
367 | /* dequeue the current request from the queue */ | ||
368 | blkdev_dequeue_request(req); | ||
369 | /* check that request contains a valid command */ | 367 | /* check that request contains a valid command */ |
370 | if (!blk_fs_request(req)) { | 368 | if (!blk_fs_request(req)) { |
371 | viodasd_end_request(req, -EIO, blk_rq_sectors(req)); | 369 | viodasd_end_request(req, -EIO, blk_rq_sectors(req)); |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 1980ab456356..29a9daf48621 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -128,7 +128,7 @@ static void do_virtblk_request(struct request_queue *q) | |||
128 | struct request *req; | 128 | struct request *req; |
129 | unsigned int issued = 0; | 129 | unsigned int issued = 0; |
130 | 130 | ||
131 | while ((req = elv_next_request(q)) != NULL) { | 131 | while ((req = blk_peek_request(q)) != NULL) { |
132 | vblk = req->rq_disk->private_data; | 132 | vblk = req->rq_disk->private_data; |
133 | BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems); | 133 | BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems); |
134 | 134 | ||
@@ -138,7 +138,7 @@ static void do_virtblk_request(struct request_queue *q) | |||
138 | blk_stop_queue(q); | 138 | blk_stop_queue(q); |
139 | break; | 139 | break; |
140 | } | 140 | } |
141 | blkdev_dequeue_request(req); | 141 | blk_start_request(req); |
142 | issued++; | 142 | issued++; |
143 | } | 143 | } |
144 | 144 | ||
diff --git a/drivers/block/xd.c b/drivers/block/xd.c index d4c4352354b5..ce2429219925 100644 --- a/drivers/block/xd.c +++ b/drivers/block/xd.c | |||
@@ -305,10 +305,7 @@ static void do_xd_request (struct request_queue * q) | |||
305 | if (xdc_busy) | 305 | if (xdc_busy) |
306 | return; | 306 | return; |
307 | 307 | ||
308 | req = elv_next_request(q); | 308 | req = blk_fetch_request(q); |
309 | if (req) | ||
310 | blkdev_dequeue_request(req); | ||
311 | |||
312 | while (req) { | 309 | while (req) { |
313 | unsigned block = blk_rq_pos(req); | 310 | unsigned block = blk_rq_pos(req); |
314 | unsigned count = blk_rq_cur_sectors(req); | 311 | unsigned count = blk_rq_cur_sectors(req); |
@@ -325,11 +322,8 @@ static void do_xd_request (struct request_queue * q) | |||
325 | block, count); | 322 | block, count); |
326 | done: | 323 | done: |
327 | /* wrap up, 0 = success, -errno = fail */ | 324 | /* wrap up, 0 = success, -errno = fail */ |
328 | if (!__blk_end_request_cur(req, res)) { | 325 | if (!__blk_end_request_cur(req, res)) |
329 | req = elv_next_request(q); | 326 | req = blk_fetch_request(q); |
330 | if (req) | ||
331 | blkdev_dequeue_request(req); | ||
332 | } | ||
333 | } | 327 | } |
334 | } | 328 | } |
335 | 329 | ||
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 66f834571b88..6d4ac76c2806 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -299,13 +299,13 @@ static void do_blkif_request(struct request_queue *rq) | |||
299 | 299 | ||
300 | queued = 0; | 300 | queued = 0; |
301 | 301 | ||
302 | while ((req = elv_next_request(rq)) != NULL) { | 302 | while ((req = blk_peek_request(rq)) != NULL) { |
303 | info = req->rq_disk->private_data; | 303 | info = req->rq_disk->private_data; |
304 | 304 | ||
305 | if (RING_FULL(&info->ring)) | 305 | if (RING_FULL(&info->ring)) |
306 | goto wait; | 306 | goto wait; |
307 | 307 | ||
308 | blkdev_dequeue_request(req); | 308 | blk_start_request(req); |
309 | 309 | ||
310 | if (!blk_fs_request(req)) { | 310 | if (!blk_fs_request(req)) { |
311 | __blk_end_request_all(req, -EIO); | 311 | __blk_end_request_all(req, -EIO); |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index edf137b6c379..3a4397edab71 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -463,10 +463,10 @@ struct request *ace_get_next_request(struct request_queue * q) | |||
463 | { | 463 | { |
464 | struct request *req; | 464 | struct request *req; |
465 | 465 | ||
466 | while ((req = elv_next_request(q)) != NULL) { | 466 | while ((req = blk_peek_request(q)) != NULL) { |
467 | if (blk_fs_request(req)) | 467 | if (blk_fs_request(req)) |
468 | break; | 468 | break; |
469 | blkdev_dequeue_request(req); | 469 | blk_start_request(req); |
470 | __blk_end_request_all(req, -EIO); | 470 | __blk_end_request_all(req, -EIO); |
471 | } | 471 | } |
472 | return req; | 472 | return req; |
@@ -498,10 +498,8 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
498 | __blk_end_request_all(ace->req, -EIO); | 498 | __blk_end_request_all(ace->req, -EIO); |
499 | ace->req = NULL; | 499 | ace->req = NULL; |
500 | } | 500 | } |
501 | while ((req = elv_next_request(ace->queue)) != NULL) { | 501 | while ((req = blk_fetch_request(ace->queue)) != NULL) |
502 | blkdev_dequeue_request(req); | ||
503 | __blk_end_request_all(req, -EIO); | 502 | __blk_end_request_all(req, -EIO); |
504 | } | ||
505 | 503 | ||
506 | /* Drop back to IDLE state and notify waiters */ | 504 | /* Drop back to IDLE state and notify waiters */ |
507 | ace->fsm_state = ACE_FSM_STATE_IDLE; | 505 | ace->fsm_state = ACE_FSM_STATE_IDLE; |
@@ -649,7 +647,7 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
649 | ace->fsm_state = ACE_FSM_STATE_IDLE; | 647 | ace->fsm_state = ACE_FSM_STATE_IDLE; |
650 | break; | 648 | break; |
651 | } | 649 | } |
652 | blkdev_dequeue_request(req); | 650 | blk_start_request(req); |
653 | 651 | ||
654 | /* Okay, it's a data request, set it up for transfer */ | 652 | /* Okay, it's a data request, set it up for transfer */ |
655 | dev_dbg(ace->dev, | 653 | dev_dbg(ace->dev, |
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index c909c1a3f650..4575171e5beb 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c | |||
@@ -71,10 +71,7 @@ static void do_z2_request(struct request_queue *q) | |||
71 | { | 71 | { |
72 | struct request *req; | 72 | struct request *req; |
73 | 73 | ||
74 | req = elv_next_request(q); | 74 | req = blk_fetch_request(q); |
75 | if (req) | ||
76 | blkdev_dequeue_request(req); | ||
77 | |||
78 | while (req) { | 75 | while (req) { |
79 | unsigned long start = blk_rq_pos(req) << 9; | 76 | unsigned long start = blk_rq_pos(req) << 9; |
80 | unsigned long len = blk_rq_cur_bytes(req); | 77 | unsigned long len = blk_rq_cur_bytes(req); |
@@ -100,11 +97,8 @@ static void do_z2_request(struct request_queue *q) | |||
100 | len -= size; | 97 | len -= size; |
101 | } | 98 | } |
102 | done: | 99 | done: |
103 | if (!__blk_end_request_cur(req, err)) { | 100 | if (!__blk_end_request_cur(req, err)) |
104 | req = elv_next_request(q); | 101 | req = blk_fetch_request(q); |
105 | if (req) | ||
106 | blkdev_dequeue_request(req); | ||
107 | } | ||
108 | } | 102 | } |
109 | } | 103 | } |
110 | 104 | ||