thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

73f313
From b9bf902e0a6739ba5db697fbd9b8f063dd130618 Mon Sep 17 00:00:00 2001
73f313
From: Maxim Levitsky <mlevitsk@redhat.com>
73f313
Date: Sun, 16 Feb 2020 16:02:25 +0100
73f313
Subject: [PATCH 5/6] gluster: the glfs_io_cbk callback function pointer adds
73f313
 pre/post stat args
73f313
73f313
Message-id: <20200216160225.22498-3-mlevitsk@redhat.com>
73f313
Patchwork-id: 93880
73f313
O-Subject: [RHEL-7.9 qemu-kvm PATCH 2/2] gluster: the glfs_io_cbk callback function pointer adds pre/post stat args
73f313
Bugzilla: 1802215
73f313
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
73f313
RH-Acked-by: Max Reitz <mreitz@redhat.com>
73f313
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
73f313
73f313
From: Niels de Vos <ndevos@redhat.com>
73f313
73f313
The glfs_*_async() functions do a callback once finished. This callback
73f313
has changed its arguments, pre- and post-stat structures have been
73f313
added. This makes it possible to improve caching, which is useful for
73f313
Samba and NFS-Ganesha, but not so much for QEMU. Gluster 6 is the first
73f313
release that includes these new arguments.
73f313
73f313
With an additional detection in ./configure, the new arguments can
73f313
conditionally get included in the glfs_io_cbk handler.
73f313
73f313
Signed-off-by: Niels de Vos <ndevos@redhat.com>
73f313
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
73f313
(cherry picked from commit 0e3b891fefacc0e49f3c8ffa3a753b69eb7214d2)
73f313
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
73f313
73f313
RHEL: first chunk of the patch was applied manually due to very
73f313
different context, for other chunks conficts were fixed.
73f313
73f313
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
73f313
---
73f313
 block/gluster.c |  7 ++++++-
73f313
 configure       | 24 ++++++++++++++++++++++++
73f313
 2 files changed, 30 insertions(+), 1 deletion(-)
73f313
73f313
diff --git a/block/gluster.c b/block/gluster.c
73f313
index d6160af..dba3e0a 100644
73f313
--- a/block/gluster.c
73f313
+++ b/block/gluster.c
73f313
@@ -571,7 +571,12 @@ static const AIOCBInfo gluster_aiocb_info = {
73f313
     .cancel = qemu_gluster_aio_cancel,
73f313
 };
73f313
 
73f313
-static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg)
73f313
+static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret,
73f313
+#ifdef CONFIG_GLUSTERFS_IOCB_HAS_STAT
73f313
+                                 struct glfs_stat *pre, struct glfs_stat *post,
73f313
+#endif
73f313
+                                 void *arg)
73f313
+
73f313
 {
73f313
     GlusterAIOCB *acb = (GlusterAIOCB *)arg;
73f313
     BlockDriverState *bs = acb->common.bs;
73f313
diff --git a/configure b/configure
73f313
index 70fd06f..34e3acc 100755
73f313
--- a/configure
73f313
+++ b/configure
73f313
@@ -244,6 +244,7 @@ glusterfs=""
73f313
 glusterfs_discard="no"
73f313
 virtio_blk_data_plane=""
73f313
 glusterfs_ftruncate_has_stat="no"
73f313
+glusterfs_iocb_has_stat="no"
73f313
 gtk=""
73f313
 gtkabi="2.0"
73f313
 tpm="no"
73f313
@@ -2762,6 +2763,25 @@ EOF
73f313
     if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
73f313
       glusterfs_ftruncate_has_stat="yes"
73f313
     fi
73f313
+    cat > $TMPC << EOF
73f313
+#include <glusterfs/api/glfs.h>
73f313
+
73f313
+/* new glfs_io_cbk() passes two additional glfs_stat structs */
73f313
+static void
73f313
+glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data)
73f313
+{}
73f313
+
73f313
+int
73f313
+main(void)
73f313
+{
73f313
+	glfs_io_cbk iocb = &glusterfs_iocb;
73f313
+	iocb(NULL, 0 , NULL, NULL, NULL);
73f313
+	return 0;
73f313
+}
73f313
+EOF
73f313
+    if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
73f313
+      glusterfs_iocb_has_stat="yes"
73f313
+    fi
73f313
   else
73f313
     if test "$glusterfs" = "yes" ; then
73f313
       feature_not_found "GlusterFS backend support"
73f313
@@ -4196,6 +4216,10 @@ if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
73f313
   echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
73f313
 fi
73f313
 
73f313
+if test "$glusterfs_iocb_has_stat" = "yes" ; then
73f313
+  echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak
73f313
+fi
73f313
+
73f313
 if test "$live_block_migration" = "yes" ; then
73f313
   echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
73f313
 fi
73f313
-- 
73f313
1.8.3.1
73f313