aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs/dir.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-01-22 14:26:12 -0500
committerArnd Bergmann <arnd@arndb.de>2011-03-02 16:27:36 -0500
commit9a311b96c3065f362e3348cb5d7af1a57ca6bff9 (patch)
treeaed281e9ff7c5e689895ff838e886dff77e3e2e9 /fs/hpfs/dir.c
parent5edc341313a188d94cde7ef87ac31647cea8601a (diff)
hpfs: remove the BKL
This removes the BKL in hpfs in a rather awful way, by making the code only work on uniprocessor systems without kernel preemption, as suggested by Andi Kleen. The HPFS code probably has close to zero remaining users on current kernels, all archeological uses of the file system can probably be done with the significant restrictions. The hpfs_lock/hpfs_unlock functions are left in the code, sincen Mikulas has indicated that he is still interested in fixing it in a better way. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Andi Kleen <ak@linux.intel.com> Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> Cc: linux-fsdevel@vger.kernel.org
Diffstat (limited to 'fs/hpfs/dir.c')
-rw-r--r--fs/hpfs/dir.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c
index d32f63a569f7..b3d7c0ddb609 100644
--- a/fs/hpfs/dir.c
+++ b/fs/hpfs/dir.c
@@ -6,16 +6,15 @@
6 * directory VFS functions 6 * directory VFS functions
7 */ 7 */
8 8
9#include <linux/smp_lock.h>
10#include <linux/slab.h> 9#include <linux/slab.h>
11#include "hpfs_fn.h" 10#include "hpfs_fn.h"
12 11
13static int hpfs_dir_release(struct inode *inode, struct file *filp) 12static int hpfs_dir_release(struct inode *inode, struct file *filp)
14{ 13{
15 lock_kernel(); 14 hpfs_lock(inode->i_sb);
16 hpfs_del_pos(inode, &filp->f_pos); 15 hpfs_del_pos(inode, &filp->f_pos);
17 /*hpfs_write_if_changed(inode);*/ 16 /*hpfs_write_if_changed(inode);*/
18 unlock_kernel(); 17 hpfs_unlock(inode->i_sb);
19 return 0; 18 return 0;
20} 19}
21 20
@@ -30,7 +29,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
30 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); 29 struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
31 struct super_block *s = i->i_sb; 30 struct super_block *s = i->i_sb;
32 31
33 lock_kernel(); 32 hpfs_lock(s);
34 33
35 /*printk("dir lseek\n");*/ 34 /*printk("dir lseek\n");*/
36 if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok; 35 if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok;
@@ -43,12 +42,12 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
43 } 42 }
44 mutex_unlock(&i->i_mutex); 43 mutex_unlock(&i->i_mutex);
45ok: 44ok:
46 unlock_kernel(); 45 hpfs_unlock(s);
47 return filp->f_pos = new_off; 46 return filp->f_pos = new_off;
48fail: 47fail:
49 mutex_unlock(&i->i_mutex); 48 mutex_unlock(&i->i_mutex);
50 /*printk("illegal lseek: %016llx\n", new_off);*/ 49 /*printk("illegal lseek: %016llx\n", new_off);*/
51 unlock_kernel(); 50 hpfs_unlock(s);
52 return -ESPIPE; 51 return -ESPIPE;
53} 52}
54 53
@@ -64,7 +63,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
64 int c1, c2 = 0; 63 int c1, c2 = 0;
65 int ret = 0; 64 int ret = 0;
66 65
67 lock_kernel(); 66 hpfs_lock(inode->i_sb);
68 67
69 if (hpfs_sb(inode->i_sb)->sb_chk) { 68 if (hpfs_sb(inode->i_sb)->sb_chk) {
70 if (hpfs_chk_sectors(inode->i_sb, inode->i_ino, 1, "dir_fnode")) { 69 if (hpfs_chk_sectors(inode->i_sb, inode->i_ino, 1, "dir_fnode")) {
@@ -167,7 +166,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
167 hpfs_brelse4(&qbh); 166 hpfs_brelse4(&qbh);
168 } 167 }
169out: 168out:
170 unlock_kernel(); 169 hpfs_unlock(inode->i_sb);
171 return ret; 170 return ret;
172} 171}
173 172
@@ -197,10 +196,10 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
197 struct inode *result = NULL; 196 struct inode *result = NULL;
198 struct hpfs_inode_info *hpfs_result; 197 struct hpfs_inode_info *hpfs_result;
199 198
200 lock_kernel(); 199 hpfs_lock(dir->i_sb);
201 if ((err = hpfs_chk_name(name, &len))) { 200 if ((err = hpfs_chk_name(name, &len))) {
202 if (err == -ENAMETOOLONG) { 201 if (err == -ENAMETOOLONG) {
203 unlock_kernel(); 202 hpfs_unlock(dir->i_sb);
204 return ERR_PTR(-ENAMETOOLONG); 203 return ERR_PTR(-ENAMETOOLONG);
205 } 204 }
206 goto end_add; 205 goto end_add;
@@ -298,7 +297,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
298 297
299 end: 298 end:
300 end_add: 299 end_add:
301 unlock_kernel(); 300 hpfs_unlock(dir->i_sb);
302 d_add(dentry, result); 301 d_add(dentry, result);
303 return NULL; 302 return NULL;
304 303
@@ -311,7 +310,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
311 310
312 /*bail:*/ 311 /*bail:*/
313 312
314 unlock_kernel(); 313 hpfs_unlock(dir->i_sb);
315 return ERR_PTR(-ENOENT); 314 return ERR_PTR(-ENOENT);
316} 315}
317 316