diff options
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 3ed01ec011d7..539297515896 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -55,7 +55,6 @@ | |||
55 | 55 | ||
56 | static struct ext4_lazy_init *ext4_li_info; | 56 | static struct ext4_lazy_init *ext4_li_info; |
57 | static struct mutex ext4_li_mtx; | 57 | static struct mutex ext4_li_mtx; |
58 | static int ext4_mballoc_ready; | ||
59 | static struct ratelimit_state ext4_mount_msg_ratelimit; | 58 | static struct ratelimit_state ext4_mount_msg_ratelimit; |
60 | 59 | ||
61 | static int ext4_load_journal(struct super_block *, struct ext4_super_block *, | 60 | static int ext4_load_journal(struct super_block *, struct ext4_super_block *, |
@@ -844,7 +843,6 @@ static void ext4_put_super(struct super_block *sb) | |||
844 | ext4_release_system_zone(sb); | 843 | ext4_release_system_zone(sb); |
845 | ext4_mb_release(sb); | 844 | ext4_mb_release(sb); |
846 | ext4_ext_release(sb); | 845 | ext4_ext_release(sb); |
847 | ext4_xattr_put_super(sb); | ||
848 | 846 | ||
849 | if (!(sb->s_flags & MS_RDONLY)) { | 847 | if (!(sb->s_flags & MS_RDONLY)) { |
850 | ext4_clear_feature_journal_needs_recovery(sb); | 848 | ext4_clear_feature_journal_needs_recovery(sb); |
@@ -944,7 +942,6 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) | |||
944 | spin_lock_init(&ei->i_completed_io_lock); | 942 | spin_lock_init(&ei->i_completed_io_lock); |
945 | ei->i_sync_tid = 0; | 943 | ei->i_sync_tid = 0; |
946 | ei->i_datasync_tid = 0; | 944 | ei->i_datasync_tid = 0; |
947 | atomic_set(&ei->i_ioend_count, 0); | ||
948 | atomic_set(&ei->i_unwritten, 0); | 945 | atomic_set(&ei->i_unwritten, 0); |
949 | INIT_WORK(&ei->i_rsv_conversion_work, ext4_end_io_rsv_work); | 946 | INIT_WORK(&ei->i_rsv_conversion_work, ext4_end_io_rsv_work); |
950 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 947 | #ifdef CONFIG_EXT4_FS_ENCRYPTION |
@@ -1132,6 +1129,7 @@ static const struct dquot_operations ext4_quota_operations = { | |||
1132 | .alloc_dquot = dquot_alloc, | 1129 | .alloc_dquot = dquot_alloc, |
1133 | .destroy_dquot = dquot_destroy, | 1130 | .destroy_dquot = dquot_destroy, |
1134 | .get_projid = ext4_get_projid, | 1131 | .get_projid = ext4_get_projid, |
1132 | .get_next_id = dquot_get_next_id, | ||
1135 | }; | 1133 | }; |
1136 | 1134 | ||
1137 | static const struct quotactl_ops ext4_qctl_operations = { | 1135 | static const struct quotactl_ops ext4_qctl_operations = { |
@@ -1141,7 +1139,8 @@ static const struct quotactl_ops ext4_qctl_operations = { | |||
1141 | .get_state = dquot_get_state, | 1139 | .get_state = dquot_get_state, |
1142 | .set_info = dquot_set_dqinfo, | 1140 | .set_info = dquot_set_dqinfo, |
1143 | .get_dqblk = dquot_get_dqblk, | 1141 | .get_dqblk = dquot_get_dqblk, |
1144 | .set_dqblk = dquot_set_dqblk | 1142 | .set_dqblk = dquot_set_dqblk, |
1143 | .get_nextdqblk = dquot_get_next_dqblk, | ||
1145 | }; | 1144 | }; |
1146 | #endif | 1145 | #endif |
1147 | 1146 | ||
@@ -1425,9 +1424,9 @@ static const struct mount_opts { | |||
1425 | {Opt_err_ro, EXT4_MOUNT_ERRORS_RO, MOPT_SET | MOPT_CLEAR_ERR}, | 1424 | {Opt_err_ro, EXT4_MOUNT_ERRORS_RO, MOPT_SET | MOPT_CLEAR_ERR}, |
1426 | {Opt_err_cont, EXT4_MOUNT_ERRORS_CONT, MOPT_SET | MOPT_CLEAR_ERR}, | 1425 | {Opt_err_cont, EXT4_MOUNT_ERRORS_CONT, MOPT_SET | MOPT_CLEAR_ERR}, |
1427 | {Opt_data_err_abort, EXT4_MOUNT_DATA_ERR_ABORT, | 1426 | {Opt_data_err_abort, EXT4_MOUNT_DATA_ERR_ABORT, |
1428 | MOPT_NO_EXT2 | MOPT_SET}, | 1427 | MOPT_NO_EXT2}, |
1429 | {Opt_data_err_ignore, EXT4_MOUNT_DATA_ERR_ABORT, | 1428 | {Opt_data_err_ignore, EXT4_MOUNT_DATA_ERR_ABORT, |
1430 | MOPT_NO_EXT2 | MOPT_CLEAR}, | 1429 | MOPT_NO_EXT2}, |
1431 | {Opt_barrier, EXT4_MOUNT_BARRIER, MOPT_SET}, | 1430 | {Opt_barrier, EXT4_MOUNT_BARRIER, MOPT_SET}, |
1432 | {Opt_nobarrier, EXT4_MOUNT_BARRIER, MOPT_CLEAR}, | 1431 | {Opt_nobarrier, EXT4_MOUNT_BARRIER, MOPT_CLEAR}, |
1433 | {Opt_noauto_da_alloc, EXT4_MOUNT_NO_AUTO_DA_ALLOC, MOPT_SET}, | 1432 | {Opt_noauto_da_alloc, EXT4_MOUNT_NO_AUTO_DA_ALLOC, MOPT_SET}, |
@@ -1705,6 +1704,10 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, | |||
1705 | ext4_msg(sb, KERN_INFO, "dax option not supported"); | 1704 | ext4_msg(sb, KERN_INFO, "dax option not supported"); |
1706 | return -1; | 1705 | return -1; |
1707 | #endif | 1706 | #endif |
1707 | } else if (token == Opt_data_err_abort) { | ||
1708 | sbi->s_mount_opt |= m->mount_opt; | ||
1709 | } else if (token == Opt_data_err_ignore) { | ||
1710 | sbi->s_mount_opt &= ~m->mount_opt; | ||
1708 | } else { | 1711 | } else { |
1709 | if (!args->from) | 1712 | if (!args->from) |
1710 | arg = 1; | 1713 | arg = 1; |
@@ -1914,6 +1917,8 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb, | |||
1914 | SEQ_OPTS_PRINT("init_itable=%u", sbi->s_li_wait_mult); | 1917 | SEQ_OPTS_PRINT("init_itable=%u", sbi->s_li_wait_mult); |
1915 | if (nodefs || sbi->s_max_dir_size_kb) | 1918 | if (nodefs || sbi->s_max_dir_size_kb) |
1916 | SEQ_OPTS_PRINT("max_dir_size_kb=%u", sbi->s_max_dir_size_kb); | 1919 | SEQ_OPTS_PRINT("max_dir_size_kb=%u", sbi->s_max_dir_size_kb); |
1920 | if (test_opt(sb, DATA_ERR_ABORT)) | ||
1921 | SEQ_OPTS_PUTS("data_err=abort"); | ||
1917 | 1922 | ||
1918 | ext4_show_quota_options(seq, sb); | 1923 | ext4_show_quota_options(seq, sb); |
1919 | return 0; | 1924 | return 0; |
@@ -3796,12 +3801,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3796 | sbi->s_journal->j_commit_callback = ext4_journal_commit_callback; | 3801 | sbi->s_journal->j_commit_callback = ext4_journal_commit_callback; |
3797 | 3802 | ||
3798 | no_journal: | 3803 | no_journal: |
3799 | if (ext4_mballoc_ready) { | 3804 | sbi->s_mb_cache = ext4_xattr_create_cache(); |
3800 | sbi->s_mb_cache = ext4_xattr_create_cache(sb->s_id); | 3805 | if (!sbi->s_mb_cache) { |
3801 | if (!sbi->s_mb_cache) { | 3806 | ext4_msg(sb, KERN_ERR, "Failed to create an mb_cache"); |
3802 | ext4_msg(sb, KERN_ERR, "Failed to create an mb_cache"); | 3807 | goto failed_mount_wq; |
3803 | goto failed_mount_wq; | ||
3804 | } | ||
3805 | } | 3808 | } |
3806 | 3809 | ||
3807 | if ((DUMMY_ENCRYPTION_ENABLED(sbi) || ext4_has_feature_encrypt(sb)) && | 3810 | if ((DUMMY_ENCRYPTION_ENABLED(sbi) || ext4_has_feature_encrypt(sb)) && |
@@ -4027,6 +4030,10 @@ failed_mount4: | |||
4027 | if (EXT4_SB(sb)->rsv_conversion_wq) | 4030 | if (EXT4_SB(sb)->rsv_conversion_wq) |
4028 | destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq); | 4031 | destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq); |
4029 | failed_mount_wq: | 4032 | failed_mount_wq: |
4033 | if (sbi->s_mb_cache) { | ||
4034 | ext4_xattr_destroy_cache(sbi->s_mb_cache); | ||
4035 | sbi->s_mb_cache = NULL; | ||
4036 | } | ||
4030 | if (sbi->s_journal) { | 4037 | if (sbi->s_journal) { |
4031 | jbd2_journal_destroy(sbi->s_journal); | 4038 | jbd2_journal_destroy(sbi->s_journal); |
4032 | sbi->s_journal = NULL; | 4039 | sbi->s_journal = NULL; |
@@ -5321,7 +5328,6 @@ MODULE_ALIAS_FS("ext4"); | |||
5321 | 5328 | ||
5322 | /* Shared across all ext4 file systems */ | 5329 | /* Shared across all ext4 file systems */ |
5323 | wait_queue_head_t ext4__ioend_wq[EXT4_WQ_HASH_SZ]; | 5330 | wait_queue_head_t ext4__ioend_wq[EXT4_WQ_HASH_SZ]; |
5324 | struct mutex ext4__aio_mutex[EXT4_WQ_HASH_SZ]; | ||
5325 | 5331 | ||
5326 | static int __init ext4_init_fs(void) | 5332 | static int __init ext4_init_fs(void) |
5327 | { | 5333 | { |
@@ -5334,10 +5340,8 @@ static int __init ext4_init_fs(void) | |||
5334 | /* Build-time check for flags consistency */ | 5340 | /* Build-time check for flags consistency */ |
5335 | ext4_check_flag_values(); | 5341 | ext4_check_flag_values(); |
5336 | 5342 | ||
5337 | for (i = 0; i < EXT4_WQ_HASH_SZ; i++) { | 5343 | for (i = 0; i < EXT4_WQ_HASH_SZ; i++) |
5338 | mutex_init(&ext4__aio_mutex[i]); | ||
5339 | init_waitqueue_head(&ext4__ioend_wq[i]); | 5344 | init_waitqueue_head(&ext4__ioend_wq[i]); |
5340 | } | ||
5341 | 5345 | ||
5342 | err = ext4_init_es(); | 5346 | err = ext4_init_es(); |
5343 | if (err) | 5347 | if (err) |
@@ -5358,8 +5362,6 @@ static int __init ext4_init_fs(void) | |||
5358 | err = ext4_init_mballoc(); | 5362 | err = ext4_init_mballoc(); |
5359 | if (err) | 5363 | if (err) |
5360 | goto out2; | 5364 | goto out2; |
5361 | else | ||
5362 | ext4_mballoc_ready = 1; | ||
5363 | err = init_inodecache(); | 5365 | err = init_inodecache(); |
5364 | if (err) | 5366 | if (err) |
5365 | goto out1; | 5367 | goto out1; |
@@ -5375,7 +5377,6 @@ out: | |||
5375 | unregister_as_ext3(); | 5377 | unregister_as_ext3(); |
5376 | destroy_inodecache(); | 5378 | destroy_inodecache(); |
5377 | out1: | 5379 | out1: |
5378 | ext4_mballoc_ready = 0; | ||
5379 | ext4_exit_mballoc(); | 5380 | ext4_exit_mballoc(); |
5380 | out2: | 5381 | out2: |
5381 | ext4_exit_sysfs(); | 5382 | ext4_exit_sysfs(); |