From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5euH-0000mh-06 for qemu-devel@nongnu.org; Tue, 21 Jan 2014 12:14:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5euB-0000YG-5m for qemu-devel@nongnu.org; Tue, 21 Jan 2014 12:14:32 -0500 Received: from mail-pd0-x233.google.com ([2607:f8b0:400e:c02::233]:46002) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5euA-0000Y9-Ub for qemu-devel@nongnu.org; Tue, 21 Jan 2014 12:14:27 -0500 Received: by mail-pd0-f179.google.com with SMTP id q10so6419680pdj.10 for ; Tue, 21 Jan 2014 09:14:25 -0800 (PST) From: Liu Yuan Date: Wed, 22 Jan 2014 01:14:11 +0800 Message-Id: <1390324451-14747-1-git-send-email-namei.unix@gmail.com> Subject: [Qemu-devel] [PATCH] sheepdog: fix 'qemu-img map' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: sheepdog@lists.wpkg.org Cc: Kevin Wolf , qemu-devel@nongnu.org, 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 Cc: Stefan Hajnoczi Signed-off-by: Liu Yuan --- 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