diff options
Diffstat (limited to 'fs/ext4/super.c')
| -rw-r--r-- | fs/ext4/super.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index bdddea14e782..e4a241c65dbe 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -333,7 +333,8 @@ void ext4_abort(struct super_block *sb, const char *function, | |||
| 333 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; | 333 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; |
| 334 | sb->s_flags |= MS_RDONLY; | 334 | sb->s_flags |= MS_RDONLY; |
| 335 | EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT; | 335 | EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT; |
| 336 | jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); | 336 | if (EXT4_SB(sb)->s_journal) |
| 337 | jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); | ||
| 337 | } | 338 | } |
| 338 | 339 | ||
| 339 | void ext4_warning(struct super_block *sb, const char *function, | 340 | void ext4_warning(struct super_block *sb, const char *function, |
| @@ -442,14 +443,16 @@ static void ext4_put_super(struct super_block *sb) | |||
| 442 | { | 443 | { |
| 443 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 444 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
| 444 | struct ext4_super_block *es = sbi->s_es; | 445 | struct ext4_super_block *es = sbi->s_es; |
| 445 | int i; | 446 | int i, err; |
| 446 | 447 | ||
| 447 | ext4_mb_release(sb); | 448 | ext4_mb_release(sb); |
| 448 | ext4_ext_release(sb); | 449 | ext4_ext_release(sb); |
| 449 | ext4_xattr_put_super(sb); | 450 | ext4_xattr_put_super(sb); |
| 450 | if (jbd2_journal_destroy(sbi->s_journal) < 0) | 451 | err = jbd2_journal_destroy(sbi->s_journal); |
| 451 | ext4_abort(sb, __func__, "Couldn't clean up the journal"); | ||
| 452 | sbi->s_journal = NULL; | 452 | sbi->s_journal = NULL; |
| 453 | if (err < 0) | ||
| 454 | ext4_abort(sb, __func__, "Couldn't clean up the journal"); | ||
| 455 | |||
| 453 | if (!(sb->s_flags & MS_RDONLY)) { | 456 | if (!(sb->s_flags & MS_RDONLY)) { |
| 454 | EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); | 457 | EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); |
| 455 | es->s_state = cpu_to_le16(sbi->s_mount_state); | 458 | es->s_state = cpu_to_le16(sbi->s_mount_state); |
| @@ -1455,9 +1458,8 @@ static int ext4_fill_flex_info(struct super_block *sb) | |||
| 1455 | 1458 | ||
| 1456 | /* We allocate both existing and potentially added groups */ | 1459 | /* We allocate both existing and potentially added groups */ |
| 1457 | flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) + | 1460 | flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) + |
| 1458 | ((sbi->s_es->s_reserved_gdt_blocks +1 ) << | 1461 | ((le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) + 1) << |
| 1459 | EXT4_DESC_PER_BLOCK_BITS(sb))) / | 1462 | EXT4_DESC_PER_BLOCK_BITS(sb))) / groups_per_flex; |
| 1460 | groups_per_flex; | ||
| 1461 | sbi->s_flex_groups = kzalloc(flex_group_count * | 1463 | sbi->s_flex_groups = kzalloc(flex_group_count * |
| 1462 | sizeof(struct flex_groups), GFP_KERNEL); | 1464 | sizeof(struct flex_groups), GFP_KERNEL); |
| 1463 | if (sbi->s_flex_groups == NULL) { | 1465 | if (sbi->s_flex_groups == NULL) { |
| @@ -2882,12 +2884,9 @@ int ext4_force_commit(struct super_block *sb) | |||
| 2882 | /* | 2884 | /* |
| 2883 | * Ext4 always journals updates to the superblock itself, so we don't | 2885 | * Ext4 always journals updates to the superblock itself, so we don't |
| 2884 | * have to propagate any other updates to the superblock on disk at this | 2886 | * have to propagate any other updates to the superblock on disk at this |
| 2885 | * point. Just start an async writeback to get the buffers on their way | 2887 | * point. (We can probably nuke this function altogether, and remove |
| 2886 | * to the disk. | 2888 | * any mention to sb->s_dirt in all of fs/ext4; eventual cleanup...) |
| 2887 | * | ||
| 2888 | * This implicitly triggers the writebehind on sync(). | ||
| 2889 | */ | 2889 | */ |
| 2890 | |||
| 2891 | static void ext4_write_super(struct super_block *sb) | 2890 | static void ext4_write_super(struct super_block *sb) |
| 2892 | { | 2891 | { |
| 2893 | if (mutex_trylock(&sb->s_lock) != 0) | 2892 | if (mutex_trylock(&sb->s_lock) != 0) |
| @@ -2897,15 +2896,15 @@ static void ext4_write_super(struct super_block *sb) | |||
| 2897 | 2896 | ||
| 2898 | static int ext4_sync_fs(struct super_block *sb, int wait) | 2897 | static int ext4_sync_fs(struct super_block *sb, int wait) |
| 2899 | { | 2898 | { |
| 2900 | tid_t target; | 2899 | int ret = 0; |
| 2901 | 2900 | ||
| 2902 | trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait); | 2901 | trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait); |
| 2903 | sb->s_dirt = 0; | 2902 | sb->s_dirt = 0; |
| 2904 | if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, &target)) { | 2903 | if (wait) |
| 2905 | if (wait) | 2904 | ret = ext4_force_commit(sb); |
| 2906 | jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, target); | 2905 | else |
| 2907 | } | 2906 | jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL); |
| 2908 | return 0; | 2907 | return ret; |
| 2909 | } | 2908 | } |
| 2910 | 2909 | ||
| 2911 | /* | 2910 | /* |
