[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen master] block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support



commit d9b789745b88df367674e45c55df29e9c7de8d8a
Author:     Jeff Cody <jcody@xxxxxxxxxx>
AuthorDate: Fri Oct 7 17:48:12 2016 -0400
Commit:     Jeff Cody <jcody@xxxxxxxxxx>
CommitDate: Tue Nov 1 07:55:57 2016 -0400

    block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support
    
    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.
    
    Reviewed-by: Eric Blake <eblake@xxxxxxxxxx>
    Signed-off-by: Jeff Cody <jcody@xxxxxxxxxx>
    Tested-by: Eric Blake <eblake@xxxxxxxxxx>
    Message-id: 
00370bce5c98140d6c56ad5145635ec6551265cc.1475876377.git.jcody@xxxxxxxxxx
    Signed-off-by: Jeff Cody <jcody@xxxxxxxxxx>
---
 block/gluster.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/block/gluster.c b/block/gluster.c
index af76d7d..1735d12 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -668,7 +668,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;
+
+#if defined SEEK_HOLE && defined SEEK_DATA
+    off_t eof;
 
     eof = glfs_lseek(fd, 0, SEEK_END);
     if (eof < 0) {
@@ -678,6 +681,8 @@ 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);
 }
 
@@ -1178,12 +1183,14 @@ static int find_allocation(BlockDriverState *bs, off_t 
start,
                            off_t *data, off_t *hole)
 {
     BDRVGlusterState *s = bs->opaque;
-    off_t offs;
 
     if (!s->supports_seek_data) {
-        return -ENOTSUP;
+        goto exit;
     }
 
+#if defined SEEK_HOLE && defined SEEK_DATA
+    off_t offs;
+
     /*
      * SEEK_DATA cases:
      * D1. offs == start: start is in data
@@ -1247,6 +1254,10 @@ static int find_allocation(BlockDriverState *bs, off_t 
start,
 
     /* D1 and H1 */
     return -EBUSY;
+#endif
+
+exit:
+    return -ENOTSUP;
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.