[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 20/33] qcow2: Prepare qcow2_co_block_status() for dat
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 20/33] qcow2: Prepare qcow2_co_block_status() for data file |
Date: |
Fri, 8 Mar 2019 13:58:10 +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 eaccd1c11a..8d1f667e91 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1829,11 +1829,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] [PULL 13/33] qcow2: Extend spec for external data files, (continued)
- [Qemu-block] [PULL 13/33] qcow2: Extend spec for external data files, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 08/33] tests/bios-tables: Improve portability by searching bash in the $PATH, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 11/33] qemu-iotests: Test qcow2 preallocation modes, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 10/33] qemu-iotests: Ensure GNU sed is used, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 12/33] qcow2: Simplify preallocation code, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 09/33] qemu-iotests: Improve portability by searching bash in the $PATH, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 14/33] qcow2: Basic definitions for external data files, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 18/33] qcow2: Don't assume 0 is an invalid cluster offset, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 17/33] qcow2: Prepare count_contiguous_clusters() for external data file, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 19/33] qcow2: Return 0/-errno in qcow2_alloc_compressed_cluster_offset(), Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 20/33] qcow2: Prepare qcow2_co_block_status() for data file,
Kevin Wolf <=
- [Qemu-block] [PULL 21/33] qcow2: External file I/O, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 15/33] qcow2: Pass bs to qcow2_get_cluster_type(), Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 16/33] qcow2: Prepare qcow2_get_cluster_type() for external data file, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 24/33] qcow2: Add basic data-file infrastructure, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 22/33] qcow2: Return error for snapshot operation with data file, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 23/33] qcow2: Support external data file in qemu-img check, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 25/33] qcow2: Creating images with external data file, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 28/33] qemu-iotests: Preallocation with external data file, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 26/33] qcow2: Store data file name in the image, Kevin Wolf, 2019/03/08
- [Qemu-block] [PULL 30/33] qemu-iotests: amend with external data file, Kevin Wolf, 2019/03/08