diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-10-21 09:58:01 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2010-10-21 12:48:09 -0400 |
commit | 6d7bccc2215c37205ede6c9cf84db64e7c4f9443 (patch) | |
tree | 04864624eb5022eac6eec81d264b83e28fad2863 | |
parent | 073c21416268658bd1bc573af85eeac2ebb56ed5 (diff) |
BKL: remove BKL from freevxfs
All uses of the BKL in freevxfs were the result of a pushdown into
code that doesn't really need it. As Christoph points out, this
is a read-only file system, which eliminates most of the races in
readdir/lookup.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Christoph Hellwig <hch@infradead.org>
-rw-r--r-- | fs/freevxfs/vxfs_lookup.c | 14 | ||||
-rw-r--r-- | fs/freevxfs/vxfs_super.c | 10 |
2 files changed, 2 insertions, 22 deletions
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c index 0ec7bb2c95c6..6c5131d592f0 100644 --- a/fs/freevxfs/vxfs_lookup.c +++ b/fs/freevxfs/vxfs_lookup.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/highmem.h> | 36 | #include <linux/highmem.h> |
37 | #include <linux/kernel.h> | 37 | #include <linux/kernel.h> |
38 | #include <linux/pagemap.h> | 38 | #include <linux/pagemap.h> |
39 | #include <linux/smp_lock.h> | ||
40 | 39 | ||
41 | #include "vxfs.h" | 40 | #include "vxfs.h" |
42 | #include "vxfs_dir.h" | 41 | #include "vxfs_dir.h" |
@@ -212,16 +211,12 @@ vxfs_lookup(struct inode *dip, struct dentry *dp, struct nameidata *nd) | |||
212 | if (dp->d_name.len > VXFS_NAMELEN) | 211 | if (dp->d_name.len > VXFS_NAMELEN) |
213 | return ERR_PTR(-ENAMETOOLONG); | 212 | return ERR_PTR(-ENAMETOOLONG); |
214 | 213 | ||
215 | lock_kernel(); | ||
216 | ino = vxfs_inode_by_name(dip, dp); | 214 | ino = vxfs_inode_by_name(dip, dp); |
217 | if (ino) { | 215 | if (ino) { |
218 | ip = vxfs_iget(dip->i_sb, ino); | 216 | ip = vxfs_iget(dip->i_sb, ino); |
219 | if (IS_ERR(ip)) { | 217 | if (IS_ERR(ip)) |
220 | unlock_kernel(); | ||
221 | return ERR_CAST(ip); | 218 | return ERR_CAST(ip); |
222 | } | ||
223 | } | 219 | } |
224 | unlock_kernel(); | ||
225 | d_add(dp, ip); | 220 | d_add(dp, ip); |
226 | return NULL; | 221 | return NULL; |
227 | } | 222 | } |
@@ -248,8 +243,6 @@ vxfs_readdir(struct file *fp, void *retp, filldir_t filler) | |||
248 | u_long page, npages, block, pblocks, nblocks, offset; | 243 | u_long page, npages, block, pblocks, nblocks, offset; |
249 | loff_t pos; | 244 | loff_t pos; |
250 | 245 | ||
251 | lock_kernel(); | ||
252 | |||
253 | switch ((long)fp->f_pos) { | 246 | switch ((long)fp->f_pos) { |
254 | case 0: | 247 | case 0: |
255 | if (filler(retp, ".", 1, fp->f_pos, ip->i_ino, DT_DIR) < 0) | 248 | if (filler(retp, ".", 1, fp->f_pos, ip->i_ino, DT_DIR) < 0) |
@@ -265,10 +258,8 @@ vxfs_readdir(struct file *fp, void *retp, filldir_t filler) | |||
265 | 258 | ||
266 | pos = fp->f_pos - 2; | 259 | pos = fp->f_pos - 2; |
267 | 260 | ||
268 | if (pos > VXFS_DIRROUND(ip->i_size)) { | 261 | if (pos > VXFS_DIRROUND(ip->i_size)) |
269 | unlock_kernel(); | ||
270 | return 0; | 262 | return 0; |
271 | } | ||
272 | 263 | ||
273 | npages = dir_pages(ip); | 264 | npages = dir_pages(ip); |
274 | nblocks = dir_blocks(ip); | 265 | nblocks = dir_blocks(ip); |
@@ -327,6 +318,5 @@ vxfs_readdir(struct file *fp, void *retp, filldir_t filler) | |||
327 | done: | 318 | done: |
328 | fp->f_pos = ((page << PAGE_CACHE_SHIFT) | offset) + 2; | 319 | fp->f_pos = ((page << PAGE_CACHE_SHIFT) | offset) + 2; |
329 | out: | 320 | out: |
330 | unlock_kernel(); | ||
331 | return 0; | 321 | return 0; |
332 | } | 322 | } |
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index eb2b9e09c996..71b0148b8784 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/buffer_head.h> | 38 | #include <linux/buffer_head.h> |
39 | #include <linux/kernel.h> | 39 | #include <linux/kernel.h> |
40 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
41 | #include <linux/smp_lock.h> | ||
42 | #include <linux/stat.h> | 41 | #include <linux/stat.h> |
43 | #include <linux/vfs.h> | 42 | #include <linux/vfs.h> |
44 | #include <linux/mount.h> | 43 | #include <linux/mount.h> |
@@ -81,16 +80,12 @@ vxfs_put_super(struct super_block *sbp) | |||
81 | { | 80 | { |
82 | struct vxfs_sb_info *infp = VXFS_SBI(sbp); | 81 | struct vxfs_sb_info *infp = VXFS_SBI(sbp); |
83 | 82 | ||
84 | lock_kernel(); | ||
85 | |||
86 | vxfs_put_fake_inode(infp->vsi_fship); | 83 | vxfs_put_fake_inode(infp->vsi_fship); |
87 | vxfs_put_fake_inode(infp->vsi_ilist); | 84 | vxfs_put_fake_inode(infp->vsi_ilist); |
88 | vxfs_put_fake_inode(infp->vsi_stilist); | 85 | vxfs_put_fake_inode(infp->vsi_stilist); |
89 | 86 | ||
90 | brelse(infp->vsi_bp); | 87 | brelse(infp->vsi_bp); |
91 | kfree(infp); | 88 | kfree(infp); |
92 | |||
93 | unlock_kernel(); | ||
94 | } | 89 | } |
95 | 90 | ||
96 | /** | 91 | /** |
@@ -159,14 +154,11 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | |||
159 | struct inode *root; | 154 | struct inode *root; |
160 | int ret = -EINVAL; | 155 | int ret = -EINVAL; |
161 | 156 | ||
162 | lock_kernel(); | ||
163 | |||
164 | sbp->s_flags |= MS_RDONLY; | 157 | sbp->s_flags |= MS_RDONLY; |
165 | 158 | ||
166 | infp = kzalloc(sizeof(*infp), GFP_KERNEL); | 159 | infp = kzalloc(sizeof(*infp), GFP_KERNEL); |
167 | if (!infp) { | 160 | if (!infp) { |
168 | printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); | 161 | printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); |
169 | unlock_kernel(); | ||
170 | return -ENOMEM; | 162 | return -ENOMEM; |
171 | } | 163 | } |
172 | 164 | ||
@@ -239,7 +231,6 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | |||
239 | goto out_free_ilist; | 231 | goto out_free_ilist; |
240 | } | 232 | } |
241 | 233 | ||
242 | unlock_kernel(); | ||
243 | return 0; | 234 | return 0; |
244 | 235 | ||
245 | out_free_ilist: | 236 | out_free_ilist: |
@@ -249,7 +240,6 @@ out_free_ilist: | |||
249 | out: | 240 | out: |
250 | brelse(bp); | 241 | brelse(bp); |
251 | kfree(infp); | 242 | kfree(infp); |
252 | unlock_kernel(); | ||
253 | return ret; | 243 | return ret; |
254 | } | 244 | } |
255 | 245 | ||