summaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_file.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-02-28 17:03:54 +0530
committerEric Van Hensbergen <ericvh@gmail.com>2011-03-15 09:57:36 -0500
commit29236f4e18dde0c772968b6ce965d0365fe3fe4e (patch)
treeabbfd30756c96fbd3a318986b91738120ed058f8 /fs/9p/vfs_file.c
parentf735195d51e10b2550097f7b0ac12219060e962b (diff)
downloadop-kernel-dev-29236f4e18dde0c772968b6ce965d0365fe3fe4e.zip
op-kernel-dev-29236f4e18dde0c772968b6ce965d0365fe3fe4e.tar.gz
fs/9p: set the cached file_operations struct during inode init
With the old code we were not setting the file->f_op with cached file operations during creat. (format correction by jvrao@linux.vnet.ibm.com) Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> 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, 4 insertions, 14 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 240c306..6a67100 100644
--- a/fs/9p/vfs_file.c
+++ b/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,
OpenPOWER on IntegriCloud