yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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