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/scsi | |
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/scsi')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 10 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_sas.c | 4 |
2 files changed, 6 insertions, 8 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ee308f6f7982..b12750f82169 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1207,7 +1207,7 @@ int scsi_prep_return(struct request_queue *q, struct request *req, int ret) | |||
1207 | break; | 1207 | break; |
1208 | case BLKPREP_DEFER: | 1208 | case BLKPREP_DEFER: |
1209 | /* | 1209 | /* |
1210 | * If we defer, the elv_next_request() returns NULL, but the | 1210 | * If we defer, the blk_peek_request() returns NULL, but the |
1211 | * queue must be restarted, so we plug here if no returning | 1211 | * queue must be restarted, so we plug here if no returning |
1212 | * command will automatically do that. | 1212 | * command will automatically do that. |
1213 | */ | 1213 | */ |
@@ -1385,7 +1385,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q) | |||
1385 | struct scsi_target *starget = scsi_target(sdev); | 1385 | struct scsi_target *starget = scsi_target(sdev); |
1386 | struct Scsi_Host *shost = sdev->host; | 1386 | struct Scsi_Host *shost = sdev->host; |
1387 | 1387 | ||
1388 | blkdev_dequeue_request(req); | 1388 | blk_start_request(req); |
1389 | 1389 | ||
1390 | if (unlikely(cmd == NULL)) { | 1390 | if (unlikely(cmd == NULL)) { |
1391 | printk(KERN_CRIT "impossible request in %s.\n", | 1391 | printk(KERN_CRIT "impossible request in %s.\n", |
@@ -1477,7 +1477,7 @@ static void scsi_request_fn(struct request_queue *q) | |||
1477 | 1477 | ||
1478 | if (!sdev) { | 1478 | if (!sdev) { |
1479 | printk("scsi: killing requests for dead queue\n"); | 1479 | printk("scsi: killing requests for dead queue\n"); |
1480 | while ((req = elv_next_request(q)) != NULL) | 1480 | while ((req = blk_peek_request(q)) != NULL) |
1481 | scsi_kill_request(req, q); | 1481 | scsi_kill_request(req, q); |
1482 | return; | 1482 | return; |
1483 | } | 1483 | } |
@@ -1498,7 +1498,7 @@ static void scsi_request_fn(struct request_queue *q) | |||
1498 | * that the request is fully prepared even if we cannot | 1498 | * that the request is fully prepared even if we cannot |
1499 | * accept it. | 1499 | * accept it. |
1500 | */ | 1500 | */ |
1501 | req = elv_next_request(q); | 1501 | req = blk_peek_request(q); |
1502 | if (!req || !scsi_dev_queue_ready(q, sdev)) | 1502 | if (!req || !scsi_dev_queue_ready(q, sdev)) |
1503 | break; | 1503 | break; |
1504 | 1504 | ||
@@ -1514,7 +1514,7 @@ static void scsi_request_fn(struct request_queue *q) | |||
1514 | * Remove the request from the request list. | 1514 | * Remove the request from the request list. |
1515 | */ | 1515 | */ |
1516 | if (!(blk_queue_tagged(q) && !blk_queue_start_tag(q, req))) | 1516 | if (!(blk_queue_tagged(q) && !blk_queue_start_tag(q, req))) |
1517 | blkdev_dequeue_request(req); | 1517 | blk_start_request(req); |
1518 | sdev->device_busy++; | 1518 | sdev->device_busy++; |
1519 | 1519 | ||
1520 | spin_unlock(q->queue_lock); | 1520 | spin_unlock(q->queue_lock); |
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 50988cbf7b2d..d606452297cf 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -163,12 +163,10 @@ static void sas_smp_request(struct request_queue *q, struct Scsi_Host *shost, | |||
163 | int (*handler)(struct Scsi_Host *, struct sas_rphy *, struct request *); | 163 | int (*handler)(struct Scsi_Host *, struct sas_rphy *, struct request *); |
164 | 164 | ||
165 | while (!blk_queue_plugged(q)) { | 165 | while (!blk_queue_plugged(q)) { |
166 | req = elv_next_request(q); | 166 | req = blk_fetch_request(q); |
167 | if (!req) | 167 | if (!req) |
168 | break; | 168 | break; |
169 | 169 | ||
170 | blkdev_dequeue_request(req); | ||
171 | |||
172 | spin_unlock_irq(q->queue_lock); | 170 | spin_unlock_irq(q->queue_lock); |
173 | 171 | ||
174 | handler = to_sas_internal(shost->transportt)->f->smp_handler; | 172 | handler = to_sas_internal(shost->transportt)->f->smp_handler; |