[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v9.5 07/13] fixup! qcow2: Discard/zero clusters by b

From: Eric Blake
Subject: [Qemu-devel] [PATCH v9.5 07/13] fixup! qcow2: Discard/zero clusters by byte count
Date: Tue, 11 Apr 2017 17:15:55 -0500

Squash this to keep iotest 154 happy.

Signed-off-by: Eric Blake <address@hidden>

v9.5: fixup
v9: rebase to earlier changes, drop R-b
v7, v8: only earlier half of series submitted for 2.9
v6: rebase due to context
v5: s/count/byte/ to make the units obvious, and rework the math
to ensure no 32-bit integer overflow on large clusters
v4: improve function names, split assertion additions into earlier patch
[no v3 or v2]
v1: https://lists.gnu.org/archive/html/qemu-devel/2016-12/msg00339.html
 block/qcow2-cluster.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 595e6e3..bc59cb8 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1597,18 +1597,15 @@ int qcow2_cluster_zeroize(BlockDriverState *bs, 
uint64_t offset,
                           uint64_t bytes, int flags)
     BDRVQcow2State *s = bs->opaque;
-    uint64_t end_offset;
+    uint64_t end_offset = offset + bytes;
     uint64_t nb_clusters;
     int64_t cleared;
     int ret;

-    end_offset = offset + bytes;
     /* Caller must pass aligned values, except at image end */
     assert(QEMU_IS_ALIGNED(offset, s->cluster_size));
     assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) ||
            end_offset == bs->total_sectors << BDRV_SECTOR_BITS);
-    assert(QEMU_IS_ALIGNED(bytes, s->cluster_size));

     /* The zero flag is only supported by version 3 and newer; we
      * require the use of that flag if there is a backing file or if

reply via email to

[Prev in Thread] Current Thread [Next in Thread]