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