aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c68
1 files changed, 4 insertions, 64 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e5ab520724da..8036392b2121 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -51,8 +51,6 @@ struct proc_dir_entry *ext4_proc_root;
51 51
52static int ext4_load_journal(struct super_block *, struct ext4_super_block *, 52static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
53 unsigned long journal_devnum); 53 unsigned long journal_devnum);
54static int ext4_create_journal(struct super_block *, struct ext4_super_block *,
55 unsigned int);
56static void ext4_commit_super(struct super_block *sb, 54static void ext4_commit_super(struct super_block *sb,
57 struct ext4_super_block *es, int sync); 55 struct ext4_super_block *es, int sync);
58static void ext4_mark_recovery_complete(struct super_block *sb, 56static void ext4_mark_recovery_complete(struct super_block *sb,
@@ -1006,7 +1004,7 @@ enum {
1006 Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, 1004 Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl,
1007 Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, Opt_bh, 1005 Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, Opt_bh,
1008 Opt_commit, Opt_min_batch_time, Opt_max_batch_time, 1006 Opt_commit, Opt_min_batch_time, Opt_max_batch_time,
1009 Opt_journal_update, Opt_journal_inum, Opt_journal_dev, 1007 Opt_journal_update, Opt_journal_dev,
1010 Opt_journal_checksum, Opt_journal_async_commit, 1008 Opt_journal_checksum, Opt_journal_async_commit,
1011 Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, 1009 Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
1012 Opt_data_err_abort, Opt_data_err_ignore, 1010 Opt_data_err_abort, Opt_data_err_ignore,
@@ -1048,7 +1046,6 @@ static const match_table_t tokens = {
1048 {Opt_min_batch_time, "min_batch_time=%u"}, 1046 {Opt_min_batch_time, "min_batch_time=%u"},
1049 {Opt_max_batch_time, "max_batch_time=%u"}, 1047 {Opt_max_batch_time, "max_batch_time=%u"},
1050 {Opt_journal_update, "journal=update"}, 1048 {Opt_journal_update, "journal=update"},
1051 {Opt_journal_inum, "journal=%u"},
1052 {Opt_journal_dev, "journal_dev=%u"}, 1049 {Opt_journal_dev, "journal_dev=%u"},
1053 {Opt_journal_checksum, "journal_checksum"}, 1050 {Opt_journal_checksum, "journal_checksum"},
1054 {Opt_journal_async_commit, "journal_async_commit"}, 1051 {Opt_journal_async_commit, "journal_async_commit"},
@@ -1102,7 +1099,7 @@ static ext4_fsblk_t get_sb_block(void **data)
1102} 1099}
1103 1100
1104static int parse_options(char *options, struct super_block *sb, 1101static int parse_options(char *options, struct super_block *sb,
1105 unsigned int *inum, unsigned long *journal_devnum, 1102 unsigned long *journal_devnum,
1106 ext4_fsblk_t *n_blocks_count, int is_remount) 1103 ext4_fsblk_t *n_blocks_count, int is_remount)
1107{ 1104{
1108 struct ext4_sb_info *sbi = EXT4_SB(sb); 1105 struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -1226,16 +1223,6 @@ static int parse_options(char *options, struct super_block *sb,
1226 } 1223 }
1227 set_opt(sbi->s_mount_opt, UPDATE_JOURNAL); 1224 set_opt(sbi->s_mount_opt, UPDATE_JOURNAL);
1228 break; 1225 break;
1229 case Opt_journal_inum:
1230 if (is_remount) {
1231 printk(KERN_ERR "EXT4-fs: cannot specify "
1232 "journal on remount\n");
1233 return 0;
1234 }
1235 if (match_int(&args[0], &option))
1236 return 0;
1237 *inum = option;
1238 break;
1239 case Opt_journal_dev: 1226 case Opt_journal_dev:
1240 if (is_remount) { 1227 if (is_remount) {
1241 printk(KERN_ERR "EXT4-fs: cannot specify " 1228 printk(KERN_ERR "EXT4-fs: cannot specify "
@@ -2035,7 +2022,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2035 ext4_fsblk_t sb_block = get_sb_block(&data); 2022 ext4_fsblk_t sb_block = get_sb_block(&data);
2036 ext4_fsblk_t logical_sb_block; 2023 ext4_fsblk_t logical_sb_block;
2037 unsigned long offset = 0; 2024 unsigned long offset = 0;
2038 unsigned int journal_inum = 0;
2039 unsigned long journal_devnum = 0; 2025 unsigned long journal_devnum = 0;
2040 unsigned long def_mount_opts; 2026 unsigned long def_mount_opts;
2041 struct inode *root; 2027 struct inode *root;
@@ -2155,8 +2141,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2155 set_opt(sbi->s_mount_opt, DELALLOC); 2141 set_opt(sbi->s_mount_opt, DELALLOC);
2156 2142
2157 2143
2158 if (!parse_options((char *) data, sb, &journal_inum, &journal_devnum, 2144 if (!parse_options((char *) data, sb, &journal_devnum, NULL, 0))
2159 NULL, 0))
2160 goto failed_mount; 2145 goto failed_mount;
2161 2146
2162 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 2147 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
@@ -2460,9 +2445,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2460 goto failed_mount4; 2445 goto failed_mount4;
2461 } 2446 }
2462 } 2447 }
2463 } else if (journal_inum) {
2464 if (ext4_create_journal(sb, es, journal_inum))
2465 goto failed_mount3;
2466 } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && 2448 } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) &&
2467 EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { 2449 EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) {
2468 printk(KERN_ERR "EXT4-fs: required journal recovery " 2450 printk(KERN_ERR "EXT4-fs: required journal recovery "
@@ -2926,48 +2908,6 @@ static int ext4_load_journal(struct super_block *sb,
2926 return 0; 2908 return 0;
2927} 2909}
2928 2910
2929static int ext4_create_journal(struct super_block *sb,
2930 struct ext4_super_block *es,
2931 unsigned int journal_inum)
2932{
2933 journal_t *journal;
2934 int err;
2935
2936 if (sb->s_flags & MS_RDONLY) {
2937 printk(KERN_ERR "EXT4-fs: readonly filesystem when trying to "
2938 "create journal.\n");
2939 return -EROFS;
2940 }
2941
2942 journal = ext4_get_journal(sb, journal_inum);
2943 if (!journal)
2944 return -EINVAL;
2945
2946 printk(KERN_INFO "EXT4-fs: creating new journal on inode %u\n",
2947 journal_inum);
2948
2949 err = jbd2_journal_create(journal);
2950 if (err) {
2951 printk(KERN_ERR "EXT4-fs: error creating journal.\n");
2952 jbd2_journal_destroy(journal);
2953 return -EIO;
2954 }
2955
2956 EXT4_SB(sb)->s_journal = journal;
2957
2958 ext4_update_dynamic_rev(sb);
2959 EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
2960 EXT4_SET_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL);
2961
2962 es->s_journal_inum = cpu_to_le32(journal_inum);
2963 sb->s_dirt = 1;
2964
2965 /* Make sure we flush the recovery flag to disk. */
2966 ext4_commit_super(sb, es, 1);
2967
2968 return 0;
2969}
2970
2971static void ext4_commit_super(struct super_block *sb, 2911static void ext4_commit_super(struct super_block *sb,
2972 struct ext4_super_block *es, int sync) 2912 struct ext4_super_block *es, int sync)
2973{ 2913{
@@ -3209,7 +3149,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
3209 /* 3149 /*
3210 * Allow the "check" option to be passed as a remount option. 3150 * Allow the "check" option to be passed as a remount option.
3211 */ 3151 */
3212 if (!parse_options(data, sb, NULL, NULL, &n_blocks_count, 1)) { 3152 if (!parse_options(data, sb, NULL, &n_blocks_count, 1)) {
3213 err = -EINVAL; 3153 err = -EINVAL;
3214 goto restore_opts; 3154 goto restore_opts;
3215 } 3155 }