Blame SOURCES/kvm-gluster-Handle-changed-glfs_ftruncate-signature.patch

4ec855
From a30344defca0e948400587280f67d4e6bcc5834f Mon Sep 17 00:00:00 2001
4ec855
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@redhat.com>
4ec855
Date: Wed, 19 Jun 2019 17:15:07 +0200
4ec855
Subject: [PATCH 1/2] gluster: Handle changed glfs_ftruncate signature
4ec855
MIME-Version: 1.0
4ec855
Content-Type: text/plain; charset=UTF-8
4ec855
Content-Transfer-Encoding: 8bit
4ec855
4ec855
RH-Author: Philippe Mathieu-Daudé <philmd@redhat.com>
4ec855
Message-id: <20190619171508.31981-2-philmd@redhat.com>
4ec855
Patchwork-id: 88737
4ec855
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 1/2] gluster: Handle changed glfs_ftruncate signature
4ec855
Bugzilla: 1721983
4ec855
RH-Acked-by: Max Reitz <mreitz@redhat.com>
4ec855
RH-Acked-by: Niels de Vos <ndevos@redhat.com>
4ec855
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
4ec855
4ec855
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
4ec855
4ec855
New versions of Glusters libgfapi.so have an updated glfs_ftruncate()
4ec855
function that returns additional 'struct stat' structures to enable
4ec855
advanced caching of attributes. This is useful for file servers, not so
4ec855
much for QEMU. Nevertheless, the API has changed and needs to be
4ec855
adopted.
4ec855
4ec855
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
4ec855
Signed-off-by: Niels de Vos <ndevos@redhat.com>
4ec855
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4ec855
(cherry picked from commit e014dbe74e0484188164c61ff6843f8a04a8cb9d)
4ec855
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4ec855
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4ec855
---
4ec855
 block/gluster.c |  4 ++++
4ec855
 configure       | 18 ++++++++++++++++++
4ec855
 2 files changed, 22 insertions(+)
4ec855
4ec855
diff --git a/block/gluster.c b/block/gluster.c
4ec855
index 8c13002..e3ffa61 100644
4ec855
--- a/block/gluster.c
4ec855
+++ b/block/gluster.c
4ec855
@@ -20,6 +20,10 @@
4ec855
 #include "qemu/option.h"
4ec855
 #include "qemu/cutils.h"
4ec855
 
4ec855
+#ifdef CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT
4ec855
+# define glfs_ftruncate(fd, offset) glfs_ftruncate(fd, offset, NULL, NULL)
4ec855
+#endif
4ec855
+
4ec855
 #define GLUSTER_OPT_FILENAME        "filename"
4ec855
 #define GLUSTER_OPT_VOLUME          "volume"
4ec855
 #define GLUSTER_OPT_PATH            "path"
4ec855
diff --git a/configure b/configure
4ec855
index 6d61b14..b3d337b 100755
4ec855
--- a/configure
4ec855
+++ b/configure
4ec855
@@ -429,6 +429,7 @@ glusterfs_xlator_opt="no"
4ec855
 glusterfs_discard="no"
4ec855
 glusterfs_fallocate="no"
4ec855
 glusterfs_zerofill="no"
4ec855
+glusterfs_ftruncate_has_stat="no"
4ec855
 gtk=""
4ec855
 gtkabi=""
4ec855
 gtk_gl="no"
4ec855
@@ -3919,6 +3920,19 @@ if test "$glusterfs" != "no" ; then
4ec855
       glusterfs_fallocate="yes"
4ec855
       glusterfs_zerofill="yes"
4ec855
     fi
4ec855
+    cat > $TMPC << EOF
4ec855
+#include <glusterfs/api/glfs.h>
4ec855
+
4ec855
+int
4ec855
+main(void)
4ec855
+{
4ec855
+	/* new glfs_ftruncate() passes two additional args */
4ec855
+	return glfs_ftruncate(NULL, 0, NULL, NULL);
4ec855
+}
4ec855
+EOF
4ec855
+    if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
4ec855
+      glusterfs_ftruncate_has_stat="yes"
4ec855
+    fi
4ec855
   else
4ec855
     if test "$glusterfs" = "yes" ; then
4ec855
       feature_not_found "GlusterFS backend support" \
4ec855
@@ -6622,6 +6636,10 @@ if test "$glusterfs_zerofill" = "yes" ; then
4ec855
   echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
4ec855
 fi
4ec855
 
4ec855
+if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
4ec855
+  echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
4ec855
+fi
4ec855
+
4ec855
 if test "$libssh2" = "yes" ; then
4ec855
   echo "CONFIG_LIBSSH2=m" >> $config_host_mak
4ec855
   echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
4ec855
-- 
4ec855
1.8.3.1
4ec855