diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-19 13:33:01 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-19 13:33:01 -0800 |
commit | 2874b391bd78a5b8cb84be67297a345fbdec4ac8 (patch) | |
tree | 5ba53c1207b14c6353e25faec0a58fad567a8558 /fs/9p/vfs_file.c | |
parent | 5fc77247f7db01b6377a5ea6ab18c8ac60021045 (diff) | |
parent | e03abc0c963a31cb07dfbc07c7d85d75e0d13cf4 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
9p: implement optional loose read cache
9p: Use kthread_stop instead of sending a SIGKILL.
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r-- | fs/9p/vfs_file.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 6c78343cf69..653dfa5b253 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) vfid->filp = file; kfree(fcall); + if((vfid->qid.version) && (v9ses->cache)) { + dprintk(DEBUG_VFS, "cached"); + /* enable cached file options */ + if(file->f_op == &v9fs_file_operations) + file->f_op = &v9fs_cached_file_operations; + } + return 0; Clunk_Fid: @@ -238,6 +245,17 @@ v9fs_file_write(struct file *filp, const char __user * data, return total; } +const struct file_operations v9fs_cached_file_operations = { + .llseek = generic_file_llseek, + .read = do_sync_read, + .aio_read = generic_file_aio_read, + .write = v9fs_file_write, + .open = v9fs_file_open, + .release = v9fs_dir_release, + .lock = v9fs_file_lock, + .mmap = generic_file_mmap, +}; + const struct file_operations v9fs_file_operations = { .llseek = generic_file_llseek, .read = v9fs_file_read, |