aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda/file.c
diff options
context:
space:
mode:
authorYoshihisa Abe <yoshiabe@cs.cmu.edu>2010-10-25 02:03:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 11:02:40 -0400
commitf7cc02b8715618e179242ba9cc10bdc5146ae565 (patch)
tree80c1bcf6923c9982a52fbe510cb7d396fb9866fc /fs/coda/file.c
parentb5ce1d83a62fc109d8e815b1fc71dcdb0d26bc49 (diff)
Coda: push BKL regions into coda_upcall()
Now that shared inode state is locked using the cii->c_lock, the BKL is only used to protect the upcall queues used to communicate with the userspace cache manager. The remaining state is all local and we can push the lock further down into coda_upcall(). Signed-off-by: Yoshihisa Abe <yoshiabe@cs.cmu.edu> Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/coda/file.c')
-rw-r--r--fs/coda/file.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/fs/coda/file.c b/fs/coda/file.c
index c4e395781d41..c8b50ba4366a 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -15,7 +15,6 @@
15#include <linux/stat.h> 15#include <linux/stat.h>
16#include <linux/cred.h> 16#include <linux/cred.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/smp_lock.h>
19#include <linux/spinlock.h> 18#include <linux/spinlock.h>
20#include <linux/string.h> 19#include <linux/string.h>
21#include <linux/slab.h> 20#include <linux/slab.h>
@@ -144,8 +143,6 @@ int coda_open(struct inode *coda_inode, struct file *coda_file)
144 if (!cfi) 143 if (!cfi)
145 return -ENOMEM; 144 return -ENOMEM;
146 145
147 lock_kernel();
148
149 error = venus_open(coda_inode->i_sb, coda_i2f(coda_inode), coda_flags, 146 error = venus_open(coda_inode->i_sb, coda_i2f(coda_inode), coda_flags,
150 &host_file); 147 &host_file);
151 if (!host_file) 148 if (!host_file)
@@ -153,7 +150,6 @@ int coda_open(struct inode *coda_inode, struct file *coda_file)
153 150
154 if (error) { 151 if (error) {
155 kfree(cfi); 152 kfree(cfi);
156 unlock_kernel();
157 return error; 153 return error;
158 } 154 }
159 155
@@ -165,8 +161,6 @@ int coda_open(struct inode *coda_inode, struct file *coda_file)
165 161
166 BUG_ON(coda_file->private_data != NULL); 162 BUG_ON(coda_file->private_data != NULL);
167 coda_file->private_data = cfi; 163 coda_file->private_data = cfi;
168
169 unlock_kernel();
170 return 0; 164 return 0;
171} 165}
172 166
@@ -177,9 +171,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file)
177 struct coda_file_info *cfi; 171 struct coda_file_info *cfi;
178 struct coda_inode_info *cii; 172 struct coda_inode_info *cii;
179 struct inode *host_inode; 173 struct inode *host_inode;
180 int err = 0; 174 int err;
181
182 lock_kernel();
183 175
184 cfi = CODA_FTOC(coda_file); 176 cfi = CODA_FTOC(coda_file);
185 BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); 177 BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
@@ -203,8 +195,6 @@ int coda_release(struct inode *coda_inode, struct file *coda_file)
203 kfree(coda_file->private_data); 195 kfree(coda_file->private_data);
204 coda_file->private_data = NULL; 196 coda_file->private_data = NULL;
205 197
206 unlock_kernel();
207
208 /* VFS fput ignores the return value from file_operations->release, so 198 /* VFS fput ignores the return value from file_operations->release, so
209 * there is no use returning an error here */ 199 * there is no use returning an error here */
210 return 0; 200 return 0;
@@ -215,7 +205,7 @@ int coda_fsync(struct file *coda_file, int datasync)
215 struct file *host_file; 205 struct file *host_file;
216 struct inode *coda_inode = coda_file->f_path.dentry->d_inode; 206 struct inode *coda_inode = coda_file->f_path.dentry->d_inode;
217 struct coda_file_info *cfi; 207 struct coda_file_info *cfi;
218 int err = 0; 208 int err;
219 209
220 if (!(S_ISREG(coda_inode->i_mode) || S_ISDIR(coda_inode->i_mode) || 210 if (!(S_ISREG(coda_inode->i_mode) || S_ISDIR(coda_inode->i_mode) ||
221 S_ISLNK(coda_inode->i_mode))) 211 S_ISLNK(coda_inode->i_mode)))
@@ -226,11 +216,8 @@ int coda_fsync(struct file *coda_file, int datasync)
226 host_file = cfi->cfi_container; 216 host_file = cfi->cfi_container;
227 217
228 err = vfs_fsync(host_file, datasync); 218 err = vfs_fsync(host_file, datasync);
229 if ( !err && !datasync ) { 219 if (!err && !datasync)
230 lock_kernel();
231 err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode)); 220 err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode));
232 unlock_kernel();
233 }
234 221
235 return err; 222 return err;
236} 223}