virtio_blk: stop using q->prepare_flush_fn
use REQ_FLUSH flag instead. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
This commit is contained in:
parent
144d6ed551
commit
dd40e456a4
|
@ -99,6 +99,12 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
vbr->req = req;
|
vbr->req = req;
|
||||||
|
|
||||||
|
if (req->cmd_flags & REQ_FLUSH) {
|
||||||
|
vbr->out_hdr.type = VIRTIO_BLK_T_FLUSH;
|
||||||
|
vbr->out_hdr.sector = 0;
|
||||||
|
vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
|
||||||
|
} else {
|
||||||
switch (req->cmd_type) {
|
switch (req->cmd_type) {
|
||||||
case REQ_TYPE_FS:
|
case REQ_TYPE_FS:
|
||||||
vbr->out_hdr.type = 0;
|
vbr->out_hdr.type = 0;
|
||||||
|
@ -115,18 +121,11 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
|
||||||
vbr->out_hdr.sector = 0;
|
vbr->out_hdr.sector = 0;
|
||||||
vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
|
vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
|
||||||
break;
|
break;
|
||||||
case REQ_TYPE_LINUX_BLOCK:
|
|
||||||
if (req->cmd[0] == REQ_LB_OP_FLUSH) {
|
|
||||||
vbr->out_hdr.type = VIRTIO_BLK_T_FLUSH;
|
|
||||||
vbr->out_hdr.sector = 0;
|
|
||||||
vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/*FALLTHRU*/
|
|
||||||
default:
|
default:
|
||||||
/* We don't put anything else in the queue. */
|
/* We don't put anything else in the queue. */
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (vbr->req->cmd_flags & REQ_HARDBARRIER)
|
if (vbr->req->cmd_flags & REQ_HARDBARRIER)
|
||||||
vbr->out_hdr.type |= VIRTIO_BLK_T_BARRIER;
|
vbr->out_hdr.type |= VIRTIO_BLK_T_BARRIER;
|
||||||
|
@ -195,12 +194,6 @@ static void do_virtblk_request(struct request_queue *q)
|
||||||
virtqueue_kick(vblk->vq);
|
virtqueue_kick(vblk->vq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtblk_prepare_flush(struct request_queue *q, struct request *req)
|
|
||||||
{
|
|
||||||
req->cmd_type = REQ_TYPE_LINUX_BLOCK;
|
|
||||||
req->cmd[0] = REQ_LB_OP_FLUSH;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* return id (s/n) string for *disk to *id_str
|
/* return id (s/n) string for *disk to *id_str
|
||||||
*/
|
*/
|
||||||
static int virtblk_get_id(struct gendisk *disk, char *id_str)
|
static int virtblk_get_id(struct gendisk *disk, char *id_str)
|
||||||
|
@ -373,8 +366,7 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
|
||||||
|
|
||||||
/* If barriers are supported, tell block layer that queue is ordered */
|
/* If barriers are supported, tell block layer that queue is ordered */
|
||||||
if (virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH))
|
if (virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH))
|
||||||
blk_queue_ordered(q, QUEUE_ORDERED_DRAIN_FLUSH,
|
blk_queue_ordered(q, QUEUE_ORDERED_DRAIN_FLUSH, NULL);
|
||||||
virtblk_prepare_flush);
|
|
||||||
else if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER))
|
else if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER))
|
||||||
blk_queue_ordered(q, QUEUE_ORDERED_TAG, NULL);
|
blk_queue_ordered(q, QUEUE_ORDERED_TAG, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue