From e3d33f9371d7bfda0dc297a56400ca34881ced11 Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Mon, 28 Feb 2011 17:03:54 +0530 Subject: [PATCH] --- yaml --- r: 235019 b: refs/heads/master c: 29236f4e18dde0c772968b6ce965d0365fe3fe4e h: refs/heads/master i: 235017: 396c062132f216f9228ebd157f7fa3ebcf449907 235015: cc6e3690b18236068b9bb1c94cdfc6180cef3630 v: v3 --- [refs] | 2 +- trunk/fs/9p/v9fs_vfs.h | 2 ++ trunk/fs/9p/vfs_file.c | 18 ++++-------------- trunk/fs/9p/vfs_inode.c | 11 +++++++++-- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index eeb6e4eca6a1..d73262195263 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f735195d51e10b2550097f7b0ac12219060e962b +refs/heads/master: 29236f4e18dde0c772968b6ce965d0365fe3fe4e diff --git a/trunk/fs/9p/v9fs_vfs.h b/trunk/fs/9p/v9fs_vfs.h index b789f8e597ec..e4d5540cbb70 100644 --- a/trunk/fs/9p/v9fs_vfs.h +++ b/trunk/fs/9p/v9fs_vfs.h @@ -45,6 +45,8 @@ extern const struct file_operations v9fs_dir_operations; extern const struct file_operations v9fs_dir_operations_dotl; extern const struct dentry_operations v9fs_dentry_operations; extern const struct dentry_operations v9fs_cached_dentry_operations; +extern const struct file_operations v9fs_cached_file_operations; +extern const struct file_operations v9fs_cached_file_operations_dotl; #ifdef CONFIG_9P_FSCACHE struct inode *v9fs_alloc_inode(struct super_block *sb); diff --git a/trunk/fs/9p/vfs_file.c b/trunk/fs/9p/vfs_file.c index 240c30674396..6a671000263f 100644 --- a/trunk/fs/9p/vfs_file.c +++ b/trunk/fs/9p/vfs_file.c @@ -44,9 +44,6 @@ #include "fid.h" #include "cache.h" -static const struct file_operations v9fs_cached_file_operations; -static const struct file_operations v9fs_cached_file_operations_dotl; - /** * v9fs_file_open - open a file (or directory) * @inode: inode to be opened @@ -89,19 +86,12 @@ int v9fs_file_open(struct inode *inode, struct file *file) } file->private_data = fid; +#ifdef CONFIG_9P_FSCACHE if ((fid->qid.version) && (v9ses->cache)) { P9_DPRINTK(P9_DEBUG_VFS, "cached"); - /* enable cached file options */ - if(file->f_op == &v9fs_file_operations) - file->f_op = &v9fs_cached_file_operations; - else if (file->f_op == &v9fs_file_operations_dotl) - file->f_op = &v9fs_cached_file_operations_dotl; - -#ifdef CONFIG_9P_FSCACHE v9fs_cache_inode_set_cookie(inode, file); -#endif } - +#endif return 0; } @@ -505,7 +495,7 @@ int v9fs_file_fsync_dotl(struct file *filp, int datasync) return retval; } -static const struct file_operations v9fs_cached_file_operations = { +const struct file_operations v9fs_cached_file_operations = { .llseek = generic_file_llseek, .read = do_sync_read, .aio_read = generic_file_aio_read, @@ -517,7 +507,7 @@ static const struct file_operations v9fs_cached_file_operations = { .fsync = v9fs_file_fsync, }; -static const struct file_operations v9fs_cached_file_operations_dotl = { +const struct file_operations v9fs_cached_file_operations_dotl = { .llseek = generic_file_llseek, .read = do_sync_read, .aio_read = generic_file_aio_read, diff --git a/trunk/fs/9p/vfs_inode.c b/trunk/fs/9p/vfs_inode.c index b76a40bdf4c2..83af2b7e65db 100644 --- a/trunk/fs/9p/vfs_inode.c +++ b/trunk/fs/9p/vfs_inode.c @@ -292,10 +292,17 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode) case S_IFREG: if (v9fs_proto_dotl(v9ses)) { inode->i_op = &v9fs_file_inode_operations_dotl; - inode->i_fop = &v9fs_file_operations_dotl; + if (v9ses->cache) + inode->i_fop = + &v9fs_cached_file_operations_dotl; + else + inode->i_fop = &v9fs_file_operations_dotl; } else { inode->i_op = &v9fs_file_inode_operations; - inode->i_fop = &v9fs_file_operations; + if (v9ses->cache) + inode->i_fop = &v9fs_cached_file_operations; + else + inode->i_fop = &v9fs_file_operations; } break;