fuse: allow using readdir cache
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 1 Oct 2018 08:07:04 +0000 (10:07 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 1 Oct 2018 08:07:04 +0000 (10:07 +0200)
commit5d7bc7e8680c7ca4c8a4f139ce2a54ccb8131ef0
treee1d3c9478d7fb32a90e20ec02e55b0ff40a647b8
parent69e34551152a286f827d54dcb5700da6aeaac1fb
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>
fs/fuse/file.c
fs/fuse/fuse_i.h
fs/fuse/readdir.c