* [Qemu-devel] [PATCH 1/1] block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support
@ 2016-10-07 3:53 Jeff Cody
2016-10-07 14:20 ` Eric Blake
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Cody @ 2016-10-07 3:53 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, eblake, ndevos, pkalever
Add checks to see if the system compiling QEMU has support for
SEEK_HOLE/SEEK_DATA. If the system does not, we will flag that seek
data is unsupported in gluster.
Note: this is not a check on whether the gluster server itself supports
SEEK_DATA (that is already done during runtime), but rather if the
compilation environment supports SEEK_DATA.
Signed-off-by: Jeff Cody <jcody@redhat.com>
---
Note: this patch is untested on older systems that do not support SEEK_DATA
(e.g.. RHEL6). This won't be pulled into my tree until it is verified.
block/gluster.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/block/gluster.c b/block/gluster.c
index e7bd13c..acb1934 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -672,8 +672,10 @@ static void qemu_gluster_parse_flags(int bdrv_flags, int *open_flags)
*/
static bool qemu_gluster_test_seek(struct glfs_fd *fd)
{
- off_t ret, eof;
+ off_t ret = 0;
+ off_t eof;
+#if defined SEEK_HOLE && defined SEEK_DATA
eof = glfs_lseek(fd, 0, SEEK_END);
if (eof < 0) {
/* this should never occur */
@@ -682,6 +684,7 @@ static bool qemu_gluster_test_seek(struct glfs_fd *fd)
/* this should always fail with ENXIO if SEEK_DATA is supported */
ret = glfs_lseek(fd, eof, SEEK_DATA);
+#endif
return (ret < 0) && (errno == ENXIO);
}
@@ -1185,9 +1188,10 @@ static int find_allocation(BlockDriverState *bs, off_t start,
off_t offs;
if (!s->supports_seek_data) {
- return -ENOTSUP;
+ goto exit;
}
+#if defined SEEK_HOLE && defined SEEK_DATA
/*
* SEEK_DATA cases:
* D1. offs == start: start is in data
@@ -1251,6 +1255,9 @@ static int find_allocation(BlockDriverState *bs, off_t start,
/* D1 and H1 */
return -EBUSY;
+#endif
+exit:
+ return -ENOTSUP;
}
/*
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support
2016-10-07 3:53 [Qemu-devel] [PATCH 1/1] block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support Jeff Cody
@ 2016-10-07 14:20 ` Eric Blake
2016-10-07 14:24 ` Jeff Cody
0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2016-10-07 14:20 UTC (permalink / raw)
To: Jeff Cody, qemu-devel; +Cc: qemu-block, ndevos, pkalever
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]
On 10/06/2016 10:53 PM, Jeff Cody wrote:
> Add checks to see if the system compiling QEMU has support for
> SEEK_HOLE/SEEK_DATA. If the system does not, we will flag that seek
> data is unsupported in gluster.
>
> Note: this is not a check on whether the gluster server itself supports
> SEEK_DATA (that is already done during runtime), but rather if the
> compilation environment supports SEEK_DATA.
>
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>
> Note: this patch is untested on older systems that do not support SEEK_DATA
> (e.g.. RHEL6). This won't be pulled into my tree until it is verified.
>
CC block/gluster.o
block/gluster.c: In function ‘qemu_gluster_test_seek’:
block/gluster.c:676: warning: unused variable ‘eof’
block/gluster.c: In function ‘find_allocation’:
block/gluster.c:1188: warning: unused variable ‘offs’
but compilation succeeded in spite of the warning. Would be nice to
clean that up for -Werror users.
Tested-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
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 --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support
2016-10-07 14:20 ` Eric Blake
@ 2016-10-07 14:24 ` Jeff Cody
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Cody @ 2016-10-07 14:24 UTC (permalink / raw)
To: Eric Blake; +Cc: qemu-devel, qemu-block, ndevos, pkalever
On Fri, Oct 07, 2016 at 09:20:54AM -0500, Eric Blake wrote:
> On 10/06/2016 10:53 PM, Jeff Cody wrote:
> > Add checks to see if the system compiling QEMU has support for
> > SEEK_HOLE/SEEK_DATA. If the system does not, we will flag that seek
> > data is unsupported in gluster.
> >
> > Note: this is not a check on whether the gluster server itself supports
> > SEEK_DATA (that is already done during runtime), but rather if the
> > compilation environment supports SEEK_DATA.
> >
> > Signed-off-by: Jeff Cody <jcody@redhat.com>
> > ---
> >
> > Note: this patch is untested on older systems that do not support SEEK_DATA
> > (e.g.. RHEL6). This won't be pulled into my tree until it is verified.
> >
>
> CC block/gluster.o
> block/gluster.c: In function ‘qemu_gluster_test_seek’:
> block/gluster.c:676: warning: unused variable ‘eof’
> block/gluster.c: In function ‘find_allocation’:
> block/gluster.c:1188: warning: unused variable ‘offs’
>
> but compilation succeeded in spite of the warning. Would be nice to
> clean that up for -Werror users.
>
> Tested-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
Thanks Eric. I'll clean that up for a v2.
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-07 14:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-07 3:53 [Qemu-devel] [PATCH 1/1] block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support Jeff Cody
2016-10-07 14:20 ` Eric Blake
2016-10-07 14:24 ` Jeff Cody
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).