[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v9 11/16] vmdk: Fix calculation of block status's of
From: |
Fam Zheng |
Subject: |
[Qemu-block] [PATCH v9 11/16] vmdk: Fix calculation of block status's offset |
Date: |
Tue, 26 Jan 2016 11:58:58 +0800 |
"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>
---
block/vmdk.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index e1d3e27..61ed207 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1274,6 +1274,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;
@@ -1287,13 +1288,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.4.3
- [Qemu-block] [PATCH v9 02/16] qcow: Assign bs->file->bs to file in qcow_co_get_block_status, (continued)
- [Qemu-block] [PATCH v9 02/16] qcow: Assign bs->file->bs to file in qcow_co_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 03/16] qcow2: Assign bs->file->bs to file in qcow2_co_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 04/16] raw: Assign bs to file in raw_co_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 05/16] iscsi: Assign bs to file in iscsi_co_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 06/16] parallels: Assign bs->file->bs to file in parallels_co_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 07/16] qed: Assign bs->file->bs to file in bdrv_qed_co_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 08/16] sheepdog: Assign bs to file in sd_co_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 09/16] vdi: Assign bs->file->bs to file in vdi_co_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 10/16] vpc: Assign bs->file->bs to file in vpc_co_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 11/16] vmdk: Fix calculation of block status's offset,
Fam Zheng <=
- [Qemu-block] [PATCH v9 12/16] vmdk: Return extent's file in bdrv_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 13/16] block: Use returned *file in bdrv_co_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 14/16] qemu-img: In "map", use the returned "file" from bdrv_get_block_status, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 15/16] qemu-img: Make MapEntry a QAPI struct, Fam Zheng, 2016/01/25
- [Qemu-block] [PATCH v9 16/16] iotests: Add "qemu-img map" test for VMDK extents, Fam Zheng, 2016/01/25
- Re: [Qemu-block] [PATCH v9 00/16] qemu-img map: Allow driver to return file of the allocated block, Max Reitz, 2016/01/27