[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
--
2.9.3
- [Qemu-devel] [PATCH v9 02/13] iotests: Add test 179 to cover write zeroes with unmap, (continued)
- [Qemu-devel] [PATCH v9 02/13] iotests: Add test 179 to cover write zeroes with unmap, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 06/13] qcow2: Assert that cluster operations are aligned, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 09/13] blkdebug: Refactor error injection, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 03/13] qemu-io: Switch 'alloc' command to byte-based length, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 01/13] qcow2: Unallocate unmapped zero clusters if no backing file, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 05/13] qcow2: Optimize write zero of unaligned tail cluster, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 07/13] qcow2: Discard/zero clusters by byte count, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 08/13] blkdebug: Sanity check block layer guarantees, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 10/13] blkdebug: Add pass-through write_zero and discard support, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 12/13] blkdebug: Add ability to override unmap geometries, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 11/13] blkdebug: Simplify override logic, Eric Blake, 2017/04/10
- [Qemu-devel] [PATCH v9 13/13] tests: Add coverage for recent block geometry fixes, Eric Blake, 2017/04/10