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

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