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/fuse_i.h | |
parent | 69e34551152a286f827d54dcb5700da6aeaac1fb (diff) |
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/fuse_i.h')
-rw-r--r-- | fs/fuse/fuse_i.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index d2fa7588533e..49e42635e3ac 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -163,6 +163,21 @@ struct fuse_file { /** Entry on inode's write_files list */ struct list_head write_entry; + /* Readdir related */ + struct { + /* + * Protects below fields against (crazy) parallel readdir on + * same open file. Uncontended in the normal case. + */ + struct mutex lock; + + /* Dir stream position */ + loff_t pos; + + /* Offset in cache */ + loff_t cache_off; + } readdir; + /** RB node to be linked on fuse_conn->polled_files */ struct rb_node polled_node; |