[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 10/20] qcow2: Prepare qcow2_co_block_status() for da
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PATCH 10/20] qcow2: Prepare qcow2_co_block_status() for data file |
Date: |
Wed, 27 Feb 2019 18:22:46 +0100 |
Offset 0 cannot be assumed to mean an unallocated cluster any more.
Instead, the cluster type needs to be checked.
*file must refer to the data file instead of the image file if a valid
offset is returned from qcow2_co_block_status().
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 11ff5e0434..8dc6f21047 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1817,11 +1817,11 @@ static int coroutine_fn
qcow2_co_block_status(BlockDriverState *bs,
*pnum = bytes;
- if (cluster_offset != 0 && ret != QCOW2_CLUSTER_COMPRESSED &&
+ if ((ret == QCOW2_CLUSTER_NORMAL || ret == QCOW2_CLUSTER_ZERO_ALLOC) &&
!s->crypto) {
index_in_cluster = offset & (s->cluster_size - 1);
*map = cluster_offset | index_in_cluster;
- *file = bs->file->bs;
+ *file = s->data_file->bs;
status |= BDRV_BLOCK_OFFSET_VALID;
}
if (ret == QCOW2_CLUSTER_ZERO_PLAIN || ret == QCOW2_CLUSTER_ZERO_ALLOC) {
--
2.20.1
- [Qemu-block] [PATCH 01/20] qemu-iotests: Test qcow2 preallocation modes, (continued)
- [Qemu-block] [PATCH 01/20] qemu-iotests: Test qcow2 preallocation modes, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 05/20] qcow2: Pass bs to qcow2_get_cluster_type(), Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 03/20] qcow2: Extend spec for external data files, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 06/20] qcow2: Prepare qcow2_get_cluster_type() for external data file, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 13/20] qcow2: Support external data file in qemu-img check, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 14/20] qcow2: Add basic data-file infrastructure, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 02/20] qcow2: Simplify preallocation code, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 09/20] qcow2: Return 0/-errno in qcow2_alloc_compressed_cluster_offset(), Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 18/20] qemu-iotests: Preallocation with external data file, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 07/20] qcow2: Prepare count_contiguous_clusters() for external data file, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 10/20] qcow2: Prepare qcow2_co_block_status() for data file,
Kevin Wolf <=
- [Qemu-block] [PATCH 08/20] qcow2: Don't assume 0 is an invalid cluster offset, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 20/20] qemu-iotests: amend with external data file, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 04/20] qcow2: Basic definitions for external data files, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 12/20] qcow2: Return error for snapshot operation with data file, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 15/20] qcow2: Creating images with external data file, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 16/20] qcow2: Store data file name in the image, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 11/20] qcow2: External file I/O, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 17/20] qcow2: Implement data-file-raw create option, Kevin Wolf, 2019/02/27
- [Qemu-block] [PATCH 19/20] qemu-iotests: General tests for qcow2 with external data file, Kevin Wolf, 2019/02/27