Linux-Fsdevel Archive on lore.kernel.org
 help / Atom feed
* [PATCH] fuse: cache readdir calls if filesystem opts out of opendir
@ 2019-01-29  0:34 Chad Austin
  2019-02-04  7:43 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Chad Austin @ 2019-01-29  0:34 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: miklos, chad, Chad Austin

If a filesystem returns ENOSYS from opendir and thus opts out of
opendir and releasedir requests, it almost certainly would also like
readdir results cached. Default open_flags to FOPEN_KEEP_CACHE and
FOPEN_CACHE_DIR in that case.

With this patch, I've measured recursive directory enumeration across
large FUSE mounts to be faster than native mounts.

Signed-off-by: Chad Austin <chadaustin@fb.com>
---
 fs/fuse/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index cc6ffd23b80f..06096b60f1df 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -124,7 +124,8 @@ int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
 		return -ENOMEM;
 
 	ff->fh = 0;
-	ff->open_flags = FOPEN_KEEP_CACHE; /* Default for no-open */
+	/* Default for no-open */
+	ff->open_flags = FOPEN_KEEP_CACHE | (isdir ? FOPEN_CACHE_DIR : 0);
 	if (isdir ? !fc->no_opendir : !fc->no_open) {
 		struct fuse_open_out outarg;
 		int err;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fuse: cache readdir calls if filesystem opts out of opendir
  2019-01-29  0:34 [PATCH] fuse: cache readdir calls if filesystem opts out of opendir Chad Austin
@ 2019-02-04  7:43 ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2019-02-04  7:43 UTC (permalink / raw)
  To: Chad Austin; +Cc: linux-fsdevel, chad

On Tue, Jan 29, 2019 at 1:34 AM Chad Austin <chadaustin@fb.com> wrote:
>
> If a filesystem returns ENOSYS from opendir and thus opts out of
> opendir and releasedir requests, it almost certainly would also like
> readdir results cached. Default open_flags to FOPEN_KEEP_CACHE and
> FOPEN_CACHE_DIR in that case.
>
> With this patch, I've measured recursive directory enumeration across
> large FUSE mounts to be faster than native mounts.
>
> Signed-off-by: Chad Austin <chadaustin@fb.com>

Thanks, applied.

Miklos

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29  0:34 [PATCH] fuse: cache readdir calls if filesystem opts out of opendir Chad Austin
2019-02-04  7:43 ` Miklos Szeredi

Linux-Fsdevel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-fsdevel/0 linux-fsdevel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-fsdevel linux-fsdevel/ https://lore.kernel.org/linux-fsdevel \
		linux-fsdevel@vger.kernel.org linux-fsdevel@archiver.kernel.org
	public-inbox-index linux-fsdevel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-fsdevel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox