Received: from eggs.gnu.org ([2001:4830:134:3::10]:52898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCtHI-0002B1-H4 for qemu-devel@nongnu.org; Fri, 02 Dec 2016 14:13:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cCtHH-0007D7-FS for qemu-devel@nongnu.org; Fri, 02 Dec 2016 14:13:48 -0500 References: <1480589964-29411-1-git-send-email-w.bumiller@proxmox.com> From: Eric Blake Message-ID: Date: Fri, 2 Dec 2016 13:13:28 -0600 MIME-Version: 1.0 In-Reply-To: <1480589964-29411-1-git-send-email-w.bumiller@proxmox.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sbOXcTlDtJEFkDCjDi8UMQ3q6x6CA1rSF" Subject: Re: [Qemu-devel] [RFC PATCH] glusterfs: allow partial reads List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wolfgang Bumiller , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , qemu-block@nongnu.org, Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sbOXcTlDtJEFkDCjDi8UMQ3q6x6CA1rSF From: Eric Blake To: Wolfgang Bumiller , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , qemu-block@nongnu.org, Max Reitz Message-ID: Subject: Re: [Qemu-devel] [RFC PATCH] glusterfs: allow partial reads References: <1480589964-29411-1-git-send-email-w.bumiller@proxmox.com> In-Reply-To: <1480589964-29411-1-git-send-email-w.bumiller@proxmox.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/01/2016 04:59 AM, Wolfgang Bumiller wrote: > Fixes #1644754. >=20 > Signed-off-by: Wolfgang Bumiller > --- > I'm not sure what the original rationale was to treat both partial > reads as well as well as writes as I/O error. (Seems to have happened > from original glusterfs v1 to v2 series with a note but no reasoning > for the read side as far as I could see.) > The general direction lately seems to be to move away from sector > based block APIs. Also eg. the NFS code allows partial reads. (It > does, however, have an old patch (c2eb918e3) dedicated to aligning > sizes to 512 byte boundaries for file creation for compatibility to > other parts of qemu like qcow2. This already happens in glusterfs, > though, but if you move a file from a different storage over to > glusterfs you may end up with a qcow2 file with eg. the L1 table in > the last 80 bytes of the file aligned to _begin_ at a 512 boundary, > but not _end_ at one.) >=20 > block/gluster.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) >=20 > diff --git a/block/gluster.c b/block/gluster.c > index 891c13b..3db0bf8 100644 > --- a/block/gluster.c > +++ b/block/gluster.c > @@ -41,6 +41,7 @@ typedef struct GlusterAIOCB { > int ret; > Coroutine *coroutine; > AioContext *aio_context; > + bool is_write; > } GlusterAIOCB; > =20 > typedef struct BDRVGlusterState { > @@ -716,8 +717,10 @@ static void gluster_finish_aiocb(struct glfs_fd *f= d, ssize_t ret, void *arg) > acb->ret =3D 0; /* Success */ > } else if (ret < 0) { > acb->ret =3D -errno; /* Read/Write failed */ > + } else if (acb->is_write) { > + acb->ret =3D -EIO; /* Partial write - fail it */ > } else { > - acb->ret =3D -EIO; /* Partial read/write - fail it */ > + acb->ret =3D 0; /* Success */ Does this properly guarantee that the portion beyond EOF reads as zero? Would it be better to switch to byte-based interfaces rather than continue to force gluster interaction in 512-byte sector chunks, since gluster can obviously store files that are not 512-aligned? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --sbOXcTlDtJEFkDCjDi8UMQ3q6x6CA1rSF 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/ iQEcBAEBCAAGBQJYQcfZAAoJEKeha0olJ0Nqiu4IAKAN9kUPfAuk2FvSI8vYVwWk Gem2rhvMqsSP+RBbEhJdzkr2Y3w6S91RQRPEtenL5OMT1IZgMDBMEmNL7gruk7Ik mr5IZ/csh/hxYa3WWhcKgorhdS7raXpSrHcjhuvJiFUr3jCIsZw7J98shhQ30iv9 l6Q6GP3+W6qcXWngavMO5PKTgJgWE3jT4O3tUNNewALe3VBirnMBHgWak0m6QDrG 72clW5d2TEQNIktUMsvqlncf5W5JCpLfY0h79fVTWPl6JAZhSUkezp1DRCflJg+Z ljoc2Qc89e6s1CigeyaZHUl8bEi7whQhvK6WwsyPW5uq5Cl//GX07BIu9h+/XDA= =U/NK -----END PGP SIGNATURE----- --sbOXcTlDtJEFkDCjDi8UMQ3q6x6CA1rSF--