[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/20] qcow2: Get rid of additional sync on COW
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 11/20] qcow2: Get rid of additional sync on COW |
Date: |
Tue, 21 Sep 2010 17:21:53 +0200 |
We always have a sync for the refcount update when a new cluster is
allocated. If we move this past the COW, we can save an additional sync.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2-cluster.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 818c0db..cb2e33f 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -415,7 +415,7 @@ static int copy_sectors(BlockDriverState *bs, uint64_t
start_sect,
&s->aes_encrypt_key);
}
BLKDBG_EVENT(bs->file, BLKDBG_COW_WRITE);
- ret = bdrv_write_sync(bs->file, (cluster_offset >> 9) + n_start,
+ ret = bdrv_write(bs->file, (cluster_offset >> 9) + n_start,
s->cluster_data, n);
if (ret < 0)
return ret;
@@ -714,6 +714,13 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs,
QCowL2Meta *m)
(i << s->cluster_bits)) | QCOW_OFLAG_COPIED);
}
+ /*
+ * Before we update the L2 table to actually point to the new cluster, we
+ * need to be sure that the refcounts have been increased and COW was
+ * handled.
+ */
+ bdrv_flush(bs->file);
+
ret = write_l2_entries(bs, l2_table, l2_offset, l2_index, m->nb_clusters);
if (ret < 0) {
qcow2_l2_cache_reset(bs);
@@ -865,7 +872,6 @@ int qcow2_alloc_cluster_offset(BlockDriverState *bs,
uint64_t offset,
QLIST_REMOVE(m, next_in_flight);
return cluster_offset;
}
- bdrv_flush(bs->file);
/* save info needed for meta data update */
m->offset = offset;
--
1.7.2.2
- [Qemu-devel] [PULL 00/20] Block patches, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 03/20] vvfat: Use cache=unsafe, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 01/20] vvfat: Fix segfault on write to read-only disk, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 02/20] vvfat: Fix double free for opening the image rw, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 05/20] raw-posix: handle > 512 byte alignment correctly, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 10/20] qcow2: Move sync out of qcow2_alloc_clusters, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 04/20] use qemu_blockalign consistently, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 11/20] qcow2: Get rid of additional sync on COW,
Kevin Wolf <=
- [Qemu-devel] [PATCH 13/20] scsi-disk: propagate the required alignment, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 07/20] nbd: correctly manage default port, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 08/20] qcow2: Move sync out of write_refcount_block_entries, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 16/20] qcow2: Avoid bounce buffers for AIO read requests, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 14/20] ide: propagate the required alignment, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 15/20] cutils: qemu_iovec_copy and qemu_iovec_memset, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 12/20] virtio-blk: propagate the required alignment, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 09/20] qcow2: Move sync out of update_refcount, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 18/20] scsi-generic: add missing reset handler, Kevin Wolf, 2010/09/21
- [Qemu-devel] [PATCH 06/20] Improve qemu-nbd performance by 4400 %, Kevin Wolf, 2010/09/21