diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 23:05:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 23:05:37 -0400 |
commit | 4b4f1d017815f96737ca4a62f90e5a1f0b9f02d6 (patch) | |
tree | c95ae92ec01cabf6c2a40d31a31da6a4d9256816 /fs/ext3/super.c | |
parent | 875287caa067492779670f5fb3b98ec8dcfe2cb0 (diff) | |
parent | aa7dfb8954ccf49e026ba13d12991a4eb7defb96 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (87 commits)
nilfs2: get rid of bd_mount_sem use from nilfs
nilfs2: correct exclusion control in nilfs_remount function
nilfs2: simplify remaining sget() use
nilfs2: get rid of sget use for checking if current mount is present
nilfs2: get rid of sget use for acquiring nilfs object
nilfs2: remove meaningless EBUSY case from nilfs_get_sb function
remove the call to ->write_super in __sync_filesystem
nilfs2: call nilfs2_write_super from nilfs2_sync_fs
jffs2: call jffs2_write_super from jffs2_sync_fs
ufs: add ->sync_fs
sysv: add ->sync_fs
hfsplus: add ->sync_fs
hfs: add ->sync_fs
fat: add ->sync_fs
ext2: add ->sync_fs
exofs: add ->sync_fs
bfs: add ->sync_fs
affs: add ->sync_fs
sanitize ->fsync() for affs
repair bfs_write_inode(), switch bfs to simple_fsync()
...
Diffstat (limited to 'fs/ext3/super.c')
-rw-r--r-- | fs/ext3/super.c | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 3c70d52afb10..26aa64dee6aa 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -67,7 +67,6 @@ static const char *ext3_decode_error(struct super_block * sb, int errno, | |||
67 | static int ext3_remount (struct super_block * sb, int * flags, char * data); | 67 | static int ext3_remount (struct super_block * sb, int * flags, char * data); |
68 | static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf); | 68 | static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf); |
69 | static int ext3_unfreeze(struct super_block *sb); | 69 | static int ext3_unfreeze(struct super_block *sb); |
70 | static void ext3_write_super (struct super_block * sb); | ||
71 | static int ext3_freeze(struct super_block *sb); | 70 | static int ext3_freeze(struct super_block *sb); |
72 | 71 | ||
73 | /* | 72 | /* |
@@ -399,6 +398,8 @@ static void ext3_put_super (struct super_block * sb) | |||
399 | struct ext3_super_block *es = sbi->s_es; | 398 | struct ext3_super_block *es = sbi->s_es; |
400 | int i, err; | 399 | int i, err; |
401 | 400 | ||
401 | lock_kernel(); | ||
402 | |||
402 | ext3_xattr_put_super(sb); | 403 | ext3_xattr_put_super(sb); |
403 | err = journal_destroy(sbi->s_journal); | 404 | err = journal_destroy(sbi->s_journal); |
404 | sbi->s_journal = NULL; | 405 | sbi->s_journal = NULL; |
@@ -447,7 +448,8 @@ static void ext3_put_super (struct super_block * sb) | |||
447 | sb->s_fs_info = NULL; | 448 | sb->s_fs_info = NULL; |
448 | kfree(sbi->s_blockgroup_lock); | 449 | kfree(sbi->s_blockgroup_lock); |
449 | kfree(sbi); | 450 | kfree(sbi); |
450 | return; | 451 | |
452 | unlock_kernel(); | ||
451 | } | 453 | } |
452 | 454 | ||
453 | static struct kmem_cache *ext3_inode_cachep; | 455 | static struct kmem_cache *ext3_inode_cachep; |
@@ -761,7 +763,6 @@ static const struct super_operations ext3_sops = { | |||
761 | .dirty_inode = ext3_dirty_inode, | 763 | .dirty_inode = ext3_dirty_inode, |
762 | .delete_inode = ext3_delete_inode, | 764 | .delete_inode = ext3_delete_inode, |
763 | .put_super = ext3_put_super, | 765 | .put_super = ext3_put_super, |
764 | .write_super = ext3_write_super, | ||
765 | .sync_fs = ext3_sync_fs, | 766 | .sync_fs = ext3_sync_fs, |
766 | .freeze_fs = ext3_freeze, | 767 | .freeze_fs = ext3_freeze, |
767 | .unfreeze_fs = ext3_unfreeze, | 768 | .unfreeze_fs = ext3_unfreeze, |
@@ -1785,7 +1786,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1785 | #else | 1786 | #else |
1786 | es->s_flags |= cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); | 1787 | es->s_flags |= cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); |
1787 | #endif | 1788 | #endif |
1788 | sb->s_dirt = 1; | ||
1789 | } | 1789 | } |
1790 | 1790 | ||
1791 | if (sbi->s_blocks_per_group > blocksize * 8) { | 1791 | if (sbi->s_blocks_per_group > blocksize * 8) { |
@@ -2265,7 +2265,6 @@ static int ext3_load_journal(struct super_block *sb, | |||
2265 | if (journal_devnum && | 2265 | if (journal_devnum && |
2266 | journal_devnum != le32_to_cpu(es->s_journal_dev)) { | 2266 | journal_devnum != le32_to_cpu(es->s_journal_dev)) { |
2267 | es->s_journal_dev = cpu_to_le32(journal_devnum); | 2267 | es->s_journal_dev = cpu_to_le32(journal_devnum); |
2268 | sb->s_dirt = 1; | ||
2269 | 2268 | ||
2270 | /* Make sure we flush the recovery flag to disk. */ | 2269 | /* Make sure we flush the recovery flag to disk. */ |
2271 | ext3_commit_super(sb, es, 1); | 2270 | ext3_commit_super(sb, es, 1); |
@@ -2308,7 +2307,6 @@ static int ext3_create_journal(struct super_block * sb, | |||
2308 | EXT3_SET_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL); | 2307 | EXT3_SET_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL); |
2309 | 2308 | ||
2310 | es->s_journal_inum = cpu_to_le32(journal_inum); | 2309 | es->s_journal_inum = cpu_to_le32(journal_inum); |
2311 | sb->s_dirt = 1; | ||
2312 | 2310 | ||
2313 | /* Make sure we flush the recovery flag to disk. */ | 2311 | /* Make sure we flush the recovery flag to disk. */ |
2314 | ext3_commit_super(sb, es, 1); | 2312 | ext3_commit_super(sb, es, 1); |
@@ -2354,7 +2352,6 @@ static void ext3_mark_recovery_complete(struct super_block * sb, | |||
2354 | if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) && | 2352 | if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) && |
2355 | sb->s_flags & MS_RDONLY) { | 2353 | sb->s_flags & MS_RDONLY) { |
2356 | EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); | 2354 | EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); |
2357 | sb->s_dirt = 0; | ||
2358 | ext3_commit_super(sb, es, 1); | 2355 | ext3_commit_super(sb, es, 1); |
2359 | } | 2356 | } |
2360 | unlock_super(sb); | 2357 | unlock_super(sb); |
@@ -2413,29 +2410,14 @@ int ext3_force_commit(struct super_block *sb) | |||
2413 | return 0; | 2410 | return 0; |
2414 | 2411 | ||
2415 | journal = EXT3_SB(sb)->s_journal; | 2412 | journal = EXT3_SB(sb)->s_journal; |
2416 | sb->s_dirt = 0; | ||
2417 | ret = ext3_journal_force_commit(journal); | 2413 | ret = ext3_journal_force_commit(journal); |
2418 | return ret; | 2414 | return ret; |
2419 | } | 2415 | } |
2420 | 2416 | ||
2421 | /* | ||
2422 | * Ext3 always journals updates to the superblock itself, so we don't | ||
2423 | * have to propagate any other updates to the superblock on disk at this | ||
2424 | * point. (We can probably nuke this function altogether, and remove | ||
2425 | * any mention to sb->s_dirt in all of fs/ext3; eventual cleanup...) | ||
2426 | */ | ||
2427 | static void ext3_write_super (struct super_block * sb) | ||
2428 | { | ||
2429 | if (mutex_trylock(&sb->s_lock) != 0) | ||
2430 | BUG(); | ||
2431 | sb->s_dirt = 0; | ||
2432 | } | ||
2433 | |||
2434 | static int ext3_sync_fs(struct super_block *sb, int wait) | 2417 | static int ext3_sync_fs(struct super_block *sb, int wait) |
2435 | { | 2418 | { |
2436 | tid_t target; | 2419 | tid_t target; |
2437 | 2420 | ||
2438 | sb->s_dirt = 0; | ||
2439 | if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) { | 2421 | if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) { |
2440 | if (wait) | 2422 | if (wait) |
2441 | log_wait_commit(EXT3_SB(sb)->s_journal, target); | 2423 | log_wait_commit(EXT3_SB(sb)->s_journal, target); |
@@ -2451,7 +2433,6 @@ static int ext3_freeze(struct super_block *sb) | |||
2451 | { | 2433 | { |
2452 | int error = 0; | 2434 | int error = 0; |
2453 | journal_t *journal; | 2435 | journal_t *journal; |
2454 | sb->s_dirt = 0; | ||
2455 | 2436 | ||
2456 | if (!(sb->s_flags & MS_RDONLY)) { | 2437 | if (!(sb->s_flags & MS_RDONLY)) { |
2457 | journal = EXT3_SB(sb)->s_journal; | 2438 | journal = EXT3_SB(sb)->s_journal; |
@@ -2509,7 +2490,10 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2509 | int i; | 2490 | int i; |
2510 | #endif | 2491 | #endif |
2511 | 2492 | ||
2493 | lock_kernel(); | ||
2494 | |||
2512 | /* Store the original options */ | 2495 | /* Store the original options */ |
2496 | lock_super(sb); | ||
2513 | old_sb_flags = sb->s_flags; | 2497 | old_sb_flags = sb->s_flags; |
2514 | old_opts.s_mount_opt = sbi->s_mount_opt; | 2498 | old_opts.s_mount_opt = sbi->s_mount_opt; |
2515 | old_opts.s_resuid = sbi->s_resuid; | 2499 | old_opts.s_resuid = sbi->s_resuid; |
@@ -2617,6 +2601,8 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2617 | old_opts.s_qf_names[i] != sbi->s_qf_names[i]) | 2601 | old_opts.s_qf_names[i] != sbi->s_qf_names[i]) |
2618 | kfree(old_opts.s_qf_names[i]); | 2602 | kfree(old_opts.s_qf_names[i]); |
2619 | #endif | 2603 | #endif |
2604 | unlock_super(sb); | ||
2605 | unlock_kernel(); | ||
2620 | return 0; | 2606 | return 0; |
2621 | restore_opts: | 2607 | restore_opts: |
2622 | sb->s_flags = old_sb_flags; | 2608 | sb->s_flags = old_sb_flags; |
@@ -2633,6 +2619,8 @@ restore_opts: | |||
2633 | sbi->s_qf_names[i] = old_opts.s_qf_names[i]; | 2619 | sbi->s_qf_names[i] = old_opts.s_qf_names[i]; |
2634 | } | 2620 | } |
2635 | #endif | 2621 | #endif |
2622 | unlock_super(sb); | ||
2623 | unlock_kernel(); | ||
2636 | return err; | 2624 | return err; |
2637 | } | 2625 | } |
2638 | 2626 | ||