[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/3] barriers: virtio
From: |
Christoph Hellwig |
Subject: |
[Qemu-devel] [PATCH 3/3] barriers: virtio |
Date: |
Tue, 5 May 2009 14:09:05 +0200 |
User-agent: |
Mutt/1.3.28i |
Advertise the barriers feature to virtio guests if the underlying device
supports it, and make sure to pass down the barrier flag on write requests
to the block layer.
Signed-off-by: Christoph Hellwig <address@hidden>
Index: qemu/hw/virtio-blk.c
===================================================================
--- qemu.orig/hw/virtio-blk.c 2009-05-05 13:21:24.196784347 +0200
+++ qemu/hw/virtio-blk.c 2009-05-05 13:31:33.654786861 +0200
@@ -211,8 +211,14 @@ static void virtio_blk_handle_scsi(VirtI
static void virtio_blk_handle_write(VirtIOBlockReq *req)
{
+
+ unsigned flags = 0;
+
+ if (req->out->type & VIRTIO_BLK_T_BARRIER)
+ flags |= BDRV_IO_BARRIER;
+
bdrv_aio_writev(req->dev->bs, req->out->sector, &req->qiov,
- req->qiov.size / 512, virtio_blk_rw_complete, req, 0);
+ req->qiov.size / 512, virtio_blk_rw_complete, req, flags);
}
static void virtio_blk_handle_read(VirtIOBlockReq *req)
@@ -304,6 +310,7 @@ static void virtio_blk_update_config(Vir
static uint32_t virtio_blk_get_features(VirtIODevice *vdev)
{
+ VirtIOBlock *s = to_virtio_blk(vdev);
uint32_t features = 0;
features |= (1 << VIRTIO_BLK_F_SEG_MAX);
@@ -312,6 +319,9 @@ static uint32_t virtio_blk_get_features(
features |= (1 << VIRTIO_BLK_F_SCSI);
#endif
+ if (s->bs->barrier_support)
+ features |= (1 << VIRTIO_BLK_F_BARRIER);
+
return features;
}
[Qemu-devel] [PATCH 2/3] barriers: block-raw-posix barrier support, Christoph Hellwig, 2009/05/05
[Qemu-devel] [PATCH 3/3] barriers: virtio,
Christoph Hellwig <=
Re: [Qemu-devel] [PATCH 0/3] write barrier support, Avi Kivity, 2009/05/05