thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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