diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2018-10-01 10:07:04 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2018-10-01 10:07:04 +0200 |
commit | 5d7bc7e8680c7ca4c8a4f139ce2a54ccb8131ef0 (patch) | |
tree | e1d3c9478d7fb32a90e20ec02e55b0ff40a647b8 /fs/fuse/file.c | |
parent | 69e34551152a286f827d54dcb5700da6aeaac1fb (diff) | |
download | lwn-5d7bc7e8680c7ca4c8a4f139ce2a54ccb8131ef0.tar.gz lwn-5d7bc7e8680c7ca4c8a4f139ce2a54ccb8131ef0.zip |
fuse: allow using readdir cache
The cache is only used if it's completed, not while it's still being
filled; this constraint could be lifted later, if it turns out to be
useful.
Introduce state in struct fuse_file that indicates the position within the
cache. After a seek, reset the position to the beginning of the cache and
search the cache for the current position. If the current position is not
found in the cache, then fall back to uncached readdir.
It can also happen that page(s) disappear from the cache, in which case we
must also fall back to uncached readdir.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r-- | fs/fuse/file.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index d15c14912e72..e10c0443c56f 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -59,6 +59,7 @@ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc) } INIT_LIST_HEAD(&ff->write_entry); + mutex_init(&ff->readdir.lock); refcount_set(&ff->count, 1); RB_CLEAR_NODE(&ff->polled_node); init_waitqueue_head(&ff->poll_wait); @@ -73,6 +74,7 @@ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc) void fuse_file_free(struct fuse_file *ff) { fuse_request_free(ff->reserved_req); + mutex_destroy(&ff->readdir.lock); kfree(ff); } |