[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 43/50] vmdk: Fix calculation of block status's off
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL v2 43/50] vmdk: Fix calculation of block status's offset |
Date: |
Tue, 2 Feb 2016 18:35:36 +0100 |
From: Fam Zheng <address@hidden>
"offset" is the offset of cluster and sector_num doesn't necessarily
refer to the start of it, it should add index_in_cluster.
Signed-off-by: Fam Zheng <address@hidden>
Message-id: address@hidden
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/vmdk.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 109fd5f..9d5a18a 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1278,6 +1278,7 @@ static int64_t coroutine_fn
vmdk_co_get_block_status(BlockDriverState *bs,
0, 0);
qemu_co_mutex_unlock(&s->lock);
+ index_in_cluster = vmdk_find_index_in_cluster(extent, sector_num);
switch (ret) {
case VMDK_ERROR:
ret = -EIO;
@@ -1291,13 +1292,14 @@ static int64_t coroutine_fn
vmdk_co_get_block_status(BlockDriverState *bs,
case VMDK_OK:
ret = BDRV_BLOCK_DATA;
if (extent->file == bs->file && !extent->compressed) {
- ret |= BDRV_BLOCK_OFFSET_VALID | offset;
+ ret |= BDRV_BLOCK_OFFSET_VALID;
+ ret |= (offset + (index_in_cluster << BDRV_SECTOR_BITS))
+ & BDRV_BLOCK_OFFSET_MASK;
}
break;
}
- index_in_cluster = vmdk_find_index_in_cluster(extent, sector_num);
n = extent->cluster_sectors - index_in_cluster;
if (n > nb_sectors) {
n = nb_sectors;
--
2.7.0
- [Qemu-devel] [PULL v2 34/50] qcow: Assign bs->file->bs to file in qcow_co_get_block_status, (continued)
- [Qemu-devel] [PULL v2 34/50] qcow: Assign bs->file->bs to file in qcow_co_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 35/50] qcow2: Assign bs->file->bs to file in qcow2_co_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 33/50] block: Add "file" output parameter to block status query functions, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 36/50] raw: Assign bs to file in raw_co_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 38/50] parallels: Assign bs->file->bs to file in parallels_co_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 37/50] iscsi: Assign bs to file in iscsi_co_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 40/50] sheepdog: Assign bs to file in sd_co_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 41/50] vdi: Assign bs->file->bs to file in vdi_co_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 39/50] qed: Assign bs->file->bs to file in bdrv_qed_co_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 42/50] vpc: Assign bs->file->bs to file in vpc_co_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 43/50] vmdk: Fix calculation of block status's offset,
Max Reitz <=
- [Qemu-devel] [PULL v2 44/50] vmdk: Return extent's file in bdrv_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 46/50] qemu-img: In "map", use the returned "file" from bdrv_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 45/50] block: Use returned *file in bdrv_co_get_block_status, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 47/50] qemu-img: Make MapEntry a QAPI struct, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 48/50] iotests: Add "qemu-img map" test for VMDK extents, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 49/50] block: set device_list.tqe_prev to NULL on BDS removal, Max Reitz, 2016/02/02
- [Qemu-devel] [PULL v2 50/50] block: qemu-iotests - add test for snapshot, commit, snapshot bug, Max Reitz, 2016/02/02
- Re: [Qemu-devel] [PULL v2 00/50] Block patches, Peter Maydell, 2016/02/02