From: Niels de Vos <ndevos@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Jeff Cody <jcody@redhat.com>,
qemu-block@nongnu.org,
Prasanna Kumar Kalever <pkalever@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block/gluster: add support for SEEK_DATA/SEEK_HOLE
Date: Tue, 8 Mar 2016 14:19:16 +0100 [thread overview]
Message-ID: <20160308131916.GF18666@ndevos-x240.usersys.redhat.com> (raw)
In-Reply-To: <20160308125326.GE5807@noname.str.redhat.com>
On Tue, Mar 08, 2016 at 01:53:26PM +0100, Kevin Wolf wrote:
> Am 08.03.2016 um 05:21 hat Niels de Vos geschrieben:
> > On Mon, Mar 07, 2016 at 01:27:38PM -0500, Jeff Cody wrote:
> > > On Mon, Mar 07, 2016 at 07:04:15PM +0100, 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.
> > > > ---
> > > > block/gluster.c | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > > > configure | 25 +++++++++
> > > > 2 files changed, 184 insertions(+)
> > > >
> > > > diff --git a/block/gluster.c b/block/gluster.c
> > > > index 65077a0..1430010 100644
> > > > --- a/block/gluster.c
> > > > +++ b/block/gluster.c
> > > > @@ -677,6 +677,153 @@ static int qemu_gluster_has_zero_init(BlockDriverState *bs)
> > > > return 0;
> > > > }
> > > >
> > > > +#ifdef CONFIG_GLUSTERFS_SEEK_DATA
> > >
> > > Why do we need to make this a compile-time option? Version checking
> > > is problematic; for instance, different distributions may have
> > > backported bug fixes / features, that are not reflected by the
> > > reported version number, etc.. Ideally, we can determine
> > > functionality during runtime, and behave accordingly.
> >
> > This will not get backported to older Gluster versions, it required a
> > protocol change.
> >
> > > If SEEK_DATA and SEEK_HOLE are not supported,
> > > qemu_gluster_co_get_block_status can return that sectors are all
> > > allocated (which is what happens in block/io.c anyway if the driver
> > > doesn't support the function).
> >
> > Ok, good to know.
> >
> > > As long as glfs_lseek() will return error (e.g. EINVAL) for an invalid
> > > whence value, we can handle it runtime. Does glfs_lseek() behave
> > > sanely?
> >
> > Unfortunately older versions of libgfapi do not return EINVAL when
> > SEEK_DATA/HOLE is used. It is something we'll need to fix in the stable
> > releases. We can not assume that all users have installed a version of
> > the library that handles SEEK_DATA/HOLE correctly (return EINVAL) when
> > there is no support in the network protocol or on the server.
> >
> > To be sure that we don't get some undefined behaviour, the compile time
> > check is needed.
>
> The code could be compiled on a host with newer libgfapi, but run on a
> different host with an older version. This is why having (only) compile
> time checks is rarely a good idea.
Oh, yes, that is possible. glfs_lseek() is not a new function, so the
symbol version did not need to change.
> Jeff's suggestion to probe the actual behaviour on the host we're
> running on in .bdrv_open() sounds reasonable to me.
Yes, it sure is. I'll send a v2 patch soon.
Thanks,
Niels
prev parent reply other threads:[~2016-03-08 13:19 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
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 [this message]
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=20160308131916.GF18666@ndevos-x240.usersys.redhat.com \
--to=ndevos@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@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).