From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45279) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsGrj-0003J7-Ly for qemu-devel@nongnu.org; Thu, 06 Oct 2016 18:10:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsGri-0004Af-5a for qemu-devel@nongnu.org; Thu, 06 Oct 2016 18:10:11 -0400 References: <1457373855-8072-1-git-send-email-ndevos@redhat.com> <56DDD31A.8060707@redhat.com> From: Eric Blake Message-ID: Date: Thu, 6 Oct 2016 17:09:59 -0500 MIME-Version: 1.0 In-Reply-To: <56DDD31A.8060707@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xWkonxnD6dHSFDaT2OEKg300ei0vt8S7k" Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block/gluster: add support for SEEK_DATA/SEEK_HOLE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Niels de Vos , qemu-block@nongnu.org Cc: "qemu-devel@nongnu.org" , Prasanna Kumar Kalever This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xWkonxnD6dHSFDaT2OEKg300ei0vt8S7k From: Eric Blake To: Niels de Vos , qemu-block@nongnu.org Cc: "qemu-devel@nongnu.org" , Prasanna Kumar Kalever Message-ID: Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block/gluster: add support for SEEK_DATA/SEEK_HOLE References: <1457373855-8072-1-git-send-email-ndevos@redhat.com> <56DDD31A.8060707@redhat.com> In-Reply-To: <56DDD31A.8060707@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/07/2016 01:14 PM, Eric Blake wrote: > [adding qemu-devel; ALL patches must cc qemu-devel even when sent to > another list] >=20 > On 03/07/2016 11:04 AM, Niels de Vos wrote: >> GlusterFS 3.8 contains support for SEEK_DATA and SEEK_HOLE. This makes= >> it possible to detect sparse areas in files. >> >> Signed-off-by: Niels de Vos >> >> -- >> Tested by compiling and running "qemu-img map gluster://..." with a >> build of the current master branch of glusterfs. Using a Fedora >> cloud image (in raw format) shows many SEEK procudure calls going back= >> and forth over the network. The output of "qemu map" matches the outpu= t >> when run against the image on the local filesystem. >> --- I hit a weird failure when trying to compile this on an older RHEL 6 box, where /usr/include/unistd.h is too old to include SEEK_DATA and SEEK_HOLE: block/gluster.c: In function =E2=80=98qemu_gluster_test_seek=E2=80=99: block/gluster.c:684: error: =E2=80=98SEEK_DATA=E2=80=99 undeclared (first= use in this function) block/gluster.c:684: error: (Each undeclared identifier is reported only once block/gluster.c:684: error: for each function it appears in.) block/gluster.c: In function =E2=80=98find_allocation=E2=80=99: block/gluster.c:1202: error: =E2=80=98SEEK_DATA=E2=80=99 undeclared (firs= t use in this function) block/gluster.c:1234: error: =E2=80=98SEEK_HOLE=E2=80=99 undeclared (firs= t use in this function) The patch has been in place for several months (which shows how seldom I compile on that particular box), but it makes me wonder why none of the autobuilders have hit this failure. But since the code mentions that it shamelessly copies from raw-posix.c, and that file in turn has #ifdef guards to only do SEEK_HOLE optimizations if the system headers defined SEEK_HOLE in the first place, it sounds like you need to do a followup patch along those lines. >> + * >> + * (Shamefully copied from raw-posix.c, only miniscule adaptions.) >> + */ >> +static int find_allocation(BlockDriverState *bs, off_t start, >> + off_t *data, off_t *hole) >> +{ >> + BDRVGlusterState *s =3D bs->opaque; >> + off_t offs; >> + >> + /* >> + * SEEK_DATA cases: >> + * D1. offs =3D=3D start: start is in data >> + * D2. offs > start: start is in a hole, next data at offs >> + * D3. offs < 0, errno =3D ENXIO: either start is in a trailing h= ole >> + * or start is beyond EOF >> + * If the latter happens, the file has been truncated behind >> + * our back since we opened it. All bets are off then. >> + * Treating like a trailing hole is simplest. >> + * D4. offs < 0, errno !=3D ENXIO: we learned nothing >> + */ >> + offs =3D glfs_lseek(s->fd, start, SEEK_DATA); --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xWkonxnD6dHSFDaT2OEKg300ei0vt8S7k 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/ iQEcBAEBCAAGBQJX9su4AAoJEKeha0olJ0Nq6TgIAJb1RDpXhiC1Pw3Np+3wws8C quCC2j3mlw6tTZ2LICxEE9GdlKexiegF7cZfS4YGY9gh7Yz1VMlCvdZPbPfBfnVk F0JFVf6zYv8TFCfo6WBZkYvldQNCDEAXJ1bpqv51N7Me0KIF8R4kTnb7P0oIRmQ0 wVyTbFyPc5GXzLMw5UKW3i63/WhbR1BJz5+o3szdIyOoDTles15PQcLOeLfQjo01 So4v94IA6tBJUAW6B51GLJ8f9YQQxCfeCHUflnhYHwBfadw1smlnROpIi+JlCzW6 u9HninBUXQBBnXwp+doazSqDpvPHbbUiDa1GwRR5tuIiQ7RPkUpulh/G/sDh/io= =jJWm -----END PGP SIGNATURE----- --xWkonxnD6dHSFDaT2OEKg300ei0vt8S7k--