[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 25/35] qcow2: Reduce is_zero() rounding
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 25/35] qcow2: Reduce is_zero() rounding |
Date: |
Thu, 26 Oct 2017 15:17:31 +0200 |
From: Eric Blake <address@hidden>
Now that bdrv_is_allocated accepts non-aligned inputs, we can
remove the TODO added in earlier refactoring.
Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 29d0a50955..fbf9464d3a 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2976,22 +2976,16 @@ static bool is_zero(BlockDriverState *bs, int64_t
offset, int64_t bytes)
{
int64_t nr;
int res;
- int64_t start;
-
- /* TODO: Widening to sector boundaries should only be needed as
- * long as we can't query finer granularity. */
- start = QEMU_ALIGN_DOWN(offset, BDRV_SECTOR_SIZE);
- bytes = QEMU_ALIGN_UP(offset + bytes, BDRV_SECTOR_SIZE) - start;
/* Clamp to image length, before checking status of underlying sectors */
- if (start + bytes > bs->total_sectors * BDRV_SECTOR_SIZE) {
- bytes = bs->total_sectors * BDRV_SECTOR_SIZE - start;
+ if (offset + bytes > bs->total_sectors * BDRV_SECTOR_SIZE) {
+ bytes = bs->total_sectors * BDRV_SECTOR_SIZE - offset;
}
if (!bytes) {
return true;
}
- res = bdrv_block_status_above(bs, NULL, start, bytes, &nr, NULL, NULL);
+ res = bdrv_block_status_above(bs, NULL, offset, bytes, &nr, NULL, NULL);
return res >= 0 && (res & BDRV_BLOCK_ZERO) && nr == bytes;
}
--
2.13.6
- [Qemu-block] [PULL 16/35] qemu-img: Speed up compare on pre-allocated larger file, (continued)
- [Qemu-block] [PULL 16/35] qemu-img: Speed up compare on pre-allocated larger file, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 17/35] qemu-img: Add find_nonzero(), Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 14/35] block: Convert bdrv_get_block_status_above() to bytes, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 18/35] qemu-img: Drop redundant error message in compare, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 19/35] qemu-img: Change check_empty_sectors() to byte-based, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 23/35] block: Align block status requests, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 24/35] block: Reduce bdrv_aligned_preadv() rounding, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 20/35] qemu-img: Change compare_sectors() to be byte-based, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 22/35] qemu-img: Change img_compare() to be byte-based, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 21/35] qemu-img: Change img_rebase() to be byte-based, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 25/35] qcow2: Reduce is_zero() rounding,
Kevin Wolf <=
- [Qemu-block] [PULL 27/35] qemu-img.1: Image invalidation on qemu-img commit, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 28/35] qcow2: Use BDRV_SECTOR_BITS instead of its literal value, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 26/35] qemu-io: Relax 'alloc' now that block-status doesn't assert, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 30/35] iotests: Pull _filter_actual_image_size from 67/87, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 31/35] iotests: Filter actual image size in 184 and 191, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 29/35] iotests: Add test for dataplane mirroring, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 32/35] qcow2: Emit errp when truncating the image tail, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 33/35] qcow2: Fix unaligned preallocated truncation, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 34/35] qcow2: Always execute preallocate() in a coroutine, Kevin Wolf, 2017/10/26
- [Qemu-block] [PULL 35/35] iotests: Add cluster_size=64k to 125, Kevin Wolf, 2017/10/26