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

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