cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-gluster-the-glfs_io_cbk-callback-function-pointer-ad.patch

4ec855
From 41e53f27ba80b6479c5b7fdb34eb67ceb801c65b 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:08 +0200
4ec855
Subject: [PATCH 2/2] gluster: the glfs_io_cbk callback function pointer adds
4ec855
 pre/post stat args
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-3-philmd@redhat.com>
4ec855
Patchwork-id: 88738
4ec855
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 2/2] gluster: the glfs_io_cbk callback function pointer adds pre/post stat args
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: Niels de Vos <ndevos@redhat.com>
4ec855
4ec855
The glfs_*_async() functions do a callback once finished. This callback
4ec855
has changed its arguments, pre- and post-stat structures have been
4ec855
added. This makes it possible to improve caching, which is useful for
4ec855
Samba and NFS-Ganesha, but not so much for QEMU. Gluster 6 is the first
4ec855
release that includes these new arguments.
4ec855
4ec855
With an additional detection in ./configure, the new arguments can
4ec855
conditionally get included in the glfs_io_cbk handler.
4ec855
4ec855
Signed-off-by: Niels de Vos <ndevos@redhat.com>
4ec855
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4ec855
(cherry picked from commit 0e3b891fefacc0e49f3c8ffa3a753b69eb7214d2)
4ec855
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4ec855
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4ec855
---
4ec855
 block/gluster.c |  6 +++++-
4ec855
 configure       | 24 ++++++++++++++++++++++++
4ec855
 2 files changed, 29 insertions(+), 1 deletion(-)
4ec855
4ec855
diff --git a/block/gluster.c b/block/gluster.c
4ec855
index e3ffa61..a6ac2b1 100644
4ec855
--- a/block/gluster.c
4ec855
+++ b/block/gluster.c
4ec855
@@ -729,7 +729,11 @@ static struct glfs *qemu_gluster_init(BlockdevOptionsGluster *gconf,
4ec855
 /*
4ec855
  * AIO callback routine called from GlusterFS thread.
4ec855
  */
4ec855
-static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg)
4ec855
+static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret,
4ec855
+#ifdef CONFIG_GLUSTERFS_IOCB_HAS_STAT
4ec855
+                                 struct glfs_stat *pre, struct glfs_stat *post,
4ec855
+#endif
4ec855
+                                 void *arg)
4ec855
 {
4ec855
     GlusterAIOCB *acb = (GlusterAIOCB *)arg;
4ec855
 
4ec855
diff --git a/configure b/configure
4ec855
index b3d337b..c9a1034 100755
4ec855
--- a/configure
4ec855
+++ b/configure
4ec855
@@ -430,6 +430,7 @@ glusterfs_discard="no"
4ec855
 glusterfs_fallocate="no"
4ec855
 glusterfs_zerofill="no"
4ec855
 glusterfs_ftruncate_has_stat="no"
4ec855
+glusterfs_iocb_has_stat="no"
4ec855
 gtk=""
4ec855
 gtkabi=""
4ec855
 gtk_gl="no"
4ec855
@@ -3933,6 +3934,25 @@ EOF
4ec855
     if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
4ec855
       glusterfs_ftruncate_has_stat="yes"
4ec855
     fi
4ec855
+    cat > $TMPC << EOF
4ec855
+#include <glusterfs/api/glfs.h>
4ec855
+
4ec855
+/* new glfs_io_cbk() passes two additional glfs_stat structs */
4ec855
+static void
4ec855
+glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data)
4ec855
+{}
4ec855
+
4ec855
+int
4ec855
+main(void)
4ec855
+{
4ec855
+	glfs_io_cbk iocb = &glusterfs_iocb;
4ec855
+	iocb(NULL, 0 , NULL, NULL, NULL);
4ec855
+	return 0;
4ec855
+}
4ec855
+EOF
4ec855
+    if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
4ec855
+      glusterfs_iocb_has_stat="yes"
4ec855
+    fi
4ec855
   else
4ec855
     if test "$glusterfs" = "yes" ; then
4ec855
       feature_not_found "GlusterFS backend support" \
4ec855
@@ -6640,6 +6660,10 @@ 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 "$glusterfs_iocb_has_stat" = "yes" ; then
4ec855
+  echo "CONFIG_GLUSTERFS_IOCB_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