diff options
author | Eric Van Hensbergen <ericvh@kernel.org> | 2023-03-27 01:53:10 +0000 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@kernel.org> | 2023-04-09 21:41:21 +0000 |
commit | 4eb3117888a923f6b9b1ad2dd093641c49a63ae5 (patch) | |
tree | 789a090dabce6ae9a4c6b557cfcfbe6417170215 /fs/9p/vfs_file.c | |
parent | 1543b4c5071c54d76aad7a7a26a6e43082269b0c (diff) |
fs/9p: Rework cache modes and add new options to Documentation
Switch cache modes to a bit-mask and use legacy
cache names as shortcuts. Update documentation to
include information on both shortcuts and bitmasks.
This patch also fixes missing guards related to fscache.
Update the documentation for new mount flags
and cache modes.
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r-- | fs/9p/vfs_file.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 9f1d464bc1b5..07a67ac37ce2 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -41,13 +41,11 @@ static const struct vm_operations_struct v9fs_mmap_file_vm_ops; int v9fs_file_open(struct inode *inode, struct file *file) { int err; - struct v9fs_inode *v9inode; struct v9fs_session_info *v9ses; struct p9_fid *fid; int omode; p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file); - v9inode = V9FS_I(inode); v9ses = v9fs_inode2v9ses(inode); if (v9fs_proto_dotl(v9ses)) omode = v9fs_open_to_dotl_flags(file->f_flags); @@ -60,7 +58,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) if (IS_ERR(fid)) return PTR_ERR(fid); - if ((v9ses->cache >= CACHE_WRITEBACK) && (omode & P9_OWRITE)) { + if ((v9ses->cache & CACHE_WRITEBACK) && (omode & P9_OWRITE)) { int writeback_omode = (omode & ~P9_OWRITE) | P9_ORDWR; p9_debug(P9_DEBUG_CACHE, "write-only file with writeback enabled, try opening O_RDWR\n"); @@ -85,8 +83,8 @@ int v9fs_file_open(struct inode *inode, struct file *file) } #ifdef CONFIG_9P_FSCACHE - if (v9ses->cache == CACHE_FSCACHE) - fscache_use_cookie(v9fs_inode_cookie(v9inode), + if (v9ses->cache & CACHE_FSCACHE) + fscache_use_cookie(v9fs_inode_cookie(V9FS_I(inode)), file->f_mode & FMODE_WRITE); #endif v9fs_fid_add_modes(fid, v9ses->flags, v9ses->cache, file->f_flags); @@ -485,7 +483,7 @@ v9fs_file_mmap(struct file *filp, struct vm_area_struct *vma) p9_debug(P9_DEBUG_MMAP, "filp :%p\n", filp); - if (v9ses->cache < CACHE_MMAP) { + if (!(v9ses->cache & CACHE_WRITEBACK)) { p9_debug(P9_DEBUG_CACHE, "(no mmap mode)"); if (vma->vm_flags & VM_MAYSHARE) return -ENODEV; |