From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xxtvq-00026W-DT for qemu-devel@nongnu.org; Mon, 08 Dec 2014 03:44:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xxtvk-0000m3-7X for qemu-devel@nongnu.org; Mon, 08 Dec 2014 03:44:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xxtvj-0000lm-VQ for qemu-devel@nongnu.org; Mon, 08 Dec 2014 03:44:32 -0500 Message-ID: <548564E9.80600@redhat.com> Date: Mon, 08 Dec 2014 09:44:25 +0100 From: Max Reitz MIME-Version: 1.0 References: <8a4d2da73a8dbc04cde62bea782fc09ff84b1cf1.1418018421.git.jcody@redhat.com> In-Reply-To: <8a4d2da73a8dbc04cde62bea782fc09ff84b1cf1.1418018421.git.jcody@redhat.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/4] block: vhdx - update PAYLOAD_BLOCK_UNMAPPED value to match 1.00 spec List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody , qemu-devel@nongnu.org Cc: kwolf@redhat.com, amulya.lokesha@emc.com, stefanha@redhat.com On 2014-12-08 at 07:07, Jeff Cody wrote: > The 0.95 VHDX spec defined PAYLOAD_BLOCK_UNMAPPED to be 5. The 1.00 > VHDX spec redefines PAYLOAD_BLOCK_UNMAPPED to be 3 instead. > > The original value of 5 is now an undefined state in the spec, but it > should be safe to treat it the same and return zeros for data read. > This way, we can maintain compatibility with any images out in the wild > that may have been created in accordance to the 0.95 spec. > > Reported-by: Kevin Wolf > Signed-off-by: Jeff Cody > --- > block/vhdx.c | 3 ++- > block/vhdx.h | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/block/vhdx.c b/block/vhdx.c > index f1e1e2e..bec10bd 100644 > --- a/block/vhdx.c > +++ b/block/vhdx.c > @@ -1111,6 +1111,7 @@ static coroutine_fn int vhdx_co_readv(BlockDriverState *bs, int64_t sector_num, > case PAYLOAD_BLOCK_NOT_PRESENT: /* fall through */ > case PAYLOAD_BLOCK_UNDEFINED: > case PAYLOAD_BLOCK_UNMAPPED: > + case PAYLOAD_BLOCK_UNMAPPED_v095: > case PAYLOAD_BLOCK_ZERO: > /* return zero */ > qemu_iovec_memset(&hd_qiov, 0, 0, sinfo.bytes_avail); > @@ -1277,10 +1278,10 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, > sectors_to_write += iov2.iov_len >> BDRV_SECTOR_BITS; > } > } > - Was this line removal intended? Anyway: Reviewed-by: Max Reitz > /* fall through */ > case PAYLOAD_BLOCK_NOT_PRESENT: /* fall through */ > case PAYLOAD_BLOCK_UNMAPPED: > + case PAYLOAD_BLOCK_UNMAPPED_v095: > case PAYLOAD_BLOCK_UNDEFINED: > bat_prior_offset = sinfo.file_offset; > ret = vhdx_allocate_block(bs, s, &sinfo.file_offset); > diff --git a/block/vhdx.h b/block/vhdx.h > index b4a12a0..7003ab7 100644 > --- a/block/vhdx.h > +++ b/block/vhdx.h > @@ -226,7 +226,8 @@ typedef struct QEMU_PACKED VHDXLogDataSector { > #define PAYLOAD_BLOCK_NOT_PRESENT 0 > #define PAYLOAD_BLOCK_UNDEFINED 1 > #define PAYLOAD_BLOCK_ZERO 2 > -#define PAYLOAD_BLOCK_UNMAPPED 5 > +#define PAYLOAD_BLOCK_UNMAPPED 3 > +#define PAYLOAD_BLOCK_UNMAPPED_v095 5 > #define PAYLOAD_BLOCK_FULLY_PRESENT 6 > #define PAYLOAD_BLOCK_PARTIALLY_PRESENT 7