From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPXRz-00073t-CZ for qemu-devel@nongnu.org; Thu, 04 Sep 2014 09:51:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPXRq-0008R5-CA for qemu-devel@nongnu.org; Thu, 04 Sep 2014 09:51:47 -0400 Received: from mail-we0-x22d.google.com ([2a00:1450:400c:c03::22d]:42158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPXRq-0008Qz-5Z for qemu-devel@nongnu.org; Thu, 04 Sep 2014 09:51:38 -0400 Received: by mail-we0-f173.google.com with SMTP id t60so10236044wes.4 for ; Thu, 04 Sep 2014 06:51:36 -0700 (PDT) Date: Thu, 4 Sep 2014 14:51:32 +0100 From: Stefan Hajnoczi Message-ID: <20140904135132.GC27130@stefanha-thinkpad.redhat.com> References: <1409821121-20645-1-git-send-email-stefanha@redhat.com> <54085604.2050005@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JWEK1jqKZ6MHAcjA" Content-Disposition: inline In-Reply-To: <54085604.2050005@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: Eric Blake Cc: Kevin Wolf , shhuiw@163.com, qemu-devel@nongnu.org, Stefan Hajnoczi --JWEK1jqKZ6MHAcjA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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-specific > > 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 > Was a 32-bit build also inserting this padding, or do we have historical > 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? Good point. Let's not merge this patch since it breaks 32-bit hosts. 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. 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. 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? Stefan --JWEK1jqKZ6MHAcjA Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUCG5kAAoJEJykq7OBq3PIYaoIALZ3+xMrvRk/FvQzdW4AdVf6 miMxPACMm/i3tNSgF+EoE736eIrpsMD9CLRVxVd18b89vfDBjj/Xla5BLwiL9Qnh CVBrKffSF0AyZtJbRvWSUdvnu4Rr9FE7geKFFMG9KKtDbjugghyiing1wQo9C7Oj 56p8eBmUMlXmcwjhWt8JqeNpjtNdn382o64QFdJ0ozp1PCkiSLeseuvOgeQ4WaNE ugRDxHPOLZ0zaQwLPeUV5nid1Vo9EKmyAUeZ+NnLNRLn7IGlCF4ECgL+2HZXZvaA +6VNKid/lC/vxszPLUuXCkpO79O/kJvGpbpyvIx+/aKGY+StmrvO/OQbduIZKPI= =BAUS -----END PGP SIGNATURE----- --JWEK1jqKZ6MHAcjA--