yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
73f313
From b5c74112b314c185335de246c465d14ef68509a3 Mon Sep 17 00:00:00 2001
73f313
From: Maxim Levitsky <mlevitsk@redhat.com>
73f313
Date: Sun, 16 Feb 2020 16:02:24 +0100
73f313
Subject: [PATCH 4/6] gluster: Handle changed glfs_ftruncate signature
73f313
73f313
Message-id: <20200216160225.22498-2-mlevitsk@redhat.com>
73f313
Patchwork-id: 93881
73f313
O-Subject: [RHEL-7.9 qemu-kvm PATCH 1/2] gluster: Handle changed glfs_ftruncate signature
73f313
Bugzilla: 1802215
73f313
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
73f313
RH-Acked-by: Max Reitz <mreitz@redhat.com>
73f313
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
73f313
73f313
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
73f313
73f313
New versions of Glusters libgfapi.so have an updated glfs_ftruncate()
73f313
function that returns additional 'struct stat' structures to enable
73f313
advanced caching of attributes. This is useful for file servers, not so
73f313
much for QEMU. Nevertheless, the API has changed and needs to be
73f313
adopted.
73f313
73f313
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
73f313
Signed-off-by: Niels de Vos <ndevos@redhat.com>
73f313
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
73f313
(cherry picked from commit e014dbe74e0484188164c61ff6843f8a04a8cb9d)
73f313
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
73f313
73f313
RHEL: fixed conflicts
73f313
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
73f313
---
73f313
 block/gluster.c |  5 +++++
73f313
 configure       | 18 ++++++++++++++++++
73f313
 2 files changed, 23 insertions(+)
73f313
73f313
diff --git a/block/gluster.c b/block/gluster.c
73f313
index 86e136d..d6160af 100644
73f313
--- a/block/gluster.c
73f313
+++ b/block/gluster.c
73f313
@@ -20,6 +20,11 @@
73f313
 #include "qemu/sockets.h"
73f313
 #include "qemu/uri.h"
73f313
 
73f313
+#ifdef CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT
73f313
+# define glfs_ftruncate(fd, offset) glfs_ftruncate(fd, offset, NULL, NULL)
73f313
+#endif
73f313
+
73f313
+
73f313
 typedef struct GlusterAIOCB {
73f313
     BlockDriverAIOCB common;
73f313
     int64_t size;
73f313
diff --git a/configure b/configure
73f313
index 5877e82..70fd06f 100755
73f313
--- a/configure
73f313
+++ b/configure
73f313
@@ -243,6 +243,7 @@ seccomp=""
73f313
 glusterfs=""
73f313
 glusterfs_discard="no"
73f313
 virtio_blk_data_plane=""
73f313
+glusterfs_ftruncate_has_stat="no"
73f313
 gtk=""
73f313
 gtkabi="2.0"
73f313
 tpm="no"
73f313
@@ -2748,6 +2749,19 @@ EOF
73f313
     if $pkg_config --atleast-version=5 glusterfs-api >/dev/null 2>&1; then
73f313
       glusterfs_discard="yes"
73f313
     fi
73f313
+    cat > $TMPC << EOF
73f313
+#include <glusterfs/api/glfs.h>
73f313
+
73f313
+int
73f313
+main(void)
73f313
+{
73f313
+	/* new glfs_ftruncate() passes two additional args */
73f313
+	return glfs_ftruncate(NULL, 0, NULL, NULL);
73f313
+}
73f313
+EOF
73f313
+    if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
73f313
+      glusterfs_ftruncate_has_stat="yes"
73f313
+    fi
73f313
   else
73f313
     if test "$glusterfs" = "yes" ; then
73f313
       feature_not_found "GlusterFS backend support"
73f313
@@ -4178,6 +4192,10 @@ if test "$live_block_ops" = "yes" ; then
73f313
   echo "CONFIG_LIVE_BLOCK_OPS=y" >> $config_host_mak
73f313
 fi
73f313
 
73f313
+if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
73f313
+  echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
73f313
+fi
73f313
+
73f313
 if test "$live_block_migration" = "yes" ; then
73f313
   echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
73f313
 fi
73f313
-- 
73f313
1.8.3.1
73f313