mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] block: change virtio_blk to use blk-end-request
@ 2008-01-11 21:50 Kiyoshi Ueda
  0 siblings, 0 replies; only message in thread
From: Kiyoshi Ueda @ 2008-01-11 21:50 UTC (permalink / raw)
  To: jens.axboe; +Cc: rusty, linux-kernel, j-nomura, k-ueda

This patch converts virtio_blk to use __blk_end_request() directly
so that end_{queued|dequeued}_request() can be removed.
Related 'uptodate' argument is converted to 'error'.

__blk_end_request() takes care of dequeueing request like below:

	if (!list_empty(&rq->queuelist))
		blkdev_dequeue_request(rq);

In the case of virtio_blk, blkdev_dequeue_request() has been done
in do_virtblk_request() and the queuelist is empty in blk_done().
So __blk_end_request() doesn't call blkdev_dequeue_request() and
the behavior of blk_done() doesn't change.

Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
---
 drivers/block/virtio_blk.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Index: 2.6.24-rc7/drivers/block/virtio_blk.c
===================================================================
--- 2.6.24-rc7.orig/drivers/block/virtio_blk.c
+++ 2.6.24-rc7/drivers/block/virtio_blk.c
@@ -45,20 +45,20 @@ static bool blk_done(struct virtqueue *v
 
 	spin_lock_irqsave(&vblk->lock, flags);
 	while ((vbr = vblk->vq->vq_ops->get_buf(vblk->vq, &len)) != NULL) {
-		int uptodate;
+		int error;
 		switch (vbr->in_hdr.status) {
 		case VIRTIO_BLK_S_OK:
-			uptodate = 1;
+			error = 0;
 			break;
 		case VIRTIO_BLK_S_UNSUPP:
-			uptodate = -ENOTTY;
+			error = -ENOTTY;
 			break;
 		default:
-			uptodate = 0;
+			error = -EIO;
 			break;
 		}
 
-		end_dequeued_request(vbr->req, uptodate);
+		__blk_end_request(vbr->req, error, blk_rq_bytes(vbr->req));
 		list_del(&vbr->list);
 		mempool_free(vbr, vblk->pool);
 	}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-11 21:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-11 21:50 [PATCH 1/3] block: change virtio_blk to use blk-end-request Kiyoshi Ueda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®