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