[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 26/58] qcow2: Discard preallocated zero clusters
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 26/58] qcow2: Discard preallocated zero clusters |
Date: |
Thu, 11 May 2017 16:32:29 +0200 |
From: Max Reitz <address@hidden>
In discard_single_l2(), we completely discard normal clusters instead of
simply turning them into preallocated zero clusters. That means we
should probably do the same with such preallocated zero clusters:
Discard them instead of keeping them allocated.
Reported-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2-cluster.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index fb91fd8..31077d8 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1511,7 +1511,8 @@ static int discard_single_l2(BlockDriverState *bs,
uint64_t offset,
break;
case QCOW2_CLUSTER_ZERO:
- if (!full_discard) {
+ /* Preallocated zero clusters should be discarded in any case
*/
+ if (!full_discard && (old_l2_entry & L2E_OFFSET_MASK) == 0) {
continue;
}
break;
--
1.8.3.1
- [Qemu-devel] [PULL 19/58] osdep: Add qemu_lock_fd and qemu_unlock_fd, (continued)
- [Qemu-devel] [PULL 19/58] osdep: Add qemu_lock_fd and qemu_unlock_fd, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 13/58] iotests: 172: Use separate images for multiple devices, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 18/58] block: Reuse bs as backing hd for drive-backup sync=none, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 14/58] tests: Use null-co:// instead of /dev/null as the dummy image, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 20/58] osdep: Fall back to posix lock when OFD lock is unavailable, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 23/58] tests: Add POSIX image locking test case 182, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 24/58] qcow2: Fix preallocation size formula, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 22/58] qemu-iotests: Add test case 153 for image locking, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 21/58] file-posix: Add image locking to perm operations, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 25/58] qcow2: Reuse preallocated zero clusters, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 26/58] qcow2: Discard preallocated zero clusters,
Kevin Wolf <=
- [Qemu-devel] [PULL 27/58] iotests: Extend test 066, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 28/58] migration: Unify block node activation error handling, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 29/58] block: New BdrvChildRole.activate() for blk_resume_after_migration(), Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 34/58] qemu-img: wait for convert coroutines to complete, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 30/58] block: Drop permissions when migration completes, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 35/58] nvme: Implement Write Zeroes, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 36/58] blockdev: use drained_begin/end for qmp_block_resize, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 31/58] block: Inactivate parents before children, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 33/58] file-posix: Remove .bdrv_inactivate/invalidate_cache, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 32/58] block: Fix write/resize permissions for inactive images, Kevin Wolf, 2017/05/11