Message ID | 307c86b73ddfd22d56c41ad0ee700a7c070c73f0.1475812005.git.jcody@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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>
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
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; } /*
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(-)