[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 31/37] qcow2: flush refcount cache correctly in allo
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 31/37] qcow2: flush refcount cache correctly in alloc_refcount_block() |
Date: |
Tue, 2 Apr 2013 16:45:36 -0500 |
From: Stefan Hajnoczi <address@hidden>
update_refcount() affects the refcount cache, it does not write to disk.
Therefore bdrv_flush(bs->file) does nothing. We need to flush the
refcount cache in order to write out the refcount updates!
While we're here also add error returns when qcow2_cache_flush() fails.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
(cherry picked from commit 9991923b262dc35f6dd8393ab4853edd7fc3724f)
Signed-off-by: Michael Roth <address@hidden>
---
block/qcow2-refcount.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index bc1784c..6a7a230 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -201,7 +201,10 @@ static int alloc_refcount_block(BlockDriverState *bs,
*refcount_block = NULL;
/* We write to the refcount table, so we might depend on L2 tables */
- qcow2_cache_flush(bs, s->l2_table_cache);
+ ret = qcow2_cache_flush(bs, s->l2_table_cache);
+ if (ret < 0) {
+ return ret;
+ }
/* Allocate the refcount block itself and mark it as used */
int64_t new_block = alloc_clusters_noref(bs, s->cluster_size);
@@ -237,7 +240,10 @@ static int alloc_refcount_block(BlockDriverState *bs,
goto fail_block;
}
- bdrv_flush(bs->file);
+ ret = qcow2_cache_flush(bs, s->refcount_block_cache);
+ if (ret < 0) {
+ goto fail_block;
+ }
/* Initialize the new refcount block only after updating its refcount,
* update_refcount uses the refcount cache itself */
--
1.7.9.5
- [Qemu-devel] [PATCH 28/37] virtio-blk: fix unplug + virsh reboot, (continued)
- [Qemu-devel] [PATCH 28/37] virtio-blk: fix unplug + virsh reboot, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 35/37] linux-user: make bogus negative iovec lengths fail EINVAL, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 34/37] linux-user: fix futex strace of FUTEX_CLOCK_REALTIME, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 36/37] linux-user/syscall.c: Don't warn about unimplemented get_robust_list, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 37/37] update seabios to 1.7.2.1, Michael Roth, 2013/04/02
- Re: [Qemu-devel] Patch Round-up for stable 1.4.1, freeze next Tuesday, Eric Blake, 2013/04/02
- [Qemu-devel] [PATCH 31/37] qcow2: flush refcount cache correctly in alloc_refcount_block(),
Michael Roth <=
- [Qemu-devel] [PATCH 30/37] page_cache: fix memory leak, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 32/37] qcow2: flush refcount cache correctly in qcow2_write_snapshots(), Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 29/37] Fix page_cache leak in cache_resize, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 33/37] linux-user/syscall.c: handle FUTEX_WAIT_BITSET in do_futex, Michael Roth, 2013/04/02
- Re: [Qemu-devel] Patch Round-up for stable 1.4.1, freeze next Tuesday, Aurelien Jarno, 2013/04/03
- Re: [Qemu-devel] [Qemu-stable] Patch Round-up for stable 1.4.1, freeze next Tuesday, Bruce Rogers, 2013/04/03
- Re: [Qemu-devel] Patch Round-up for stable 1.4.1, freeze next Tuesday, Cole Robinson, 2013/04/03
- Re: [Qemu-devel] Patch Round-up for stable 1.4.1, freeze next Tuesday, Peter Lieven, 2013/04/04