diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-02-28 06:33:54 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-03-15 10:57:36 -0400 |
commit | 29236f4e18dde0c772968b6ce965d0365fe3fe4e (patch) | |
tree | abbfd30756c96fbd3a318986b91738120ed058f8 /fs/9p/vfs_file.c | |
parent | f735195d51e10b2550097f7b0ac12219060e962b (diff) |
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.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 240c30674396..6a671000263f 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -44,9 +44,6 @@ | |||
44 | #include "fid.h" | 44 | #include "fid.h" |
45 | #include "cache.h" | 45 | #include "cache.h" |
46 | 46 | ||
47 | static const struct file_operations v9fs_cached_file_operations; | ||
48 | static const struct file_operations v9fs_cached_file_operations_dotl; | ||
49 | |||
50 | /** | 47 | /** |
51 | * v9fs_file_open - open a file (or directory) | 48 | * v9fs_file_open - open a file (or directory) |
52 | * @inode: inode to be opened | 49 | * @inode: inode to be opened |
@@ -89,19 +86,12 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
89 | } | 86 | } |
90 | 87 | ||
91 | file->private_data = fid; | 88 | file->private_data = fid; |
89 | #ifdef CONFIG_9P_FSCACHE | ||
92 | if ((fid->qid.version) && (v9ses->cache)) { | 90 | if ((fid->qid.version) && (v9ses->cache)) { |
93 | P9_DPRINTK(P9_DEBUG_VFS, "cached"); | 91 | P9_DPRINTK(P9_DEBUG_VFS, "cached"); |
94 | /* enable cached file options */ | ||
95 | if(file->f_op == &v9fs_file_operations) | ||
96 | file->f_op = &v9fs_cached_file_operations; | ||
97 | else if (file->f_op == &v9fs_file_operations_dotl) | ||
98 | file->f_op = &v9fs_cached_file_operations_dotl; | ||
99 | |||
100 | #ifdef CONFIG_9P_FSCACHE | ||
101 | v9fs_cache_inode_set_cookie(inode, file); | 92 | v9fs_cache_inode_set_cookie(inode, file); |
102 | #endif | ||
103 | } | 93 | } |
104 | 94 | #endif | |
105 | return 0; | 95 | return 0; |
106 | } | 96 | } |
107 | 97 | ||
@@ -505,7 +495,7 @@ int v9fs_file_fsync_dotl(struct file *filp, int datasync) | |||
505 | return retval; | 495 | return retval; |
506 | } | 496 | } |
507 | 497 | ||
508 | static const struct file_operations v9fs_cached_file_operations = { | 498 | const struct file_operations v9fs_cached_file_operations = { |
509 | .llseek = generic_file_llseek, | 499 | .llseek = generic_file_llseek, |
510 | .read = do_sync_read, | 500 | .read = do_sync_read, |
511 | .aio_read = generic_file_aio_read, | 501 | .aio_read = generic_file_aio_read, |
@@ -517,7 +507,7 @@ static const struct file_operations v9fs_cached_file_operations = { | |||
517 | .fsync = v9fs_file_fsync, | 507 | .fsync = v9fs_file_fsync, |
518 | }; | 508 | }; |
519 | 509 | ||
520 | static const struct file_operations v9fs_cached_file_operations_dotl = { | 510 | const struct file_operations v9fs_cached_file_operations_dotl = { |
521 | .llseek = generic_file_llseek, | 511 | .llseek = generic_file_llseek, |
522 | .read = do_sync_read, | 512 | .read = do_sync_read, |
523 | .aio_read = generic_file_aio_read, | 513 | .aio_read = generic_file_aio_read, |