aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_file.c
diff options
context:
space:
mode:
authorEric Van Hensbergen <ericvh@gmail.com>2007-02-11 14:21:39 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2007-02-18 11:16:10 -0500
commite03abc0c963a31cb07dfbc07c7d85d75e0d13cf4 (patch)
tree1840001bde4a7f9f01d39dd09baf7d7b04e95706 /fs/9p/vfs_file.c
parent2c0463a9ae8751547c39302aeb31c6cef16b5df4 (diff)
9p: implement optional loose read cache
While cacheing is generally frowned upon in the 9p world, it has its place -- particularly in situations where the remote file system is exclusive and/or read-only. The vacfs views of venti content addressable store are a real-world instance of such a situation. To facilitate higher performance for these workloads (and eventually use the fscache patches), we have enabled a "loose" cache mode which does not attempt to maintain any form of consistency on the page-cache or dcache. This results in over two orders of magnitude performance improvement for cacheable block reads in the Bonnie benchmark. The more aggressive use of the dcache also seems to improve metadata operational performance. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r--fs/9p/vfs_file.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 6c78343cf690..653dfa5b2531 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -79,6 +79,13 @@ int v9fs_file_open(struct inode *inode, struct file *file)
79 vfid->filp = file; 79 vfid->filp = file;
80 kfree(fcall); 80 kfree(fcall);
81 81
82 if((vfid->qid.version) && (v9ses->cache)) {
83 dprintk(DEBUG_VFS, "cached");
84 /* enable cached file options */
85 if(file->f_op == &v9fs_file_operations)
86 file->f_op = &v9fs_cached_file_operations;
87 }
88
82 return 0; 89 return 0;
83 90
84Clunk_Fid: 91Clunk_Fid:
@@ -238,6 +245,17 @@ v9fs_file_write(struct file *filp, const char __user * data,
238 return total; 245 return total;
239} 246}
240 247
248const struct file_operations v9fs_cached_file_operations = {
249 .llseek = generic_file_llseek,
250 .read = do_sync_read,
251 .aio_read = generic_file_aio_read,
252 .write = v9fs_file_write,
253 .open = v9fs_file_open,
254 .release = v9fs_dir_release,
255 .lock = v9fs_file_lock,
256 .mmap = generic_file_mmap,
257};
258
241const struct file_operations v9fs_file_operations = { 259const struct file_operations v9fs_file_operations = {
242 .llseek = generic_file_llseek, 260 .llseek = generic_file_llseek,
243 .read = v9fs_file_read, 261 .read = v9fs_file_read,