diff options
author | Eric Van Hensbergen <ericvh@kernel.org> | 2022-12-08 02:40:37 +0000 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@kernel.org> | 2023-03-27 02:33:39 +0000 |
commit | d9bc0d11e33bd7b6bfeedc570cd5738e5b4c7ca8 (patch) | |
tree | b37a1976408102f8bf285272558f9e83d69955d6 /fs/9p/vfs_dir.c | |
parent | fe15c26ee26efa11741a7b632e9f23b01aca4cc6 (diff) |
fs/9p: Consolidate file operations and add readahead and writeback
We had 3 different sets of file operations across 2 different protocol
variants differentiated by cache which really only changed 3
functions. But the real problem is that certain file modes, mount
options, and other factors weren't being considered when we
decided whether or not to use caches.
This consolidates all the operations and switches
to conditionals within a common set to decide whether or not
to do different aspects of caching.
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
Reviewed-by: Dominique Martinet <asmadeus@codewreck.org>
Diffstat (limited to 'fs/9p/vfs_dir.c')
-rw-r--r-- | fs/9p/vfs_dir.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index 3d74b04fe0de..289b58cb896e 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c @@ -197,9 +197,9 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx) /** - * v9fs_dir_release - called on a close of a file or directory - * @inode: inode of the directory - * @filp: file pointer to a directory + * v9fs_dir_release - close a directory or a file + * @inode: inode of the directory or file + * @filp: file pointer to a directory or file * */ @@ -214,7 +214,11 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) fid = filp->private_data; p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n", inode, filp, fid ? fid->fid : -1); + if (fid) { + if ((S_ISREG(inode->i_mode)) && (filp->f_mode & FMODE_WRITE)) + retval = filemap_fdatawrite(inode->i_mapping); + spin_lock(&inode->i_lock); hlist_del(&fid->ilist); spin_unlock(&inode->i_lock); |