From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPZBu-0007VX-U1 for qemu-devel@nongnu.org; Thu, 04 Sep 2014 11:43:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPZBl-00042l-P6 for qemu-devel@nongnu.org; Thu, 04 Sep 2014 11:43:18 -0400 Received: from mail-wg0-x22e.google.com ([2a00:1450:400c:c00::22e]:40962) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPZBl-00042f-IX for qemu-devel@nongnu.org; Thu, 04 Sep 2014 11:43:09 -0400 Received: by mail-wg0-f46.google.com with SMTP id x13so10305925wgg.29 for ; Thu, 04 Sep 2014 08:43:08 -0700 (PDT) Date: Thu, 4 Sep 2014 16:43:05 +0100 From: Stefan Hajnoczi Message-ID: <20140904154305.GA26494@stefanha-thinkpad.redhat.com> References: <1409821121-20645-1-git-send-email-stefanha@redhat.com> <54085604.2050005@redhat.com> <20140904135132.GC27130@stefanha-thinkpad.redhat.com> <20140904141014.GL3897@noname.str.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bg08WKrSYDhXBjb5" Content-Disposition: inline In-Reply-To: <20140904141014.GL3897@noname.str.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: Kevin Wolf Cc: shhuiw@163.com, qemu-devel@nongnu.org, Stefan Hajnoczi --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 04, 2014 at 04:10:14PM +0200, Kevin Wolf wrote: > Am 04.09.2014 um 15:51 hat Stefan Hajnoczi geschrieben: > > On Thu, Sep 04, 2014 at 06:07:32AM -0600, Eric Blake wrote: > > > On 09/04/2014 02:58 AM, 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-spe= cific > > > > ABI for alignment rules. > > > >=20 > > > > The pahole(1) diff shows that the padding is now explicit and offse= ts > > > > 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 > > > Was a 32-bit build also inserting this padding, or do we have histori= cal > > > differences where 32-bit and 64-bit cow files are actually different, > > > and we may need to be prepared to parse files from both sources? > >=20 > > Good point. Let's not merge this patch since it breaks 32-bit hosts. > >=20 > > The fact that no one hit problems when exchanging files between 32-bit > > and 64-bit machines shows that the cow format is rarely used. > >=20 > > At this point we have 2 different formats: one without padding > > (i386-style) and one with padding (x86_64-style). The chance of more > > variants is small but who knows, maybe some other host architecture ABI > > has yet another alignment rule for uint64_t. > >=20 > > I'd like to git rm block/cow.c but I suppose the backwards-compatible > > thing to do is to introduce subformats to support both variants. > > Opinions? >=20 > Can we safely detect which of the subformats we have? But I'm not sure > if it's even worth fixing. I think it would default to the subformat depending on the host architecture but allow overriding with -o subformat=3Di386|x86_64. I'm also not sure if it's worth fixing. The cow file format is so rarely used I wonder if we'd be better off without it. Stefan --bg08WKrSYDhXBjb5 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUCIiJAAoJEJykq7OBq3PIgjEH/0IsmARgrpwmpSXFlwng7afR bAcrx4IGI4pAzlcbA/ReYdPikcFDQquVA1hcy2VqUSUnjIiAVaMSoVQo0U0r7xaF Y0BbogazqewFgA4VzuflczL8+SsN6n5BnOMWofUYlTdcagqd3ZXT5g3aQZEG+RRc cum0j94Ti+1bGBk6/3TNF5tRifK3q6tdwbZNvLhrVBHrIZ9LwxbSxL4Y0nK+bvYY LjD4mSk2UbfTDfeGhfdp4A1QWGpfdzLZRkMwrzzXp7ejiKBSZqd3gIm4vq0WAde0 j8ZS9y6inatFFLXv143IihMdZfjlbICmAq0UiMGskVjrtgMoMpuykb5TFoygb1o= =O0CB -----END PGP SIGNATURE----- --bg08WKrSYDhXBjb5--