diff options
Diffstat (limited to 'fs/bfs/inode.c')
| -rw-r--r-- | fs/bfs/inode.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 8db623838b50..0ed57b5ee012 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
| @@ -104,6 +104,7 @@ static int bfs_write_inode(struct inode *inode, int unused) | |||
| 104 | struct bfs_inode *di; | 104 | struct bfs_inode *di; |
| 105 | struct buffer_head *bh; | 105 | struct buffer_head *bh; |
| 106 | int block, off; | 106 | int block, off; |
| 107 | struct bfs_sb_info *info = BFS_SB(inode->i_sb); | ||
| 107 | 108 | ||
| 108 | dprintf("ino=%08x\n", ino); | 109 | dprintf("ino=%08x\n", ino); |
| 109 | 110 | ||
| @@ -112,13 +113,13 @@ static int bfs_write_inode(struct inode *inode, int unused) | |||
| 112 | return -EIO; | 113 | return -EIO; |
| 113 | } | 114 | } |
| 114 | 115 | ||
| 115 | lock_kernel(); | 116 | mutex_lock(&info->bfs_lock); |
| 116 | block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; | 117 | block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; |
| 117 | bh = sb_bread(inode->i_sb, block); | 118 | bh = sb_bread(inode->i_sb, block); |
| 118 | if (!bh) { | 119 | if (!bh) { |
| 119 | printf("Unable to read inode %s:%08x\n", | 120 | printf("Unable to read inode %s:%08x\n", |
| 120 | inode->i_sb->s_id, ino); | 121 | inode->i_sb->s_id, ino); |
| 121 | unlock_kernel(); | 122 | mutex_unlock(&info->bfs_lock); |
| 122 | return -EIO; | 123 | return -EIO; |
| 123 | } | 124 | } |
| 124 | 125 | ||
| @@ -145,7 +146,7 @@ static int bfs_write_inode(struct inode *inode, int unused) | |||
| 145 | 146 | ||
| 146 | mark_buffer_dirty(bh); | 147 | mark_buffer_dirty(bh); |
| 147 | brelse(bh); | 148 | brelse(bh); |
| 148 | unlock_kernel(); | 149 | mutex_unlock(&info->bfs_lock); |
| 149 | return 0; | 150 | return 0; |
| 150 | } | 151 | } |
| 151 | 152 | ||
| @@ -170,7 +171,7 @@ static void bfs_delete_inode(struct inode *inode) | |||
| 170 | 171 | ||
| 171 | inode->i_size = 0; | 172 | inode->i_size = 0; |
| 172 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; | 173 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; |
| 173 | lock_kernel(); | 174 | mutex_lock(&info->bfs_lock); |
| 174 | mark_inode_dirty(inode); | 175 | mark_inode_dirty(inode); |
| 175 | 176 | ||
| 176 | block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; | 177 | block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; |
| @@ -178,7 +179,7 @@ static void bfs_delete_inode(struct inode *inode) | |||
| 178 | if (!bh) { | 179 | if (!bh) { |
| 179 | printf("Unable to read inode %s:%08lx\n", | 180 | printf("Unable to read inode %s:%08lx\n", |
| 180 | inode->i_sb->s_id, ino); | 181 | inode->i_sb->s_id, ino); |
| 181 | unlock_kernel(); | 182 | mutex_unlock(&info->bfs_lock); |
| 182 | return; | 183 | return; |
| 183 | } | 184 | } |
| 184 | off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; | 185 | off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; |
| @@ -204,14 +205,16 @@ static void bfs_delete_inode(struct inode *inode) | |||
| 204 | info->si_lf_eblk = bi->i_sblock - 1; | 205 | info->si_lf_eblk = bi->i_sblock - 1; |
| 205 | mark_buffer_dirty(info->si_sbh); | 206 | mark_buffer_dirty(info->si_sbh); |
| 206 | } | 207 | } |
| 207 | unlock_kernel(); | 208 | mutex_unlock(&info->bfs_lock); |
| 208 | clear_inode(inode); | 209 | clear_inode(inode); |
| 209 | } | 210 | } |
| 210 | 211 | ||
| 211 | static void bfs_put_super(struct super_block *s) | 212 | static void bfs_put_super(struct super_block *s) |
| 212 | { | 213 | { |
| 213 | struct bfs_sb_info *info = BFS_SB(s); | 214 | struct bfs_sb_info *info = BFS_SB(s); |
| 215 | |||
| 214 | brelse(info->si_sbh); | 216 | brelse(info->si_sbh); |
| 217 | mutex_destroy(&info->bfs_lock); | ||
| 215 | kfree(info->si_imap); | 218 | kfree(info->si_imap); |
| 216 | kfree(info); | 219 | kfree(info); |
| 217 | s->s_fs_info = NULL; | 220 | s->s_fs_info = NULL; |
| @@ -236,11 +239,13 @@ static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 236 | 239 | ||
| 237 | static void bfs_write_super(struct super_block *s) | 240 | static void bfs_write_super(struct super_block *s) |
| 238 | { | 241 | { |
| 239 | lock_kernel(); | 242 | struct bfs_sb_info *info = BFS_SB(s); |
| 243 | |||
| 244 | mutex_lock(&info->bfs_lock); | ||
| 240 | if (!(s->s_flags & MS_RDONLY)) | 245 | if (!(s->s_flags & MS_RDONLY)) |
| 241 | mark_buffer_dirty(BFS_SB(s)->si_sbh); | 246 | mark_buffer_dirty(info->si_sbh); |
| 242 | s->s_dirt = 0; | 247 | s->s_dirt = 0; |
| 243 | unlock_kernel(); | 248 | mutex_unlock(&info->bfs_lock); |
| 244 | } | 249 | } |
| 245 | 250 | ||
| 246 | static struct kmem_cache *bfs_inode_cachep; | 251 | static struct kmem_cache *bfs_inode_cachep; |
| @@ -259,7 +264,7 @@ static void bfs_destroy_inode(struct inode *inode) | |||
| 259 | kmem_cache_free(bfs_inode_cachep, BFS_I(inode)); | 264 | kmem_cache_free(bfs_inode_cachep, BFS_I(inode)); |
| 260 | } | 265 | } |
| 261 | 266 | ||
| 262 | static void init_once(struct kmem_cache *cachep, void *foo) | 267 | static void init_once(void *foo) |
| 263 | { | 268 | { |
| 264 | struct bfs_inode_info *bi = foo; | 269 | struct bfs_inode_info *bi = foo; |
| 265 | 270 | ||
| @@ -380,7 +385,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
| 380 | struct bfs_inode *di; | 385 | struct bfs_inode *di; |
| 381 | int block = (i - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; | 386 | int block = (i - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; |
| 382 | int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; | 387 | int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; |
| 383 | unsigned long sblock, eblock; | 388 | unsigned long eblock; |
| 384 | 389 | ||
| 385 | if (!off) { | 390 | if (!off) { |
| 386 | brelse(bh); | 391 | brelse(bh); |
| @@ -399,7 +404,6 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
| 399 | set_bit(i, info->si_imap); | 404 | set_bit(i, info->si_imap); |
| 400 | info->si_freeb -= BFS_FILEBLOCKS(di); | 405 | info->si_freeb -= BFS_FILEBLOCKS(di); |
| 401 | 406 | ||
| 402 | sblock = le32_to_cpu(di->i_sblock); | ||
| 403 | eblock = le32_to_cpu(di->i_eblock); | 407 | eblock = le32_to_cpu(di->i_eblock); |
| 404 | if (eblock > info->si_lf_eblk) | 408 | if (eblock > info->si_lf_eblk) |
| 405 | info->si_lf_eblk = eblock; | 409 | info->si_lf_eblk = eblock; |
| @@ -410,6 +414,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
| 410 | s->s_dirt = 1; | 414 | s->s_dirt = 1; |
| 411 | } | 415 | } |
| 412 | dump_imap("read_super", s); | 416 | dump_imap("read_super", s); |
| 417 | mutex_init(&info->bfs_lock); | ||
| 413 | return 0; | 418 | return 0; |
| 414 | 419 | ||
| 415 | out: | 420 | out: |
