yeahuh / rpms / qemu-kvm

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