Received: from eggs.gnu.org ([2001:4830:134:3::10]:49592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPTJg-0004iy-7w for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:27:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPTJY-0003xO-Eh for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:26:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPTJY-0003xD-72 for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:26:48 -0400 Date: Thu, 4 Sep 2014 11:26:41 +0200 From: Kevin Wolf Message-ID: <20140904092641.GB3897@noname.str.redhat.com> References: <1409821121-20645-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1409821121-20645-1-git-send-email-stefanha@redhat.com> 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: shhuiw@163.com, qemu-devel@nongnu.org Am 04.09.2014 um 10:58 hat Stefan Hajnoczi geschrieben: > 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-specific > ABI for alignment rules. > > The pahole(1) diff shows that the padding is now explicit and offsets > are unchanged: > > 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 */ > > Signed-off-by: Stefan Hajnoczi Reviewed-by: Kevin Wolf