summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiu Yuan <namei.unix@gmail.com>2014-01-22 01:14:11 +0800
committerKevin Wolf <kwolf@redhat.com>2014-01-24 14:33:00 +0100
commit9cd767376f137918dbe90abb452dfe119ae7d8f3 (patch)
tree2fd20be08664fd6711112bca6ed855422e0bea66
parent0e3bd9932f862c1c1e4926939b4d0c602ce214ef (diff)
downloadqemu-9cd767376f137918dbe90abb452dfe119ae7d8f3.zip
sheepdog: fix 'qemu-img map'
It was muted in the previous commit 4bc74be9. Let's revive it since nothing prevents us to do it. With this patch, following command will work as other formats: $ qemu-img map sheepdog:image Cc: qemu-devel@nongnu.org Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Liu Yuan <namei.unix@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/sheepdog.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 2ce3d9b9fb..672b9c97a2 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -2442,11 +2442,12 @@ sd_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
{
BDRVSheepdogState *s = bs->opaque;
SheepdogInode *inode = &s->inode;
- unsigned long start = sector_num * BDRV_SECTOR_SIZE / SD_DATA_OBJ_SIZE,
+ uint64_t offset = sector_num * BDRV_SECTOR_SIZE;
+ unsigned long start = offset / SD_DATA_OBJ_SIZE,
end = DIV_ROUND_UP((sector_num + nb_sectors) *
BDRV_SECTOR_SIZE, SD_DATA_OBJ_SIZE);
unsigned long idx;
- int64_t ret = BDRV_BLOCK_DATA;
+ int64_t ret = BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID | offset;
for (idx = start; idx < end; idx++) {
if (inode->data_vdi_id[idx] == 0) {