From 344504e912ea49033d012dad9de3f68e20c07634 Mon Sep 17 00:00:00 2001 From: Eric Van Hensbergen Date: Thu, 8 Dec 2022 02:03:32 +0000 Subject: fs/9p: Expand setup of writeback cache to all levels If cache is enabled, make sure we are putting the right things in place (mainly impacts mmap). This also sets us up for more cache levels. Signed-off-by: Eric Van Hensbergen Reviewed-by: Dominique Martinet --- fs/9p/vfs_file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'fs/9p/vfs_file.c') diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index b740017634ef..3b6458846a0b 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -73,8 +73,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) } mutex_lock(&v9inode->v_mutex); - if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && - !v9inode->writeback_fid && + if ((v9ses->cache) && !v9inode->writeback_fid && ((file->f_flags & O_ACCMODE) != O_RDONLY)) { /* * clone a fid and add it to writeback_fid @@ -92,9 +91,11 @@ int v9fs_file_open(struct inode *inode, struct file *file) v9inode->writeback_fid = (void *) writeback_fid; } mutex_unlock(&v9inode->v_mutex); - if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) +#ifdef CONFIG_9P_FSCACHE + if (v9ses->cache == CACHE_FSCACHE) fscache_use_cookie(v9fs_inode_cookie(v9inode), file->f_mode & FMODE_WRITE); +#endif v9fs_open_fid_add(inode, &fid); return 0; out_error: -- cgit v1.2.3-58-ga151