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

4636b8
From d0cf28359d8fee8437d664f98121b8af85a5d12e Mon Sep 17 00:00:00 2001
4636b8
From: Maxim Levitsky <mlevitsk@redhat.com>
4636b8
Date: Mon, 17 Feb 2020 14:52:05 -0500
4636b8
Subject: [PATCH 02/12] gluster: the glfs_io_cbk callback function pointer adds
4636b8
 pre/post stat args
4636b8
4636b8
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
4636b8
Message-id: <20200217145205.21347-3-mlevitsk@redhat.com>
4636b8
Patchwork-id: 93893
4636b8
O-Subject: [RHEL-7.9 qemu-kvm-rhev PATCH 2/2] gluster: the glfs_io_cbk callback function pointer adds pre/post stat args
4636b8
Bugzilla: 1802216
4636b8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4636b8
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
4636b8
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
4636b8
4636b8
From: Niels de Vos <ndevos@redhat.com>
4636b8
4636b8
The glfs_*_async() functions do a callback once finished. This callback
4636b8
has changed its arguments, pre- and post-stat structures have been
4636b8
added. This makes it possible to improve caching, which is useful for
4636b8
Samba and NFS-Ganesha, but not so much for QEMU. Gluster 6 is the first
4636b8
release that includes these new arguments.
4636b8
4636b8
With an additional detection in ./configure, the new arguments can
4636b8
conditionally get included in the glfs_io_cbk handler.
4636b8
4636b8
Signed-off-by: Niels de Vos <ndevos@redhat.com>
4636b8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4636b8
(cherry picked from commit 0e3b891fefacc0e49f3c8ffa3a753b69eb7214d2)
4636b8
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
4636b8
Signed-off-by: Jon Maloy <jmaloy.redhat.com>
4636b8
---
4636b8
 block/gluster.c |  6 +++++-
4636b8
 configure       | 24 ++++++++++++++++++++++++
4636b8
 2 files changed, 29 insertions(+), 1 deletion(-)
4636b8
4636b8
diff --git a/block/gluster.c b/block/gluster.c
4636b8
index e3ffa6136e..a6ac2b1dc1 100644
4636b8
--- a/block/gluster.c
4636b8
+++ b/block/gluster.c
4636b8
@@ -729,7 +729,11 @@ static struct glfs *qemu_gluster_init(BlockdevOptionsGluster *gconf,
4636b8
 /*
4636b8
  * AIO callback routine called from GlusterFS thread.
4636b8
  */
4636b8
-static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg)
4636b8
+static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret,
4636b8
+#ifdef CONFIG_GLUSTERFS_IOCB_HAS_STAT
4636b8
+                                 struct glfs_stat *pre, struct glfs_stat *post,
4636b8
+#endif
4636b8
+                                 void *arg)
4636b8
 {
4636b8
     GlusterAIOCB *acb = (GlusterAIOCB *)arg;
4636b8
 
4636b8
diff --git a/configure b/configure
4636b8
index f78663367e..da50c091df 100755
4636b8
--- a/configure
4636b8
+++ b/configure
4636b8
@@ -430,6 +430,7 @@ glusterfs_discard="no"
4636b8
 glusterfs_fallocate="no"
4636b8
 glusterfs_zerofill="no"
4636b8
 glusterfs_ftruncate_has_stat="no"
4636b8
+glusterfs_iocb_has_stat="no"
4636b8
 gtk=""
4636b8
 gtkabi=""
4636b8
 gtk_gl="no"
4636b8
@@ -3885,6 +3886,25 @@ EOF
4636b8
     if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
4636b8
       glusterfs_ftruncate_has_stat="yes"
4636b8
     fi
4636b8
+    cat > $TMPC << EOF
4636b8
+#include <glusterfs/api/glfs.h>
4636b8
+
4636b8
+/* new glfs_io_cbk() passes two additional glfs_stat structs */
4636b8
+static void
4636b8
+glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data)
4636b8
+{}
4636b8
+
4636b8
+int
4636b8
+main(void)
4636b8
+{
4636b8
+	glfs_io_cbk iocb = &glusterfs_iocb;
4636b8
+	iocb(NULL, 0 , NULL, NULL, NULL);
4636b8
+	return 0;
4636b8
+}
4636b8
+EOF
4636b8
+    if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
4636b8
+      glusterfs_iocb_has_stat="yes"
4636b8
+    fi
4636b8
   else
4636b8
     if test "$glusterfs" = "yes" ; then
4636b8
       feature_not_found "GlusterFS backend support" \
4636b8
@@ -6547,6 +6567,10 @@ if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
4636b8
   echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
4636b8
 fi
4636b8
 
4636b8
+if test "$glusterfs_iocb_has_stat" = "yes" ; then
4636b8
+  echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak
4636b8
+fi
4636b8
+
4636b8
 if test "$libssh2" = "yes" ; then
4636b8
   echo "CONFIG_LIBSSH2=m" >> $config_host_mak
4636b8
   echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
4636b8
-- 
4636b8
2.18.2
4636b8