diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-01-06 11:14:25 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-01-06 11:14:25 -0500 |
commit | c31910672376dfb8d020e32afa7249763bcd924a (patch) | |
tree | 3f2b95a1d4a4da76d85d5bf32534fa3d15a82eac | |
parent | c39a7f84d7845aa95d1c7c168f38215aedcc13c2 (diff) |
ext4: Remove code to create the journal inode
This code has been obsolete in quite some time, since the supported
method for adding a journal inode is to use tune2fs (or to creating
new filesystem with a journal via mke2fs or mkfs.ext4).
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | Documentation/filesystems/ext4.txt | 4 | ||||
-rw-r--r-- | fs/ext4/super.c | 68 | ||||
-rw-r--r-- | fs/jbd2/journal.c | 72 | ||||
-rw-r--r-- | include/linux/jbd2.h | 1 |
4 files changed, 4 insertions, 141 deletions
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt index e3fcbea3ec8c..9ec29d86ff8b 100644 --- a/Documentation/filesystems/ext4.txt +++ b/Documentation/filesystems/ext4.txt | |||
@@ -149,10 +149,6 @@ journal_async_commit Commit block can be written to disk without waiting | |||
149 | journal=update Update the ext4 file system's journal to the current | 149 | journal=update Update the ext4 file system's journal to the current |
150 | format. | 150 | format. |
151 | 151 | ||
152 | journal=inum When a journal already exists, this option is ignored. | ||
153 | Otherwise, it specifies the number of the inode which | ||
154 | will represent the ext4 file system's journal file. | ||
155 | |||
156 | journal_dev=devnum When the external journal device's major/minor numbers | 152 | journal_dev=devnum When the external journal device's major/minor numbers |
157 | have changed, this option allows the user to specify | 153 | have changed, this option allows the user to specify |
158 | the new journal location. The journal device is | 154 | the new journal location. The journal device is |
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 | ||
52 | static int ext4_load_journal(struct super_block *, struct ext4_super_block *, | 52 | static int ext4_load_journal(struct super_block *, struct ext4_super_block *, |
53 | unsigned long journal_devnum); | 53 | unsigned long journal_devnum); |
54 | static int ext4_create_journal(struct super_block *, struct ext4_super_block *, | ||
55 | unsigned int); | ||
56 | static void ext4_commit_super(struct super_block *sb, | 54 | static void ext4_commit_super(struct super_block *sb, |
57 | struct ext4_super_block *es, int sync); | 55 | struct ext4_super_block *es, int sync); |
58 | static void ext4_mark_recovery_complete(struct super_block *sb, | 56 | static 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 | ||
1104 | static int parse_options(char *options, struct super_block *sb, | 1101 | static 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 | ||
2929 | static 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 | |||
2971 | static void ext4_commit_super(struct super_block *sb, | 2911 | static 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 | } |
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 34ef98057202..b10d7283ba5b 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -66,7 +66,6 @@ EXPORT_SYMBOL(jbd2_journal_update_format); | |||
66 | EXPORT_SYMBOL(jbd2_journal_check_used_features); | 66 | EXPORT_SYMBOL(jbd2_journal_check_used_features); |
67 | EXPORT_SYMBOL(jbd2_journal_check_available_features); | 67 | EXPORT_SYMBOL(jbd2_journal_check_available_features); |
68 | EXPORT_SYMBOL(jbd2_journal_set_features); | 68 | EXPORT_SYMBOL(jbd2_journal_set_features); |
69 | EXPORT_SYMBOL(jbd2_journal_create); | ||
70 | EXPORT_SYMBOL(jbd2_journal_load); | 69 | EXPORT_SYMBOL(jbd2_journal_load); |
71 | EXPORT_SYMBOL(jbd2_journal_destroy); | 70 | EXPORT_SYMBOL(jbd2_journal_destroy); |
72 | EXPORT_SYMBOL(jbd2_journal_abort); | 71 | EXPORT_SYMBOL(jbd2_journal_abort); |
@@ -1163,77 +1162,6 @@ static int journal_reset(journal_t *journal) | |||
1163 | } | 1162 | } |
1164 | 1163 | ||
1165 | /** | 1164 | /** |
1166 | * int jbd2_journal_create() - Initialise the new journal file | ||
1167 | * @journal: Journal to create. This structure must have been initialised | ||
1168 | * | ||
1169 | * Given a journal_t structure which tells us which disk blocks we can | ||
1170 | * use, create a new journal superblock and initialise all of the | ||
1171 | * journal fields from scratch. | ||
1172 | **/ | ||
1173 | int jbd2_journal_create(journal_t *journal) | ||
1174 | { | ||
1175 | unsigned long long blocknr; | ||
1176 | struct buffer_head *bh; | ||
1177 | journal_superblock_t *sb; | ||
1178 | int i, err; | ||
1179 | |||
1180 | if (journal->j_maxlen < JBD2_MIN_JOURNAL_BLOCKS) { | ||
1181 | printk (KERN_ERR "Journal length (%d blocks) too short.\n", | ||
1182 | journal->j_maxlen); | ||
1183 | journal_fail_superblock(journal); | ||
1184 | return -EINVAL; | ||
1185 | } | ||
1186 | |||
1187 | if (journal->j_inode == NULL) { | ||
1188 | /* | ||
1189 | * We don't know what block to start at! | ||
1190 | */ | ||
1191 | printk(KERN_EMERG | ||
1192 | "%s: creation of journal on external device!\n", | ||
1193 | __func__); | ||
1194 | BUG(); | ||
1195 | } | ||
1196 | |||
1197 | /* Zero out the entire journal on disk. We cannot afford to | ||
1198 | have any blocks on disk beginning with JBD2_MAGIC_NUMBER. */ | ||
1199 | jbd_debug(1, "JBD: Zeroing out journal blocks...\n"); | ||
1200 | for (i = 0; i < journal->j_maxlen; i++) { | ||
1201 | err = jbd2_journal_bmap(journal, i, &blocknr); | ||
1202 | if (err) | ||
1203 | return err; | ||
1204 | bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); | ||
1205 | lock_buffer(bh); | ||
1206 | memset (bh->b_data, 0, journal->j_blocksize); | ||
1207 | BUFFER_TRACE(bh, "marking dirty"); | ||
1208 | mark_buffer_dirty(bh); | ||
1209 | BUFFER_TRACE(bh, "marking uptodate"); | ||
1210 | set_buffer_uptodate(bh); | ||
1211 | unlock_buffer(bh); | ||
1212 | __brelse(bh); | ||
1213 | } | ||
1214 | |||
1215 | sync_blockdev(journal->j_dev); | ||
1216 | jbd_debug(1, "JBD: journal cleared.\n"); | ||
1217 | |||
1218 | /* OK, fill in the initial static fields in the new superblock */ | ||
1219 | sb = journal->j_superblock; | ||
1220 | |||
1221 | sb->s_header.h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); | ||
1222 | sb->s_header.h_blocktype = cpu_to_be32(JBD2_SUPERBLOCK_V2); | ||
1223 | |||
1224 | sb->s_blocksize = cpu_to_be32(journal->j_blocksize); | ||
1225 | sb->s_maxlen = cpu_to_be32(journal->j_maxlen); | ||
1226 | sb->s_first = cpu_to_be32(1); | ||
1227 | |||
1228 | journal->j_transaction_sequence = 1; | ||
1229 | |||
1230 | journal->j_flags &= ~JBD2_ABORT; | ||
1231 | journal->j_format_version = 2; | ||
1232 | |||
1233 | return journal_reset(journal); | ||
1234 | } | ||
1235 | |||
1236 | /** | ||
1237 | * void jbd2_journal_update_superblock() - Update journal sb on disk. | 1165 | * void jbd2_journal_update_superblock() - Update journal sb on disk. |
1238 | * @journal: The journal to update. | 1166 | * @journal: The journal to update. |
1239 | * @wait: Set to '0' if you don't want to wait for IO completion. | 1167 | * @wait: Set to '0' if you don't want to wait for IO completion. |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 9d82084a1605..adef1c9940d3 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -1104,7 +1104,6 @@ extern int jbd2_journal_set_features | |||
1104 | (journal_t *, unsigned long, unsigned long, unsigned long); | 1104 | (journal_t *, unsigned long, unsigned long, unsigned long); |
1105 | extern void jbd2_journal_clear_features | 1105 | extern void jbd2_journal_clear_features |
1106 | (journal_t *, unsigned long, unsigned long, unsigned long); | 1106 | (journal_t *, unsigned long, unsigned long, unsigned long); |
1107 | extern int jbd2_journal_create (journal_t *); | ||
1108 | extern int jbd2_journal_load (journal_t *journal); | 1107 | extern int jbd2_journal_load (journal_t *journal); |
1109 | extern int jbd2_journal_destroy (journal_t *); | 1108 | extern int jbd2_journal_destroy (journal_t *); |
1110 | extern int jbd2_journal_recover (journal_t *journal); | 1109 | extern int jbd2_journal_recover (journal_t *journal); |