diff options
Diffstat (limited to 'fs/bfs/inode.c')
-rw-r--r-- | fs/bfs/inode.c | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 0499822b1568..c4daf0f5fc02 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -31,7 +31,6 @@ MODULE_LICENSE("GPL"); | |||
31 | #define dprintf(x...) | 31 | #define dprintf(x...) |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | static void bfs_write_super(struct super_block *s); | ||
35 | void dump_imap(const char *prefix, struct super_block *s); | 34 | void dump_imap(const char *prefix, struct super_block *s); |
36 | 35 | ||
37 | struct inode *bfs_iget(struct super_block *sb, unsigned long ino) | 36 | struct inode *bfs_iget(struct super_block *sb, unsigned long ino) |
@@ -204,33 +203,11 @@ static void bfs_evict_inode(struct inode *inode) | |||
204 | * "last block of the last file" even if there is no | 203 | * "last block of the last file" even if there is no |
205 | * real file there, saves us 1 gap. | 204 | * real file there, saves us 1 gap. |
206 | */ | 205 | */ |
207 | if (info->si_lf_eblk == bi->i_eblock) { | 206 | if (info->si_lf_eblk == bi->i_eblock) |
208 | info->si_lf_eblk = bi->i_sblock - 1; | 207 | info->si_lf_eblk = bi->i_sblock - 1; |
209 | mark_buffer_dirty(info->si_sbh); | ||
210 | } | ||
211 | mutex_unlock(&info->bfs_lock); | 208 | mutex_unlock(&info->bfs_lock); |
212 | } | 209 | } |
213 | 210 | ||
214 | static int bfs_sync_fs(struct super_block *sb, int wait) | ||
215 | { | ||
216 | struct bfs_sb_info *info = BFS_SB(sb); | ||
217 | |||
218 | mutex_lock(&info->bfs_lock); | ||
219 | mark_buffer_dirty(info->si_sbh); | ||
220 | sb->s_dirt = 0; | ||
221 | mutex_unlock(&info->bfs_lock); | ||
222 | |||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | static void bfs_write_super(struct super_block *sb) | ||
227 | { | ||
228 | if (!(sb->s_flags & MS_RDONLY)) | ||
229 | bfs_sync_fs(sb, 1); | ||
230 | else | ||
231 | sb->s_dirt = 0; | ||
232 | } | ||
233 | |||
234 | static void bfs_put_super(struct super_block *s) | 211 | static void bfs_put_super(struct super_block *s) |
235 | { | 212 | { |
236 | struct bfs_sb_info *info = BFS_SB(s); | 213 | struct bfs_sb_info *info = BFS_SB(s); |
@@ -240,10 +217,6 @@ static void bfs_put_super(struct super_block *s) | |||
240 | 217 | ||
241 | lock_kernel(); | 218 | lock_kernel(); |
242 | 219 | ||
243 | if (s->s_dirt) | ||
244 | bfs_write_super(s); | ||
245 | |||
246 | brelse(info->si_sbh); | ||
247 | mutex_destroy(&info->bfs_lock); | 220 | mutex_destroy(&info->bfs_lock); |
248 | kfree(info->si_imap); | 221 | kfree(info->si_imap); |
249 | kfree(info); | 222 | kfree(info); |
@@ -315,8 +288,6 @@ static const struct super_operations bfs_sops = { | |||
315 | .write_inode = bfs_write_inode, | 288 | .write_inode = bfs_write_inode, |
316 | .evict_inode = bfs_evict_inode, | 289 | .evict_inode = bfs_evict_inode, |
317 | .put_super = bfs_put_super, | 290 | .put_super = bfs_put_super, |
318 | .write_super = bfs_write_super, | ||
319 | .sync_fs = bfs_sync_fs, | ||
320 | .statfs = bfs_statfs, | 291 | .statfs = bfs_statfs, |
321 | }; | 292 | }; |
322 | 293 | ||
@@ -343,7 +314,7 @@ void dump_imap(const char *prefix, struct super_block *s) | |||
343 | 314 | ||
344 | static int bfs_fill_super(struct super_block *s, void *data, int silent) | 315 | static int bfs_fill_super(struct super_block *s, void *data, int silent) |
345 | { | 316 | { |
346 | struct buffer_head *bh; | 317 | struct buffer_head *bh, *sbh; |
347 | struct bfs_super_block *bfs_sb; | 318 | struct bfs_super_block *bfs_sb; |
348 | struct inode *inode; | 319 | struct inode *inode; |
349 | unsigned i, imap_len; | 320 | unsigned i, imap_len; |
@@ -359,10 +330,10 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
359 | 330 | ||
360 | sb_set_blocksize(s, BFS_BSIZE); | 331 | sb_set_blocksize(s, BFS_BSIZE); |
361 | 332 | ||
362 | info->si_sbh = sb_bread(s, 0); | 333 | sbh = sb_bread(s, 0); |
363 | if (!info->si_sbh) | 334 | if (!sbh) |
364 | goto out; | 335 | goto out; |
365 | bfs_sb = (struct bfs_super_block *)info->si_sbh->b_data; | 336 | bfs_sb = (struct bfs_super_block *)sbh->b_data; |
366 | if (le32_to_cpu(bfs_sb->s_magic) != BFS_MAGIC) { | 337 | if (le32_to_cpu(bfs_sb->s_magic) != BFS_MAGIC) { |
367 | if (!silent) | 338 | if (!silent) |
368 | printf("No BFS filesystem on %s (magic=%08x)\n", | 339 | printf("No BFS filesystem on %s (magic=%08x)\n", |
@@ -466,10 +437,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
466 | info->si_lf_eblk = eblock; | 437 | info->si_lf_eblk = eblock; |
467 | } | 438 | } |
468 | brelse(bh); | 439 | brelse(bh); |
469 | if (!(s->s_flags & MS_RDONLY)) { | 440 | brelse(sbh); |
470 | mark_buffer_dirty(info->si_sbh); | ||
471 | s->s_dirt = 1; | ||
472 | } | ||
473 | dump_imap("read_super", s); | 441 | dump_imap("read_super", s); |
474 | return 0; | 442 | return 0; |
475 | 443 | ||
@@ -479,7 +447,7 @@ out3: | |||
479 | out2: | 447 | out2: |
480 | kfree(info->si_imap); | 448 | kfree(info->si_imap); |
481 | out1: | 449 | out1: |
482 | brelse(info->si_sbh); | 450 | brelse(sbh); |
483 | out: | 451 | out: |
484 | mutex_destroy(&info->bfs_lock); | 452 | mutex_destroy(&info->bfs_lock); |
485 | kfree(info); | 453 | kfree(info); |