From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxFMU-0005W7-Av for qemu-devel@nongnu.org; Thu, 20 Oct 2016 11:34:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxFMT-0007Hi-5b for qemu-devel@nongnu.org; Thu, 20 Oct 2016 11:34:30 -0400 References: <1476971860-20860-1-git-send-email-zhang.zhanghailiang@huawei.com> <1476971860-20860-8-git-send-email-zhang.zhanghailiang@huawei.com> From: Eric Blake Message-ID: <316427bf-36f6-7945-e143-8d51efc78978@redhat.com> Date: Thu, 20 Oct 2016 10:34:21 -0500 MIME-Version: 1.0 In-Reply-To: <1476971860-20860-8-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XFm1rm00IMm1f2CCwRkGG1ebaPkUPw3w3" Subject: Re: [Qemu-devel] [PATCH RFC 7/7] nbd/replication: implement .bdrv_get_info() for nbd and replication driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: kwolf@redhat.com, xiecl.fnst@cn.fujitsu.com, mreitz@redhat.com, stefanha@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XFm1rm00IMm1f2CCwRkGG1ebaPkUPw3w3 From: Eric Blake To: zhanghailiang , qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: kwolf@redhat.com, xiecl.fnst@cn.fujitsu.com, mreitz@redhat.com, stefanha@redhat.com, pbonzini@redhat.com Message-ID: <316427bf-36f6-7945-e143-8d51efc78978@redhat.com> Subject: Re: [Qemu-devel] [PATCH RFC 7/7] nbd/replication: implement .bdrv_get_info() for nbd and replication driver References: <1476971860-20860-1-git-send-email-zhang.zhanghailiang@huawei.com> <1476971860-20860-8-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1476971860-20860-8-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/20/2016 08:57 AM, zhanghailiang wrote: > Without this callback, there will be an error reports in the primary si= de: > "qemu-system-x86_64: Couldn't determine the cluster size of the target = image, > which has no backing file: Operation not supported > Aborting, since this may create an unusable destination image" >=20 > For nbd driver, it doesn't have cluster size, so here we return > a fake value for it. >=20 > Signed-off-by: zhanghailiang > Signed-off-by: Wen Congyang > --- > block/nbd.c | 12 ++++++++++++ > block/replication.c | 6 ++++++ > 2 files changed, 18 insertions(+) >=20 > diff --git a/block/nbd.c b/block/nbd.c > index 6bc06d6..96d7023 100644 > --- a/block/nbd.c > +++ b/block/nbd.c > @@ -40,6 +40,8 @@ > =20 > #define EN_OPTSTR ":exportname=3D" > =20 > +#define NBD_FAKE_CLUSTER_SIZE 512 Why 512? NBD allows byte-addressable operations (even if it is more efficient on aligned I/O); and I've been working hard to convert things to the point that NBD does not enforce alignment on other layers. Wouldn't 1 be better? > +static int nbd_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) > +{ > + bdi->cluster_size =3D NBD_FAKE_CLUSTER_SIZE; I also have patches written (but waiting for NBD write zeroes support to be reviewed first) that add support for the experimental NBD block info, that lets a server advertise actual sizes to the client rather than having to guess. Here's the last time I posted a preview of it: https://lists.gnu.org/archive/html/qemu-devel/2016-04/msg03567.html It would be nice to use that instead of just faking things. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --XFm1rm00IMm1f2CCwRkGG1ebaPkUPw3w3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYCOP9AAoJEKeha0olJ0NqbWMH/2/LvGmEj8O9UWG02ID2YuUk ETpg1K8EiCnbqJLmpFhGS0G8QIALh+2snEJqu429VSdmrPe5nXHReRcG7DC+ka3x LpZMpS5ekAUn6TzcgEhCxeBe1mr4FeNcJzpk3UnU1bFbPFePGyBcorIGguXpqZSE 9AAElOs8Ke1Aa4J/zKO90BTyzf/cgIbE2lq93S0n71inWjAS/my7zxtR4bHpheQO Q2seJRQhgPF1OtPtOWKb03lZU93jWoel75BkR6NY3Q4Ula2z1mUwPBGOzIu53GV4 MRF+XBHRWINsH6Z7FieppIfuKHe/hgR655EMoSB7q35JLAj5r+rCCvmOhdNc3ZQ= =tsDR -----END PGP SIGNATURE----- --XFm1rm00IMm1f2CCwRkGG1ebaPkUPw3w3--