qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Niels de Vos <ndevos@redhat.com>, qemu-block@nongnu.org
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Prasanna Kumar Kalever <pkalever@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block/gluster: add support for SEEK_DATA/SEEK_HOLE
Date: Thu, 6 Oct 2016 17:09:59 -0500	[thread overview]
Message-ID: <adfb4ba8-5e92-9cee-58d6-ea80b1f3afae@redhat.com> (raw)
In-Reply-To: <56DDD31A.8060707@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2900 bytes --]

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]
> 
> 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 <ndevos@redhat.com>
>>
>> --
>> 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 output
>> 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 ‘qemu_gluster_test_seek’:
block/gluster.c:684: error: ‘SEEK_DATA’ 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 ‘find_allocation’:
block/gluster.c:1202: error: ‘SEEK_DATA’ undeclared (first use in this
function)
block/gluster.c:1234: error: ‘SEEK_HOLE’ undeclared (first 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 = bs->opaque;
>> +    off_t offs;
>> +
>> +    /*
>> +     * SEEK_DATA cases:
>> +     * D1. offs == start: start is in data
>> +     * D2. offs > start: start is in a hole, next data at offs
>> +     * D3. offs < 0, errno = ENXIO: either start is in a trailing hole
>> +     *                              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 != ENXIO: we learned nothing
>> +     */
>> +    offs = glfs_lseek(s->fd, start, SEEK_DATA);


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-10-06 22:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1457373855-8072-1-git-send-email-ndevos@redhat.com>
2016-03-07 19:14 ` [Qemu-devel] [Qemu-block] [PATCH] block/gluster: add support for SEEK_DATA/SEEK_HOLE Eric Blake
2016-10-06 22:09   ` Eric Blake [this message]
2016-10-07  3:57     ` Jeff Cody
     [not found] ` <20160307182738.GA14127@localhost.localdomain>
2016-03-08  4:21   ` Niels de Vos
2016-03-08 12:33     ` Jeff Cody
2016-03-08 13:14       ` Niels de Vos
2016-03-09 12:30         ` [Qemu-devel] [PATCH v2] " Niels de Vos
2016-03-09 15:46           ` Jeff Cody
2016-03-09 18:12             ` Niels de Vos
2016-03-09 22:19               ` Jeff Cody
2016-03-10 18:38                 ` [Qemu-devel] [PATCH v3] " Niels de Vos
2016-03-15 19:50                   ` Jeff Cody
2016-03-15 19:52                     ` Jeff Cody
2016-03-16  4:08                       ` Niels de Vos
2016-03-08 12:53     ` [Qemu-devel] [Qemu-block] [PATCH] " Kevin Wolf
2016-03-08 13:19       ` Niels de Vos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adfb4ba8-5e92-9cee-58d6-ea80b1f3afae@redhat.com \
    --to=eblake@redhat.com \
    --cc=ndevos@redhat.com \
    --cc=pkalever@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).