* [Qemu-devel] [PATCH] sheepdog: fix 'qemu-img map'
@ 2014-01-21 17:14 Liu Yuan
2014-01-22 9:34 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Liu Yuan @ 2014-01-21 17:14 UTC (permalink / raw)
To: sheepdog; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi
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>
---
block/sheepdog.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index b94ab6e..61aead0 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) {
--
1.8.1.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] sheepdog: fix 'qemu-img map'
2014-01-21 17:14 [Qemu-devel] [PATCH] sheepdog: fix 'qemu-img map' Liu Yuan
@ 2014-01-22 9:34 ` Kevin Wolf
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2014-01-22 9:34 UTC (permalink / raw)
To: Liu Yuan; +Cc: sheepdog, qemu-devel, Stefan Hajnoczi
Am 21.01.2014 um 18:14 hat Liu Yuan geschrieben:
> 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>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-22 9:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-21 17:14 [Qemu-devel] [PATCH] sheepdog: fix 'qemu-img map' Liu Yuan
2014-01-22 9:34 ` Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).