From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPTPt-0006RC-9J for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:33:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPTPj-0005nm-DV for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:33:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPTPj-0005nh-5f for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:33:11 -0400 Date: Thu, 4 Sep 2014 11:33:01 +0200 From: Kevin Wolf Message-ID: <20140904093301.GC3897@noname.str.redhat.com> References: <92103ac95fc7ebc94ecf3e30b146c0cf19273447.1409299732.git.hutao@cn.fujitsu.com> <54007704.8050802@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lrZ03NoBR/3+SXJZ" Content-Disposition: inline In-Reply-To: <54007704.8050802@redhat.com> Subject: Re: [Qemu-devel] [PATCH v13 1/6] block: round up file size to nearest sector List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Fam Zheng , "Richard W.M. Jones" , Hu Tao , qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi , Yasunori Goto --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 29.08.2014 um 14:50 hat Eric Blake geschrieben: > On 08/29/2014 02:33 AM, Hu Tao wrote: > > +++ b/block/raw-posix.c > > @@ -1369,8 +1369,8 @@ static int raw_create(const char *filename, QemuO= pts *opts, Error **errp) > > strstart(filename, "file:", &filename); > > =20 > > /* Read out options */ > > - total_size =3D > > - qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) / BDRV_SECTOR_S= IZE; > > + total_size =3D DIV_ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_= SIZE, 0), > > + BDRV_SECTOR_SIZE); > > nocow =3D qemu_opt_get_bool(opts, BLOCK_OPT_NOCOW, false); >=20 > Again, I'm okay with the idea of always treating guest images as aligned > multiples of sectors. But it's very easy to create an unaligned raw > file, and pass that to qemu. So even though we don't create such files > via qemu-img, it's still worth ensuring that the code behaves correctly > when such an image is used directly or as a backing file The whole qemu block layer doesn't work well with unaligned images (and the required alignment is always 512 because someone thought that using 512-byte units was a good interface). I want to fix that by converting everything to byte granularity, but it's not the top priority. Kevin --lrZ03NoBR/3+SXJZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJUCDHNAAoJEH8JsnLIjy/WZgUQAIFXkW0uCt2e32+SQf85hfss CCOvaf+prHvwmtAi0n9RHeA1UEtK4ohR7TfkeEQVcQzgytoUR5t0Izb4apKfswq+ 7MXB2R39rDfMmMllhHCmQAtG9Gb9scIGsshlXLKkxvfKj7qLMbjHo+mw9NqJpC38 qiGusSUSJTLnQyKwy8W2b0Fvv9FFGzybyJhdM9Cqac10/OyYsQOUu8MhPq4OymVq jXjDU0shotxfZOZWd5qh/YKl5ZfEUVy9w5RuGJLjnM4jm7cSIg+rXvaBM6dETkFc asa1ENQ6MLvYNQ+5hS6XzKcJfzKL8As/sYIrZ28X2Rjv9CLyA3enO9cxzmcBh6r8 MDjge+tP1uEKYvQfuyZG9I/LDUw5CqRowyGf7QJSNsS0jANUZogDs41XOU/iNzMC h2cr1PmtOZNX/Fxo0OJ1WuTU12YVR9HBok9bslthO/AE2FGmmjJTAJqRfvdfcKIT BTbsMK2+4RdZa7fku2ffm4cZAnaTFTYsZ8AndRR7vO4sKEYNlQID1ywp63zz5gFj qKDKazC9k6sRRk7K3SdatELg3C6i324GI0gcgNhD6ok/x0EwCCFl0hTWoSYy9l3p 1RbRul4b4cl+MQ1I4/8PL/uePBZ2p4rpVdb2FroIyDlvm7QrpXpWwJKiqHhSt+U1 UyVwOF92Hc9BW36Iv3gU =fn+X -----END PGP SIGNATURE----- --lrZ03NoBR/3+SXJZ--