Blame SOURCES/0004-Add-support-for-in-kernel-readdir-caching.patch

f3781e
From da57354dc8593d37eff59bc7836ee4e460a2659a Mon Sep 17 00:00:00 2001
f3781e
From: Nikolaus Rath <Nikolaus@rath.org>
f3781e
Date: Sat, 6 Apr 2019 18:34:57 +0100
f3781e
Subject: [PATCH 4/4] Add support for in-kernel readdir caching.
f3781e
f3781e
Fixes: #394.
f3781e
(cherry picked from commit 1552b467fcd7751360299c5139382d78538e12b3)
f3781e
Signed-off-by: Pavel Reichl <preichl@redhat.com>
f3781e
---
f3781e
 include/fuse_common.h | 18 +++++++++++++-----
f3781e
 lib/fuse_lowlevel.c   |  2 ++
f3781e
 2 files changed, 15 insertions(+), 5 deletions(-)
f3781e
f3781e
diff --git a/include/fuse_common.h b/include/fuse_common.h
f3781e
index a5a0ea5..a28ffa5 100644
f3781e
--- a/include/fuse_common.h
f3781e
+++ b/include/fuse_common.h
f3781e
@@ -45,9 +45,11 @@ struct fuse_file_info {
f3781e
 	/** Can be filled in by open, to use direct I/O on this file. */
f3781e
 	unsigned int direct_io : 1;
f3781e
 
f3781e
-	/** Can be filled in by open, to indicate that currently
f3781e
-	    cached file data (that the filesystem provided the last
f3781e
-	    time the file was open) need not be invalidated. */
f3781e
+	/** Can be filled in by open. It signals the kernel that any
f3781e
+	    currently cached file data (ie., data that the filesystem
f3781e
+	    provided the last time the file was open) need not be
f3781e
+	    invalidated. Has no effect when set in other contexts (in
f3781e
+	    particular it does nothing when set by opendir()). */
f3781e
 	unsigned int keep_cache : 1;
f3781e
 
f3781e
 	/** Indicates a flush operation.  Set in flush operation, also
f3781e
@@ -64,8 +66,14 @@ struct fuse_file_info {
f3781e
 	   May only be set in ->release(). */
f3781e
 	unsigned int flock_release : 1;
f3781e
 
f3781e
-	/** Padding.  Do not use*/
f3781e
-	unsigned int padding : 27;
f3781e
+	/** Can be filled in by opendir. It signals the kernel to
f3781e
+	    enable caching of entries returned by readdir().  Has no
f3781e
+	    effect when set in other contexts (in particular it does
f3781e
+	    nothing when set by open()). */
f3781e
+	unsigned int cache_readdir : 1;
f3781e
+
f3781e
+	/** Padding.  Reserved for future use*/
f3781e
+	unsigned int padding : 26;
f3781e
 
f3781e
 	/** File handle.  May be filled in by filesystem in open().
f3781e
 	    Available in all other file operations */
f3781e
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
f3781e
index 43f785f..6379e09 100644
f3781e
--- a/lib/fuse_lowlevel.c
f3781e
+++ b/lib/fuse_lowlevel.c
f3781e
@@ -392,6 +392,8 @@ static void fill_open(struct fuse_open_out *arg,
f3781e
 		arg->open_flags |= FOPEN_DIRECT_IO;
f3781e
 	if (f->keep_cache)
f3781e
 		arg->open_flags |= FOPEN_KEEP_CACHE;
f3781e
+	if (f->cache_readdir)
f3781e
+		arg->open_flags |= FOPEN_CACHE_DIR;
f3781e
 	if (f->nonseekable)
f3781e
 		arg->open_flags |= FOPEN_NONSEEKABLE;
f3781e
 }
f3781e
-- 
f3781e
2.36.1
f3781e