[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 08/10] qcow2: Allow updating no refcounts
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH v2 08/10] qcow2: Allow updating no refcounts |
Date: |
Wed, 20 Jan 2010 15:03:05 +0100 |
There's absolutely no problem with updating the refcounts of 0 clusters.
At least snapshot code is doing this and would fail once the result of
update_refcount isn't ignored any more.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2-refcount.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index a84620f..da7d3f2 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -284,8 +284,12 @@ static int update_refcount(BlockDriverState *bs,
printf("update_refcount: offset=%" PRId64 " size=%" PRId64 " addend=%d\n",
offset, length, addend);
#endif
- if (length <= 0)
+ if (length < 0) {
return -EINVAL;
+ } else if (length == 0) {
+ return 0;
+ }
+
start = offset & ~(s->cluster_size - 1);
last = (offset + length - 1) & ~(s->cluster_size - 1);
for(cluster_offset = start; cluster_offset <= last;
--
1.6.5.2
- [Qemu-devel] [PATCH v2 00/10] qcow2 error path fixes, Kevin Wolf, 2010/01/20
- [Qemu-devel] [PATCH v2 01/10] qcow2: Fix error handling in qcow2_grow_l1_table, Kevin Wolf, 2010/01/20
- [Qemu-devel] [PATCH v2 02/10] qcow2: Fix error handling in qcow_save_vmstate, Kevin Wolf, 2010/01/20
- [Qemu-devel] [PATCH v2 03/10] qcow2: Return 0/-errno in get_cluster_table, Kevin Wolf, 2010/01/20
- [Qemu-devel] [PATCH v2 05/10] block: Return original error codes in bdrv_pread/write, Kevin Wolf, 2010/01/20
- [Qemu-devel] [PATCH v2 06/10] qcow2: Fix error handling in grow_refcount_table, Kevin Wolf, 2010/01/20
- [Qemu-devel] [PATCH v2 04/10] qcow2: Return 0/-errno in qcow2_alloc_cluster_offset, Kevin Wolf, 2010/01/20
- [Qemu-devel] [PATCH v2 07/10] qcow2: Improve error handling in update_refcount, Kevin Wolf, 2010/01/20
- [Qemu-devel] [PATCH v2 08/10] qcow2: Allow updating no refcounts,
Kevin Wolf <=
- [Qemu-devel] [PATCH v2 09/10] qcow2: Don't ignore update_refcount return value, Kevin Wolf, 2010/01/20
- [Qemu-devel] [PATCH v2 10/10] qcow2: Don't ignore qcow2_alloc_clusters return value, Kevin Wolf, 2010/01/20