[PATCH 2/3] Virtio draft IV: the block driver

Martin Peschke
Tue, 10 Jul 2007 05:12:14 -0000

Rusty Russell wrote:
> Hi Martin!
>
> 	I like this: moving the allocation into do_req() makes it even simpler:
>
> static void do_virtblk_request(request_queue_t *q)
> {
> 	struct virtio_blk *vblk = NULL;
> 	struct request *req;
> 	unsigned int issued = 0;
>
> 	while ((req = elv_next_request(q)) != NULL) {
> 		vblk = req->rq_disk->private_data;
> 		BUG_ON(req->nr_phys_segments > ARRAY_SIZE(vblk->sg));
>
> 		if (!do_req(q, vblk, req)) {
> 			/* Queue full?  Wait. */
> 			blk_stop_queue(q);
> 			break;
> 		}
> 		blkdev_dequeue_request(req);
> 		issued++;
> 	}
>
> 	if (issued)
> 		vblk->vq->ops->sync(vblk->vq);
> }

ACK ;)

Thanks,
Martin