From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNuYJ-00038o-Nu for qemu-devel@nongnu.org; Mon, 25 Jan 2016 22:44:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNuYI-0002Nf-T3 for qemu-devel@nongnu.org; Mon, 25 Jan 2016 22:44:23 -0500 Date: Tue, 26 Jan 2016 11:44:13 +0800 From: Fam Zheng Message-ID: <20160126034413.GE23224@ad.usersys.redhat.com> References: <1453689887-2567-1-git-send-email-famz@redhat.com> <1453689887-2567-12-git-send-email-famz@redhat.com> <20160125132829.GG5154@noname.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160125132829.GG5154@noname.redhat.com> Subject: Re: [Qemu-devel] [PATCH v8 11/15] vmdk: Return extent's file in bdrv_get_block_status List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, Stefan Hajnoczi , pbonzini@redhat.com On Mon, 01/25 14:28, Kevin Wolf wrote: > Am 25.01.2016 um 03:44 hat Fam Zheng geschrieben: > > Signed-off-by: Fam Zheng > > Reviewed-by: Max Reitz > > --- > > block/vmdk.c | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/block/vmdk.c b/block/vmdk.c > > index e1d3e27..f8f7fcf 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; > > @@ -1286,14 +1287,15 @@ static int64_t coroutine_fn vmdk_co_get_block_status(BlockDriverState *bs, > > break; > > case VMDK_OK: > > ret = BDRV_BLOCK_DATA; > > - if (extent->file == bs->file && !extent->compressed) { > > - ret |= BDRV_BLOCK_OFFSET_VALID | offset; > > + if (!extent->compressed) { > > + ret |= BDRV_BLOCK_OFFSET_VALID; > > + ret |= (offset + (index_in_cluster << BDRV_SECTOR_BITS)) > > + & BDRV_BLOCK_OFFSET_MASK; > > } > > - > > + *file = extent->file->bs; > > 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; > > The commit message made me expect that this does exactly the same as the > other patches, i.e. fill the file argument and nothing else. > > Instead, this extends the functioniality to work on any kind of extents > instead of just the the main VMDK file, and it changes the calculation > of the offset (seems to be a hidden bug fix?) > > This needs a non-empty commit message, and depending on what you're > going to write there, possibly splitting the patch. Will split it. Fam