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 | 69e34551152a286f827d54dcb5700da6aeaac1fb (patch) | |
tree | d18a844cec3ea412706240835f80a82bd41b2fb8 /fs/fuse/fuse_i.h | |
parent | 18172b10b674a7cd5340b2dd70202ce6622400bd (diff) | |
download | linux-stable-69e34551152a286f827d54dcb5700da6aeaac1fb.tar.gz linux-stable-69e34551152a286f827d54dcb5700da6aeaac1fb.tar.bz2 linux-stable-69e34551152a286f827d54dcb5700da6aeaac1fb.zip |
fuse: allow caching readdir
This patch just adds the cache filling functions, which are invoked if
FOPEN_CACHE_DIR flag is set in the OPENDIR reply.
Cache reading and cache invalidation are added by subsequent patches.
The directory cache uses the page cache. Directory entries are packed into
a page in the same format as in the READDIR reply. A page only contains
whole entries, the space at the end of the page is cleared. The page is
locked while being modified.
Multiple parallel readdirs on the same directory can fill the cache; the
only constraint is that continuity must be maintained (d_off of last entry
points to position of current entry).
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 dfe10c2df6a9..d2fa7588533e 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -103,6 +103,21 @@ struct fuse_inode { /** List of writepage requestst (pending or sent) */ struct list_head writepages; + /* readdir cache */ + struct { + /* true if fully cached */ + bool cached; + + /* size of cache */ + loff_t size; + + /* position at end of cache (position of next entry) */ + loff_t pos; + + /* protects above fields */ + spinlock_t lock; + } rdc; + /** Miscellaneous bits describing inode state */ unsigned long state; |