summaryrefslogtreecommitdiffstats
path: root/fs/fuse/readdir.c
Commit message (Collapse)AuthorAgeFilesLines
* fuse: Protect fi->nlookup with fi->lockKirill Tkhai2019-02-131-2/+2
| | | | | | | | This continues previous patch and introduces the same protection for nlookup field. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* fuse: use iversion for readdir cache verificationMiklos Szeredi2018-10-011-1/+4
| | | | | | | | Use the internal iversion counter to make sure modifications of the directory through this filesystem are not missed by the mtime check (due to mtime granularity). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* fuse: use mtime for readdir cache verificationMiklos Szeredi2018-10-011-4/+34
| | | | | | | | | | | | | | Store the modification time of the directory in the cache, obtained before starting to fill the cache. When reading the cache, verify that the directory hasn't changed, by checking if current modification time is the same as the one stored in the cache. This only needs to be done when the current file position is at the beginning of the directory, as mandated by POSIX. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* fuse: add readdir cache versionMiklos Szeredi2018-10-011-1/+44
| | | | | | | | | | | | Allow the cache to be invalidated when page(s) have gone missing. In this case increment the version of the cache and reset to an empty state. Add a version number to the directory stream in struct fuse_file as well, indicating the version of the cache it's supposed to be reading. If the cache version doesn't match the stream's version, then reset the stream to the beginning of the cache. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* fuse: allow using readdir cacheMiklos Szeredi2018-10-011-4/+144
| | | | | | | | | | | | | | | | 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>
* fuse: allow caching readdirMiklos Szeredi2018-10-011-1/+90
| | | | | | | | | | | | | | | | | | 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>
* fuse: extract fuse_emit() helperMiklos Szeredi2018-09-281-4/+9
| | | | | | | Prepare for cache filling by introducing a helper for emitting a single directory entry. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* fuse: split out readdir.cMiklos Szeredi2018-09-281-0/+259
Directory reading code is about to grow larger, so split it out from dir.c into a new source file. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>