From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPTe9-00049M-DT for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:48:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPTe4-0001xR-Am for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:48:05 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:41062 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPTe4-0001x4-4g for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:48:00 -0400 Date: Thu, 4 Sep 2014 11:47:12 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140904094709.GA10515@irqsave.net> References: <1409821121-20645-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1409821121-20645-1-git-send-email-stefanha@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] cow: make padding in the header explicit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , shhuiw@163.com, qemu-devel@nongnu.org The Thursday 04 Sep 2014 =E0 09:58:41 (+0100), Stefan Hajnoczi wrote : > On-disk structures should be marked packed so the compiler does not > insert padding for field alignment. Padding should be explicit so > on-disk layout is obvious and we don't rely on the architecture-specifi= c > ABI for alignment rules. >=20 > The pahole(1) diff shows that the padding is now explicit and offsets > are unchanged: >=20 > char backing_file[1024]; /* 8 1024 */ > /* --- cacheline 16 boundary (1024 bytes) was 8 bytes ago --- */ > int32_t mtime; /* 1032 4 */ > - > - /* XXX 4 bytes hole, try to pack */ > - > + uint32_t padding; /* 1036 4 */ > uint64_t size; /* 1040 8 */ >=20 > Signed-off-by: Stefan Hajnoczi > --- > block/cow.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/block/cow.c b/block/cow.c > index 6ee4833..5ee9363 100644 > --- a/block/cow.c > +++ b/block/cow.c > @@ -37,9 +37,10 @@ struct cow_header_v2 { > uint32_t version; > char backing_file[1024]; > int32_t mtime; > + uint32_t padding; > uint64_t size; > uint32_t sectorsize; > -}; > +} QEMU_PACKED; > =20 > typedef struct BDRVCowState { > CoMutex lock; > --=20 > 1.9.3 >=20 >=20 Reviewed-by: Beno=EEt Canet