diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-06-16 23:47:45 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-06-17 00:36:37 -0400 |
commit | cc46759a8c0ac4c6f13aa4b0f470305c05f600e1 (patch) | |
tree | 040decb4fb0625527ea882fb069385fb9be0cdaf /fs | |
parent | e7ec952f6aa6ac1649ac49eb5e4de5b92c829d1e (diff) |
get rid of BKL in fs/minix
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/minix/bitmap.c | 25 | ||||
-rw-r--r-- | fs/minix/dir.c | 5 | ||||
-rw-r--r-- | fs/minix/inode.c | 4 |
3 files changed, 14 insertions, 20 deletions
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c index 3aebe322271a..6ac693faae49 100644 --- a/fs/minix/bitmap.c +++ b/fs/minix/bitmap.c | |||
@@ -12,13 +12,14 @@ | |||
12 | /* bitmap.c contains the code that handles the inode and block bitmaps */ | 12 | /* bitmap.c contains the code that handles the inode and block bitmaps */ |
13 | 13 | ||
14 | #include "minix.h" | 14 | #include "minix.h" |
15 | #include <linux/smp_lock.h> | ||
16 | #include <linux/buffer_head.h> | 15 | #include <linux/buffer_head.h> |
17 | #include <linux/bitops.h> | 16 | #include <linux/bitops.h> |
18 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
19 | 18 | ||
20 | static const int nibblemap[] = { 4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0 }; | 19 | static const int nibblemap[] = { 4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0 }; |
21 | 20 | ||
21 | static DEFINE_SPINLOCK(bitmap_lock); | ||
22 | |||
22 | static unsigned long count_free(struct buffer_head *map[], unsigned numblocks, __u32 numbits) | 23 | static unsigned long count_free(struct buffer_head *map[], unsigned numblocks, __u32 numbits) |
23 | { | 24 | { |
24 | unsigned i, j, sum = 0; | 25 | unsigned i, j, sum = 0; |
@@ -69,11 +70,11 @@ void minix_free_block(struct inode *inode, unsigned long block) | |||
69 | return; | 70 | return; |
70 | } | 71 | } |
71 | bh = sbi->s_zmap[zone]; | 72 | bh = sbi->s_zmap[zone]; |
72 | lock_kernel(); | 73 | spin_lock(&bitmap_lock); |
73 | if (!minix_test_and_clear_bit(bit, bh->b_data)) | 74 | if (!minix_test_and_clear_bit(bit, bh->b_data)) |
74 | printk("minix_free_block (%s:%lu): bit already cleared\n", | 75 | printk("minix_free_block (%s:%lu): bit already cleared\n", |
75 | sb->s_id, block); | 76 | sb->s_id, block); |
76 | unlock_kernel(); | 77 | spin_unlock(&bitmap_lock); |
77 | mark_buffer_dirty(bh); | 78 | mark_buffer_dirty(bh); |
78 | return; | 79 | return; |
79 | } | 80 | } |
@@ -88,18 +89,18 @@ int minix_new_block(struct inode * inode) | |||
88 | struct buffer_head *bh = sbi->s_zmap[i]; | 89 | struct buffer_head *bh = sbi->s_zmap[i]; |
89 | int j; | 90 | int j; |
90 | 91 | ||
91 | lock_kernel(); | 92 | spin_lock(&bitmap_lock); |
92 | j = minix_find_first_zero_bit(bh->b_data, bits_per_zone); | 93 | j = minix_find_first_zero_bit(bh->b_data, bits_per_zone); |
93 | if (j < bits_per_zone) { | 94 | if (j < bits_per_zone) { |
94 | minix_set_bit(j, bh->b_data); | 95 | minix_set_bit(j, bh->b_data); |
95 | unlock_kernel(); | 96 | spin_unlock(&bitmap_lock); |
96 | mark_buffer_dirty(bh); | 97 | mark_buffer_dirty(bh); |
97 | j += i * bits_per_zone + sbi->s_firstdatazone-1; | 98 | j += i * bits_per_zone + sbi->s_firstdatazone-1; |
98 | if (j < sbi->s_firstdatazone || j >= sbi->s_nzones) | 99 | if (j < sbi->s_firstdatazone || j >= sbi->s_nzones) |
99 | break; | 100 | break; |
100 | return j; | 101 | return j; |
101 | } | 102 | } |
102 | unlock_kernel(); | 103 | spin_unlock(&bitmap_lock); |
103 | } | 104 | } |
104 | return 0; | 105 | return 0; |
105 | } | 106 | } |
@@ -211,10 +212,10 @@ void minix_free_inode(struct inode * inode) | |||
211 | minix_clear_inode(inode); /* clear on-disk copy */ | 212 | minix_clear_inode(inode); /* clear on-disk copy */ |
212 | 213 | ||
213 | bh = sbi->s_imap[ino]; | 214 | bh = sbi->s_imap[ino]; |
214 | lock_kernel(); | 215 | spin_lock(&bitmap_lock); |
215 | if (!minix_test_and_clear_bit(bit, bh->b_data)) | 216 | if (!minix_test_and_clear_bit(bit, bh->b_data)) |
216 | printk("minix_free_inode: bit %lu already cleared\n", bit); | 217 | printk("minix_free_inode: bit %lu already cleared\n", bit); |
217 | unlock_kernel(); | 218 | spin_unlock(&bitmap_lock); |
218 | mark_buffer_dirty(bh); | 219 | mark_buffer_dirty(bh); |
219 | out: | 220 | out: |
220 | clear_inode(inode); /* clear in-memory copy */ | 221 | clear_inode(inode); /* clear in-memory copy */ |
@@ -237,7 +238,7 @@ struct inode * minix_new_inode(const struct inode * dir, int * error) | |||
237 | j = bits_per_zone; | 238 | j = bits_per_zone; |
238 | bh = NULL; | 239 | bh = NULL; |
239 | *error = -ENOSPC; | 240 | *error = -ENOSPC; |
240 | lock_kernel(); | 241 | spin_lock(&bitmap_lock); |
241 | for (i = 0; i < sbi->s_imap_blocks; i++) { | 242 | for (i = 0; i < sbi->s_imap_blocks; i++) { |
242 | bh = sbi->s_imap[i]; | 243 | bh = sbi->s_imap[i]; |
243 | j = minix_find_first_zero_bit(bh->b_data, bits_per_zone); | 244 | j = minix_find_first_zero_bit(bh->b_data, bits_per_zone); |
@@ -245,17 +246,17 @@ struct inode * minix_new_inode(const struct inode * dir, int * error) | |||
245 | break; | 246 | break; |
246 | } | 247 | } |
247 | if (!bh || j >= bits_per_zone) { | 248 | if (!bh || j >= bits_per_zone) { |
248 | unlock_kernel(); | 249 | spin_unlock(&bitmap_lock); |
249 | iput(inode); | 250 | iput(inode); |
250 | return NULL; | 251 | return NULL; |
251 | } | 252 | } |
252 | if (minix_test_and_set_bit(j, bh->b_data)) { /* shouldn't happen */ | 253 | if (minix_test_and_set_bit(j, bh->b_data)) { /* shouldn't happen */ |
253 | unlock_kernel(); | 254 | spin_unlock(&bitmap_lock); |
254 | printk("minix_new_inode: bit already set\n"); | 255 | printk("minix_new_inode: bit already set\n"); |
255 | iput(inode); | 256 | iput(inode); |
256 | return NULL; | 257 | return NULL; |
257 | } | 258 | } |
258 | unlock_kernel(); | 259 | spin_unlock(&bitmap_lock); |
259 | mark_buffer_dirty(bh); | 260 | mark_buffer_dirty(bh); |
260 | j += i * bits_per_zone; | 261 | j += i * bits_per_zone; |
261 | if (!j || j > sbi->s_ninodes) { | 262 | if (!j || j > sbi->s_ninodes) { |
diff --git a/fs/minix/dir.c b/fs/minix/dir.c index e5f206467e40..d407e7a0b6fe 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include "minix.h" | 11 | #include "minix.h" |
12 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
13 | #include <linux/highmem.h> | 13 | #include <linux/highmem.h> |
14 | #include <linux/smp_lock.h> | ||
15 | #include <linux/swap.h> | 14 | #include <linux/swap.h> |
16 | 15 | ||
17 | typedef struct minix_dir_entry minix_dirent; | 16 | typedef struct minix_dir_entry minix_dirent; |
@@ -20,6 +19,7 @@ typedef struct minix3_dir_entry minix3_dirent; | |||
20 | static int minix_readdir(struct file *, void *, filldir_t); | 19 | static int minix_readdir(struct file *, void *, filldir_t); |
21 | 20 | ||
22 | const struct file_operations minix_dir_operations = { | 21 | const struct file_operations minix_dir_operations = { |
22 | .llseek = generic_file_llseek, | ||
23 | .read = generic_read_dir, | 23 | .read = generic_read_dir, |
24 | .readdir = minix_readdir, | 24 | .readdir = minix_readdir, |
25 | .fsync = simple_fsync, | 25 | .fsync = simple_fsync, |
@@ -102,8 +102,6 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
102 | char *name; | 102 | char *name; |
103 | __u32 inumber; | 103 | __u32 inumber; |
104 | 104 | ||
105 | lock_kernel(); | ||
106 | |||
107 | pos = (pos + chunk_size-1) & ~(chunk_size-1); | 105 | pos = (pos + chunk_size-1) & ~(chunk_size-1); |
108 | if (pos >= inode->i_size) | 106 | if (pos >= inode->i_size) |
109 | goto done; | 107 | goto done; |
@@ -146,7 +144,6 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
146 | 144 | ||
147 | done: | 145 | done: |
148 | filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset; | 146 | filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset; |
149 | unlock_kernel(); | ||
150 | return 0; | 147 | return 0; |
151 | } | 148 | } |
152 | 149 | ||
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index f91a23693597..74ea82d72164 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
@@ -35,8 +35,6 @@ static void minix_put_super(struct super_block *sb) | |||
35 | int i; | 35 | int i; |
36 | struct minix_sb_info *sbi = minix_sb(sb); | 36 | struct minix_sb_info *sbi = minix_sb(sb); |
37 | 37 | ||
38 | lock_kernel(); | ||
39 | |||
40 | if (!(sb->s_flags & MS_RDONLY)) { | 38 | if (!(sb->s_flags & MS_RDONLY)) { |
41 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ | 39 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ |
42 | sbi->s_ms->s_state = sbi->s_mount_state; | 40 | sbi->s_ms->s_state = sbi->s_mount_state; |
@@ -50,8 +48,6 @@ static void minix_put_super(struct super_block *sb) | |||
50 | kfree(sbi->s_imap); | 48 | kfree(sbi->s_imap); |
51 | sb->s_fs_info = NULL; | 49 | sb->s_fs_info = NULL; |
52 | kfree(sbi); | 50 | kfree(sbi); |
53 | |||
54 | unlock_kernel(); | ||
55 | } | 51 | } |
56 | 52 | ||
57 | static struct kmem_cache * minix_inode_cachep; | 53 | static struct kmem_cache * minix_inode_cachep; |