aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
authorAlexey Fisher <bug-track@fisher-privat.net>2009-11-22 14:38:55 -0500
committerJan Kara <jack@suse.cz>2009-12-10 09:02:53 -0500
commit4cf46b67eb6de94532c1bea11d2479d085229d0e (patch)
tree1d14729f879ccc0afc56563b4edfb50ddec8c38c /fs/ext3
parent2074abfeb8ea2904aeeaecc45e0dfea3f83a22b2 (diff)
ext3: Unify log messages in ext3
Make messages produced by ext3 more unified. It should be easy to parse. dmesg before patch: [ 4893.684892] reservations ON [ 4893.684896] xip option not supported [ 4893.684964] EXT3-fs warning: maximal mount count reached, running e2fsck is recommended dmesg after patch: [ 873.300792] EXT3-fs (loop0): using internal journaln [ 873.300796] EXT3-fs (loop0): mounted filesystem with writeback data mode [ 924.163657] EXT3-fs (loop0): error: can't find ext3 filesystem on dev loop0. [ 723.755642] EXT3-fs (loop0): error: bad blocksize 8192 [ 357.874687] EXT3-fs (loop0): error: no journal found. mounting ext3 over ext2? [ 873.300764] EXT3-fs (loop0): warning: maximal mount count reached, running e2fsck is recommended [ 924.163657] EXT3-fs (loop0): error: can't find ext3 filesystem on dev loop0. Signed-off-by: Alexey Fisher <bug-track@fisher-privat.net> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/super.c432
1 files changed, 227 insertions, 205 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index c1d128d765b6..46433b30e45f 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -135,12 +135,24 @@ void ext3_journal_abort_handle(const char *caller, const char *err_fn,
135 if (is_handle_aborted(handle)) 135 if (is_handle_aborted(handle))
136 return; 136 return;
137 137
138 printk(KERN_ERR "%s: aborting transaction: %s in %s\n", 138 printk(KERN_ERR "EXT3-fs: %s: aborting transaction: %s in %s\n",
139 caller, errstr, err_fn); 139 caller, errstr, err_fn);
140 140
141 journal_abort_handle(handle); 141 journal_abort_handle(handle);
142} 142}
143 143
144void ext3_msg(struct super_block *sb, const char *prefix,
145 const char *fmt, ...)
146{
147 va_list args;
148
149 va_start(args, fmt);
150 printk("%sEXT3-fs (%s): ", prefix, sb->s_id);
151 vprintk(fmt, args);
152 printk("\n");
153 va_end(args);
154}
155
144/* Deal with the reporting of failure conditions on a filesystem such as 156/* Deal with the reporting of failure conditions on a filesystem such as
145 * inconsistencies detected or read IO failures. 157 * inconsistencies detected or read IO failures.
146 * 158 *
@@ -174,12 +186,13 @@ static void ext3_handle_error(struct super_block *sb)
174 journal_abort(journal, -EIO); 186 journal_abort(journal, -EIO);
175 } 187 }
176 if (test_opt (sb, ERRORS_RO)) { 188 if (test_opt (sb, ERRORS_RO)) {
177 printk (KERN_CRIT "Remounting filesystem read-only\n"); 189 ext3_msg(sb, KERN_CRIT,
190 "error: remounting filesystem read-only");
178 sb->s_flags |= MS_RDONLY; 191 sb->s_flags |= MS_RDONLY;
179 } 192 }
180 ext3_commit_super(sb, es, 1); 193 ext3_commit_super(sb, es, 1);
181 if (test_opt(sb, ERRORS_PANIC)) 194 if (test_opt(sb, ERRORS_PANIC))
182 panic("EXT3-fs (device %s): panic forced after error\n", 195 panic("EXT3-fs (%s): panic forced after error\n",
183 sb->s_id); 196 sb->s_id);
184} 197}
185 198
@@ -247,8 +260,7 @@ void __ext3_std_error (struct super_block * sb, const char * function,
247 return; 260 return;
248 261
249 errstr = ext3_decode_error(sb, errno, nbuf); 262 errstr = ext3_decode_error(sb, errno, nbuf);
250 printk (KERN_CRIT "EXT3-fs error (device %s) in %s: %s\n", 263 ext3_msg(sb, KERN_CRIT, "error in %s: %s", function, errstr);
251 sb->s_id, function, errstr);
252 264
253 ext3_handle_error(sb); 265 ext3_handle_error(sb);
254} 266}
@@ -268,21 +280,20 @@ void ext3_abort (struct super_block * sb, const char * function,
268{ 280{
269 va_list args; 281 va_list args;
270 282
271 printk (KERN_CRIT "ext3_abort called.\n");
272
273 va_start(args, fmt); 283 va_start(args, fmt);
274 printk(KERN_CRIT "EXT3-fs error (device %s): %s: ",sb->s_id, function); 284 printk(KERN_CRIT "EXT3-fs (%s): error: %s: ", sb->s_id, function);
275 vprintk(fmt, args); 285 vprintk(fmt, args);
276 printk("\n"); 286 printk("\n");
277 va_end(args); 287 va_end(args);
278 288
279 if (test_opt(sb, ERRORS_PANIC)) 289 if (test_opt(sb, ERRORS_PANIC))
280 panic("EXT3-fs panic from previous error\n"); 290 panic("EXT3-fs: panic from previous error\n");
281 291
282 if (sb->s_flags & MS_RDONLY) 292 if (sb->s_flags & MS_RDONLY)
283 return; 293 return;
284 294
285 printk(KERN_CRIT "Remounting filesystem read-only\n"); 295 ext3_msg(sb, KERN_CRIT,
296 "error: remounting filesystem read-only");
286 EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; 297 EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
287 sb->s_flags |= MS_RDONLY; 298 sb->s_flags |= MS_RDONLY;
288 EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT; 299 EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT;
@@ -296,7 +307,7 @@ void ext3_warning (struct super_block * sb, const char * function,
296 va_list args; 307 va_list args;
297 308
298 va_start(args, fmt); 309 va_start(args, fmt);
299 printk(KERN_WARNING "EXT3-fs warning (device %s): %s: ", 310 printk(KERN_WARNING "EXT3-fs (%s): warning: %s: ",
300 sb->s_id, function); 311 sb->s_id, function);
301 vprintk(fmt, args); 312 vprintk(fmt, args);
302 printk("\n"); 313 printk("\n");
@@ -310,10 +321,10 @@ void ext3_update_dynamic_rev(struct super_block *sb)
310 if (le32_to_cpu(es->s_rev_level) > EXT3_GOOD_OLD_REV) 321 if (le32_to_cpu(es->s_rev_level) > EXT3_GOOD_OLD_REV)
311 return; 322 return;
312 323
313 ext3_warning(sb, __func__, 324 ext3_msg(sb, KERN_WARNING,
314 "updating to rev %d because of new feature flag, " 325 "warning: updating to rev %d because of "
315 "running e2fsck is recommended", 326 "new feature flag, running e2fsck is recommended",
316 EXT3_DYNAMIC_REV); 327 EXT3_DYNAMIC_REV);
317 328
318 es->s_first_ino = cpu_to_le32(EXT3_GOOD_OLD_FIRST_INO); 329 es->s_first_ino = cpu_to_le32(EXT3_GOOD_OLD_FIRST_INO);
319 es->s_inode_size = cpu_to_le16(EXT3_GOOD_OLD_INODE_SIZE); 330 es->s_inode_size = cpu_to_le16(EXT3_GOOD_OLD_INODE_SIZE);
@@ -331,7 +342,7 @@ void ext3_update_dynamic_rev(struct super_block *sb)
331/* 342/*
332 * Open the external journal device 343 * Open the external journal device
333 */ 344 */
334static struct block_device *ext3_blkdev_get(dev_t dev) 345static struct block_device *ext3_blkdev_get(dev_t dev, struct super_block *sb)
335{ 346{
336 struct block_device *bdev; 347 struct block_device *bdev;
337 char b[BDEVNAME_SIZE]; 348 char b[BDEVNAME_SIZE];
@@ -342,8 +353,9 @@ static struct block_device *ext3_blkdev_get(dev_t dev)
342 return bdev; 353 return bdev;
343 354
344fail: 355fail:
345 printk(KERN_ERR "EXT3: failed to open journal device %s: %ld\n", 356 ext3_msg(sb, "error: failed to open journal device %s: %ld",
346 __bdevname(dev, b), PTR_ERR(bdev)); 357 __bdevname(dev, b), PTR_ERR(bdev));
358
347 return NULL; 359 return NULL;
348} 360}
349 361
@@ -378,13 +390,13 @@ static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi)
378{ 390{
379 struct list_head *l; 391 struct list_head *l;
380 392
381 printk(KERN_ERR "sb orphan head is %d\n", 393 ext3_msg(sb, KERN_ERR, "error: sb orphan head is %d",
382 le32_to_cpu(sbi->s_es->s_last_orphan)); 394 le32_to_cpu(sbi->s_es->s_last_orphan));
383 395
384 printk(KERN_ERR "sb_info orphan list:\n"); 396 ext3_msg(sb, KERN_ERR, "sb_info orphan list:");
385 list_for_each(l, &sbi->s_orphan) { 397 list_for_each(l, &sbi->s_orphan) {
386 struct inode *inode = orphan_list_entry(l); 398 struct inode *inode = orphan_list_entry(l);
387 printk(KERN_ERR " " 399 ext3_msg(sb, KERN_ERR, " "
388 "inode %s:%lu at %p: mode %o, nlink %d, next %d\n", 400 "inode %s:%lu at %p: mode %o, nlink %d, next %d\n",
389 inode->i_sb->s_id, inode->i_ino, inode, 401 inode->i_sb->s_id, inode->i_ino, inode,
390 inode->i_mode, inode->i_nlink, 402 inode->i_mode, inode->i_nlink,
@@ -849,7 +861,7 @@ static const match_table_t tokens = {
849 {Opt_err, NULL}, 861 {Opt_err, NULL},
850}; 862};
851 863
852static ext3_fsblk_t get_sb_block(void **data) 864static ext3_fsblk_t get_sb_block(void **data, struct super_block *sb)
853{ 865{
854 ext3_fsblk_t sb_block; 866 ext3_fsblk_t sb_block;
855 char *options = (char *) *data; 867 char *options = (char *) *data;
@@ -860,7 +872,7 @@ static ext3_fsblk_t get_sb_block(void **data)
860 /*todo: use simple_strtoll with >32bit ext3 */ 872 /*todo: use simple_strtoll with >32bit ext3 */
861 sb_block = simple_strtoul(options, &options, 0); 873 sb_block = simple_strtoul(options, &options, 0);
862 if (*options && *options != ',') { 874 if (*options && *options != ',') {
863 printk("EXT3-fs: Invalid sb specification: %s\n", 875 ext3_msg(sb, "error: invalid sb specification: %s",
864 (char *) *data); 876 (char *) *data);
865 return 1; 877 return 1;
866 } 878 }
@@ -960,7 +972,8 @@ static int parse_options (char *options, struct super_block *sb,
960#else 972#else
961 case Opt_user_xattr: 973 case Opt_user_xattr:
962 case Opt_nouser_xattr: 974 case Opt_nouser_xattr:
963 printk("EXT3 (no)user_xattr options not supported\n"); 975 ext3_msg(sb, KERN_INFO,
976 "(no)user_xattr options not supported");
964 break; 977 break;
965#endif 978#endif
966#ifdef CONFIG_EXT3_FS_POSIX_ACL 979#ifdef CONFIG_EXT3_FS_POSIX_ACL
@@ -973,7 +986,8 @@ static int parse_options (char *options, struct super_block *sb,
973#else 986#else
974 case Opt_acl: 987 case Opt_acl:
975 case Opt_noacl: 988 case Opt_noacl:
976 printk("EXT3 (no)acl options not supported\n"); 989 ext3_msg(sb, KERN_INFO,
990 "(no)acl options not supported");
977 break; 991 break;
978#endif 992#endif
979 case Opt_reservation: 993 case Opt_reservation:
@@ -989,16 +1003,16 @@ static int parse_options (char *options, struct super_block *sb,
989 user to specify an existing inode to be the 1003 user to specify an existing inode to be the
990 journal file. */ 1004 journal file. */
991 if (is_remount) { 1005 if (is_remount) {
992 printk(KERN_ERR "EXT3-fs: cannot specify " 1006 ext3_msg(sb, KERN_ERR, "error: cannot specify "
993 "journal on remount\n"); 1007 "journal on remount");
994 return 0; 1008 return 0;
995 } 1009 }
996 set_opt (sbi->s_mount_opt, UPDATE_JOURNAL); 1010 set_opt (sbi->s_mount_opt, UPDATE_JOURNAL);
997 break; 1011 break;
998 case Opt_journal_inum: 1012 case Opt_journal_inum:
999 if (is_remount) { 1013 if (is_remount) {
1000 printk(KERN_ERR "EXT3-fs: cannot specify " 1014 ext3_msg(sb, KERN_ERR, "error: cannot specify "
1001 "journal on remount\n"); 1015 "journal on remount");
1002 return 0; 1016 return 0;
1003 } 1017 }
1004 if (match_int(&args[0], &option)) 1018 if (match_int(&args[0], &option))
@@ -1007,8 +1021,8 @@ static int parse_options (char *options, struct super_block *sb,
1007 break; 1021 break;
1008 case Opt_journal_dev: 1022 case Opt_journal_dev:
1009 if (is_remount) { 1023 if (is_remount) {
1010 printk(KERN_ERR "EXT3-fs: cannot specify " 1024 ext3_msg(sb, KERN_ERR, "error: cannot specify "
1011 "journal on remount\n"); 1025 "journal on remount");
1012 return 0; 1026 return 0;
1013 } 1027 }
1014 if (match_int(&args[0], &option)) 1028 if (match_int(&args[0], &option))
@@ -1040,12 +1054,11 @@ static int parse_options (char *options, struct super_block *sb,
1040 if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS) 1054 if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS)
1041 == data_opt) 1055 == data_opt)
1042 break; 1056 break;
1043 printk(KERN_ERR 1057 ext3_msg(sb, KERN_ERR,
1044 "EXT3-fs (device %s): Cannot change " 1058 "error: cannot change "
1045 "data mode on remount. The filesystem " 1059 "data mode on remount. The filesystem "
1046 "is mounted in data=%s mode and you " 1060 "is mounted in data=%s mode and you "
1047 "try to remount it in data=%s mode.\n", 1061 "try to remount it in data=%s mode.",
1048 sb->s_id,
1049 data_mode_string(sbi->s_mount_opt & 1062 data_mode_string(sbi->s_mount_opt &
1050 EXT3_MOUNT_DATA_FLAGS), 1063 EXT3_MOUNT_DATA_FLAGS),
1051 data_mode_string(data_opt)); 1064 data_mode_string(data_opt));
@@ -1070,31 +1083,31 @@ static int parse_options (char *options, struct super_block *sb,
1070set_qf_name: 1083set_qf_name:
1071 if (sb_any_quota_loaded(sb) && 1084 if (sb_any_quota_loaded(sb) &&
1072 !sbi->s_qf_names[qtype]) { 1085 !sbi->s_qf_names[qtype]) {
1073 printk(KERN_ERR 1086 ext3_msg(sb, KERN_ERR,
1074 "EXT3-fs: Cannot change journaled " 1087 "error: cannot change journaled "
1075 "quota options when quota turned on.\n"); 1088 "quota options when quota turned on.");
1076 return 0; 1089 return 0;
1077 } 1090 }
1078 qname = match_strdup(&args[0]); 1091 qname = match_strdup(&args[0]);
1079 if (!qname) { 1092 if (!qname) {
1080 printk(KERN_ERR 1093 ext3_msg(sb, KERN_ERR,
1081 "EXT3-fs: not enough memory for " 1094 "error: not enough memory for "
1082 "storing quotafile name.\n"); 1095 "storing quotafile name.");
1083 return 0; 1096 return 0;
1084 } 1097 }
1085 if (sbi->s_qf_names[qtype] && 1098 if (sbi->s_qf_names[qtype] &&
1086 strcmp(sbi->s_qf_names[qtype], qname)) { 1099 strcmp(sbi->s_qf_names[qtype], qname)) {
1087 printk(KERN_ERR 1100 ext3_msg(sb, KERN_ERR,
1088 "EXT3-fs: %s quota file already " 1101 "error: %s quota file already "
1089 "specified.\n", QTYPE2NAME(qtype)); 1102 "specified.", QTYPE2NAME(qtype));
1090 kfree(qname); 1103 kfree(qname);
1091 return 0; 1104 return 0;
1092 } 1105 }
1093 sbi->s_qf_names[qtype] = qname; 1106 sbi->s_qf_names[qtype] = qname;
1094 if (strchr(sbi->s_qf_names[qtype], '/')) { 1107 if (strchr(sbi->s_qf_names[qtype], '/')) {
1095 printk(KERN_ERR 1108 ext3_msg(sb, KERN_ERR,
1096 "EXT3-fs: quotafile must be on " 1109 "error: quotafile must be on "
1097 "filesystem root.\n"); 1110 "filesystem root.");
1098 kfree(sbi->s_qf_names[qtype]); 1111 kfree(sbi->s_qf_names[qtype]);
1099 sbi->s_qf_names[qtype] = NULL; 1112 sbi->s_qf_names[qtype] = NULL;
1100 return 0; 1113 return 0;
@@ -1109,9 +1122,9 @@ set_qf_name:
1109clear_qf_name: 1122clear_qf_name:
1110 if (sb_any_quota_loaded(sb) && 1123 if (sb_any_quota_loaded(sb) &&
1111 sbi->s_qf_names[qtype]) { 1124 sbi->s_qf_names[qtype]) {
1112 printk(KERN_ERR "EXT3-fs: Cannot change " 1125 ext3_msg(sb, KERN_ERR, "error: cannot change "
1113 "journaled quota options when " 1126 "journaled quota options when "
1114 "quota turned on.\n"); 1127 "quota turned on.");
1115 return 0; 1128 return 0;
1116 } 1129 }
1117 /* 1130 /*
@@ -1128,9 +1141,9 @@ clear_qf_name:
1128set_qf_format: 1141set_qf_format:
1129 if (sb_any_quota_loaded(sb) && 1142 if (sb_any_quota_loaded(sb) &&
1130 sbi->s_jquota_fmt != qfmt) { 1143 sbi->s_jquota_fmt != qfmt) {
1131 printk(KERN_ERR "EXT3-fs: Cannot change " 1144 ext3_msg(sb, KERN_ERR, "error: cannot change "
1132 "journaled quota options when " 1145 "journaled quota options when "
1133 "quota turned on.\n"); 1146 "quota turned on.");
1134 return 0; 1147 return 0;
1135 } 1148 }
1136 sbi->s_jquota_fmt = qfmt; 1149 sbi->s_jquota_fmt = qfmt;
@@ -1146,8 +1159,8 @@ set_qf_format:
1146 break; 1159 break;
1147 case Opt_noquota: 1160 case Opt_noquota:
1148 if (sb_any_quota_loaded(sb)) { 1161 if (sb_any_quota_loaded(sb)) {
1149 printk(KERN_ERR "EXT3-fs: Cannot change quota " 1162 ext3_msg(sb, KERN_ERR, "error: cannot change "
1150 "options when quota turned on.\n"); 1163 "quota options when quota turned on.");
1151 return 0; 1164 return 0;
1152 } 1165 }
1153 clear_opt(sbi->s_mount_opt, QUOTA); 1166 clear_opt(sbi->s_mount_opt, QUOTA);
@@ -1158,8 +1171,8 @@ set_qf_format:
1158 case Opt_quota: 1171 case Opt_quota:
1159 case Opt_usrquota: 1172 case Opt_usrquota:
1160 case Opt_grpquota: 1173 case Opt_grpquota:
1161 printk(KERN_ERR 1174 ext3_msg(sb, KERN_ERR,
1162 "EXT3-fs: quota options not supported.\n"); 1175 "error: quota options not supported.");
1163 break; 1176 break;
1164 case Opt_usrjquota: 1177 case Opt_usrjquota:
1165 case Opt_grpjquota: 1178 case Opt_grpjquota:
@@ -1167,9 +1180,9 @@ set_qf_format:
1167 case Opt_offgrpjquota: 1180 case Opt_offgrpjquota:
1168 case Opt_jqfmt_vfsold: 1181 case Opt_jqfmt_vfsold:
1169 case Opt_jqfmt_vfsv0: 1182 case Opt_jqfmt_vfsv0:
1170 printk(KERN_ERR 1183 ext3_msg(sb, KERN_ERR,
1171 "EXT3-fs: journaled quota options not " 1184 "error: journaled quota options not "
1172 "supported.\n"); 1185 "supported.");
1173 break; 1186 break;
1174 case Opt_noquota: 1187 case Opt_noquota:
1175 break; 1188 break;
@@ -1189,8 +1202,9 @@ set_qf_format:
1189 break; 1202 break;
1190 case Opt_resize: 1203 case Opt_resize:
1191 if (!is_remount) { 1204 if (!is_remount) {
1192 printk("EXT3-fs: resize option only available " 1205 ext3_msg(sb, KERN_ERR,
1193 "for remount\n"); 1206 "error: resize option only available "
1207 "for remount");
1194 return 0; 1208 return 0;
1195 } 1209 }
1196 if (match_int(&args[0], &option) != 0) 1210 if (match_int(&args[0], &option) != 0)
@@ -1204,9 +1218,9 @@ set_qf_format:
1204 clear_opt(sbi->s_mount_opt, NOBH); 1218 clear_opt(sbi->s_mount_opt, NOBH);
1205 break; 1219 break;
1206 default: 1220 default:
1207 printk (KERN_ERR 1221 ext3_msg(sb, KERN_ERR,
1208 "EXT3-fs: Unrecognized mount option \"%s\" " 1222 "error: unrecognized mount option \"%s\" "
1209 "or missing value\n", p); 1223 "or missing value", p);
1210 return 0; 1224 return 0;
1211 } 1225 }
1212 } 1226 }
@@ -1224,21 +1238,21 @@ set_qf_format:
1224 (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA)) || 1238 (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA)) ||
1225 (sbi->s_qf_names[GRPQUOTA] && 1239 (sbi->s_qf_names[GRPQUOTA] &&
1226 (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA))) { 1240 (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA))) {
1227 printk(KERN_ERR "EXT3-fs: old and new quota " 1241 ext3_msg(sb, KERN_ERR, "error: old and new quota "
1228 "format mixing.\n"); 1242 "format mixing.");
1229 return 0; 1243 return 0;
1230 } 1244 }
1231 1245
1232 if (!sbi->s_jquota_fmt) { 1246 if (!sbi->s_jquota_fmt) {
1233 printk(KERN_ERR "EXT3-fs: journaled quota format " 1247 ext3_msg(sb, KERN_ERR, "error: journaled quota format "
1234 "not specified.\n"); 1248 "not specified.");
1235 return 0; 1249 return 0;
1236 } 1250 }
1237 } else { 1251 } else {
1238 if (sbi->s_jquota_fmt) { 1252 if (sbi->s_jquota_fmt) {
1239 printk(KERN_ERR "EXT3-fs: journaled quota format " 1253 ext3_msg(sb, KERN_ERR, "error: journaled quota format "
1240 "specified with no journaling " 1254 "specified with no journaling "
1241 "enabled.\n"); 1255 "enabled.");
1242 return 0; 1256 return 0;
1243 } 1257 }
1244 } 1258 }
@@ -1253,31 +1267,33 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
1253 int res = 0; 1267 int res = 0;
1254 1268
1255 if (le32_to_cpu(es->s_rev_level) > EXT3_MAX_SUPP_REV) { 1269 if (le32_to_cpu(es->s_rev_level) > EXT3_MAX_SUPP_REV) {
1256 printk (KERN_ERR "EXT3-fs warning: revision level too high, " 1270 ext3_msg(sb, KERN_ERR,
1257 "forcing read-only mode\n"); 1271 "error: revision level too high, "
1272 "forcing read-only mode");
1258 res = MS_RDONLY; 1273 res = MS_RDONLY;
1259 } 1274 }
1260 if (read_only) 1275 if (read_only)
1261 return res; 1276 return res;
1262 if (!(sbi->s_mount_state & EXT3_VALID_FS)) 1277 if (!(sbi->s_mount_state & EXT3_VALID_FS))
1263 printk (KERN_WARNING "EXT3-fs warning: mounting unchecked fs, " 1278 ext3_msg(sb, KERN_WARNING,
1264 "running e2fsck is recommended\n"); 1279 "warning: mounting unchecked fs, "
1280 "running e2fsck is recommended");
1265 else if ((sbi->s_mount_state & EXT3_ERROR_FS)) 1281 else if ((sbi->s_mount_state & EXT3_ERROR_FS))
1266 printk (KERN_WARNING 1282 ext3_msg(sb, KERN_WARNING,
1267 "EXT3-fs warning: mounting fs with errors, " 1283 "warning: mounting fs with errors, "
1268 "running e2fsck is recommended\n"); 1284 "running e2fsck is recommended");
1269 else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 && 1285 else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 &&
1270 le16_to_cpu(es->s_mnt_count) >= 1286 le16_to_cpu(es->s_mnt_count) >=
1271 (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count)) 1287 (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count))
1272 printk (KERN_WARNING 1288 ext3_msg(sb, KERN_WARNING,
1273 "EXT3-fs warning: maximal mount count reached, " 1289 "warning: maximal mount count reached, "
1274 "running e2fsck is recommended\n"); 1290 "running e2fsck is recommended");
1275 else if (le32_to_cpu(es->s_checkinterval) && 1291 else if (le32_to_cpu(es->s_checkinterval) &&
1276 (le32_to_cpu(es->s_lastcheck) + 1292 (le32_to_cpu(es->s_lastcheck) +
1277 le32_to_cpu(es->s_checkinterval) <= get_seconds())) 1293 le32_to_cpu(es->s_checkinterval) <= get_seconds()))
1278 printk (KERN_WARNING 1294 ext3_msg(sb, KERN_WARNING,
1279 "EXT3-fs warning: checktime reached, " 1295 "warning: checktime reached, "
1280 "running e2fsck is recommended\n"); 1296 "running e2fsck is recommended");
1281#if 0 1297#if 0
1282 /* @@@ We _will_ want to clear the valid bit if we find 1298 /* @@@ We _will_ want to clear the valid bit if we find
1283 inconsistencies, to force a fsck at reboot. But for 1299 inconsistencies, to force a fsck at reboot. But for
@@ -1294,22 +1310,20 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
1294 1310
1295 ext3_commit_super(sb, es, 1); 1311 ext3_commit_super(sb, es, 1);
1296 if (test_opt(sb, DEBUG)) 1312 if (test_opt(sb, DEBUG))
1297 printk(KERN_INFO "[EXT3 FS bs=%lu, gc=%lu, " 1313 ext3_msg(sb, KERN_INFO, "[bs=%lu, gc=%lu, "
1298 "bpg=%lu, ipg=%lu, mo=%04lx]\n", 1314 "bpg=%lu, ipg=%lu, mo=%04lx]",
1299 sb->s_blocksize, 1315 sb->s_blocksize,
1300 sbi->s_groups_count, 1316 sbi->s_groups_count,
1301 EXT3_BLOCKS_PER_GROUP(sb), 1317 EXT3_BLOCKS_PER_GROUP(sb),
1302 EXT3_INODES_PER_GROUP(sb), 1318 EXT3_INODES_PER_GROUP(sb),
1303 sbi->s_mount_opt); 1319 sbi->s_mount_opt);
1304 1320
1305 printk(KERN_INFO "EXT3 FS on %s, ", sb->s_id);
1306 if (EXT3_SB(sb)->s_journal->j_inode == NULL) { 1321 if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
1307 char b[BDEVNAME_SIZE]; 1322 char b[BDEVNAME_SIZE];
1308 1323 ext3_msg(sb, KERN_INFO, "using external journal on %s",
1309 printk("external journal on %s\n",
1310 bdevname(EXT3_SB(sb)->s_journal->j_dev, b)); 1324 bdevname(EXT3_SB(sb)->s_journal->j_dev, b));
1311 } else { 1325 } else {
1312 printk("internal journal\n"); 1326 ext3_msg(sb, KERN_INFO, "using internal journal");
1313 } 1327 }
1314 return res; 1328 return res;
1315} 1329}
@@ -1403,8 +1417,8 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1403 } 1417 }
1404 1418
1405 if (bdev_read_only(sb->s_bdev)) { 1419 if (bdev_read_only(sb->s_bdev)) {
1406 printk(KERN_ERR "EXT3-fs: write access " 1420 ext3_msg(sb, KERN_ERR, "error: write access "
1407 "unavailable, skipping orphan cleanup.\n"); 1421 "unavailable, skipping orphan cleanup.");
1408 return; 1422 return;
1409 } 1423 }
1410 1424
@@ -1418,8 +1432,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1418 } 1432 }
1419 1433
1420 if (s_flags & MS_RDONLY) { 1434 if (s_flags & MS_RDONLY) {
1421 printk(KERN_INFO "EXT3-fs: %s: orphan cleanup on readonly fs\n", 1435 ext3_msg(sb, KERN_INFO, "orphan cleanup on readonly fs");
1422 sb->s_id);
1423 sb->s_flags &= ~MS_RDONLY; 1436 sb->s_flags &= ~MS_RDONLY;
1424 } 1437 }
1425#ifdef CONFIG_QUOTA 1438#ifdef CONFIG_QUOTA
@@ -1430,9 +1443,9 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1430 if (EXT3_SB(sb)->s_qf_names[i]) { 1443 if (EXT3_SB(sb)->s_qf_names[i]) {
1431 int ret = ext3_quota_on_mount(sb, i); 1444 int ret = ext3_quota_on_mount(sb, i);
1432 if (ret < 0) 1445 if (ret < 0)
1433 printk(KERN_ERR 1446 ext3_msg(sb, KERN_ERR,
1434 "EXT3-fs: Cannot turn on journaled " 1447 "error: cannot turn on journaled "
1435 "quota: error %d\n", ret); 1448 "quota: %d", ret);
1436 } 1449 }
1437 } 1450 }
1438#endif 1451#endif
@@ -1470,11 +1483,11 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1470#define PLURAL(x) (x), ((x)==1) ? "" : "s" 1483#define PLURAL(x) (x), ((x)==1) ? "" : "s"
1471 1484
1472 if (nr_orphans) 1485 if (nr_orphans)
1473 printk(KERN_INFO "EXT3-fs: %s: %d orphan inode%s deleted\n", 1486 ext3_msg(sb, KERN_INFO, "%d orphan inode%s deleted",
1474 sb->s_id, PLURAL(nr_orphans)); 1487 PLURAL(nr_orphans));
1475 if (nr_truncates) 1488 if (nr_truncates)
1476 printk(KERN_INFO "EXT3-fs: %s: %d truncate%s cleaned up\n", 1489 ext3_msg(sb, KERN_INFO, "%d truncate%s cleaned up",
1477 sb->s_id, PLURAL(nr_truncates)); 1490 PLURAL(nr_truncates));
1478#ifdef CONFIG_QUOTA 1491#ifdef CONFIG_QUOTA
1479 /* Turn quotas off */ 1492 /* Turn quotas off */
1480 for (i = 0; i < MAXQUOTAS; i++) { 1493 for (i = 0; i < MAXQUOTAS; i++) {
@@ -1558,7 +1571,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1558 struct ext3_super_block *es = NULL; 1571 struct ext3_super_block *es = NULL;
1559 struct ext3_sb_info *sbi; 1572 struct ext3_sb_info *sbi;
1560 ext3_fsblk_t block; 1573 ext3_fsblk_t block;
1561 ext3_fsblk_t sb_block = get_sb_block(&data); 1574 ext3_fsblk_t sb_block = get_sb_block(&data, sb);
1562 ext3_fsblk_t logic_sb_block; 1575 ext3_fsblk_t logic_sb_block;
1563 unsigned long offset = 0; 1576 unsigned long offset = 0;
1564 unsigned int journal_inum = 0; 1577 unsigned int journal_inum = 0;
@@ -1594,7 +1607,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1594 1607
1595 blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE); 1608 blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE);
1596 if (!blocksize) { 1609 if (!blocksize) {
1597 printk(KERN_ERR "EXT3-fs: unable to set blocksize\n"); 1610 ext3_msg(sb, KERN_ERR, "error: unable to set blocksize");
1598 goto out_fail; 1611 goto out_fail;
1599 } 1612 }
1600 1613
@@ -1610,7 +1623,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1610 } 1623 }
1611 1624
1612 if (!(bh = sb_bread(sb, logic_sb_block))) { 1625 if (!(bh = sb_bread(sb, logic_sb_block))) {
1613 printk (KERN_ERR "EXT3-fs: unable to read superblock\n"); 1626 ext3_msg(sb, KERN_ERR, "error: unable to read superblock");
1614 goto out_fail; 1627 goto out_fail;
1615 } 1628 }
1616 /* 1629 /*
@@ -1669,9 +1682,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1669 (EXT3_HAS_COMPAT_FEATURE(sb, ~0U) || 1682 (EXT3_HAS_COMPAT_FEATURE(sb, ~0U) ||
1670 EXT3_HAS_RO_COMPAT_FEATURE(sb, ~0U) || 1683 EXT3_HAS_RO_COMPAT_FEATURE(sb, ~0U) ||
1671 EXT3_HAS_INCOMPAT_FEATURE(sb, ~0U))) 1684 EXT3_HAS_INCOMPAT_FEATURE(sb, ~0U)))
1672 printk(KERN_WARNING 1685 ext3_msg(sb, KERN_WARNING,
1673 "EXT3-fs warning: feature flags set on rev 0 fs, " 1686 "warning: feature flags set on rev 0 fs, "
1674 "running e2fsck is recommended\n"); 1687 "running e2fsck is recommended");
1675 /* 1688 /*
1676 * Check feature flags regardless of the revision level, since we 1689 * Check feature flags regardless of the revision level, since we
1677 * previously didn't change the revision level when setting the flags, 1690 * previously didn't change the revision level when setting the flags,
@@ -1679,25 +1692,25 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1679 */ 1692 */
1680 features = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP); 1693 features = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP);
1681 if (features) { 1694 if (features) {
1682 printk(KERN_ERR "EXT3-fs: %s: couldn't mount because of " 1695 ext3_msg(sb, KERN_ERR,
1683 "unsupported optional features (%x).\n", 1696 "error: couldn't mount because of unsupported "
1684 sb->s_id, le32_to_cpu(features)); 1697 "optional features (%x)", le32_to_cpu(features));
1685 goto failed_mount; 1698 goto failed_mount;
1686 } 1699 }
1687 features = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP); 1700 features = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP);
1688 if (!(sb->s_flags & MS_RDONLY) && features) { 1701 if (!(sb->s_flags & MS_RDONLY) && features) {
1689 printk(KERN_ERR "EXT3-fs: %s: couldn't mount RDWR because of " 1702 ext3_msg(sb, KERN_ERR,
1690 "unsupported optional features (%x).\n", 1703 "error: couldn't mount RDWR because of unsupported "
1691 sb->s_id, le32_to_cpu(features)); 1704 "optional features (%x)", le32_to_cpu(features));
1692 goto failed_mount; 1705 goto failed_mount;
1693 } 1706 }
1694 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); 1707 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
1695 1708
1696 if (blocksize < EXT3_MIN_BLOCK_SIZE || 1709 if (blocksize < EXT3_MIN_BLOCK_SIZE ||
1697 blocksize > EXT3_MAX_BLOCK_SIZE) { 1710 blocksize > EXT3_MAX_BLOCK_SIZE) {
1698 printk(KERN_ERR 1711 ext3_msg(sb, KERN_ERR,
1699 "EXT3-fs: Unsupported filesystem blocksize %d on %s.\n", 1712 "error: couldn't mount because of unsupported "
1700 blocksize, sb->s_id); 1713 "filesystem blocksize %d", blocksize);
1701 goto failed_mount; 1714 goto failed_mount;
1702 } 1715 }
1703 1716
@@ -1708,30 +1721,31 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1708 * than the hardware sectorsize for the machine. 1721 * than the hardware sectorsize for the machine.
1709 */ 1722 */
1710 if (blocksize < hblock) { 1723 if (blocksize < hblock) {
1711 printk(KERN_ERR "EXT3-fs: blocksize %d too small for " 1724 ext3_msg(sb, KERN_ERR,
1712 "device blocksize %d.\n", blocksize, hblock); 1725 "error: fsblocksize %d too small for "
1726 "hardware sectorsize %d", blocksize, hblock);
1713 goto failed_mount; 1727 goto failed_mount;
1714 } 1728 }
1715 1729
1716 brelse (bh); 1730 brelse (bh);
1717 if (!sb_set_blocksize(sb, blocksize)) { 1731 if (!sb_set_blocksize(sb, blocksize)) {
1718 printk(KERN_ERR "EXT3-fs: bad blocksize %d.\n", 1732 ext3_msg(sb, KERN_ERR,
1719 blocksize); 1733 "error: bad blocksize %d", blocksize);
1720 goto out_fail; 1734 goto out_fail;
1721 } 1735 }
1722 logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize; 1736 logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize;
1723 offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize; 1737 offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize;
1724 bh = sb_bread(sb, logic_sb_block); 1738 bh = sb_bread(sb, logic_sb_block);
1725 if (!bh) { 1739 if (!bh) {
1726 printk(KERN_ERR 1740 ext3_msg(sb, KERN_ERR,
1727 "EXT3-fs: Can't read superblock on 2nd try.\n"); 1741 "error: can't read superblock on 2nd try");
1728 goto failed_mount; 1742 goto failed_mount;
1729 } 1743 }
1730 es = (struct ext3_super_block *)(((char *)bh->b_data) + offset); 1744 es = (struct ext3_super_block *)(((char *)bh->b_data) + offset);
1731 sbi->s_es = es; 1745 sbi->s_es = es;
1732 if (es->s_magic != cpu_to_le16(EXT3_SUPER_MAGIC)) { 1746 if (es->s_magic != cpu_to_le16(EXT3_SUPER_MAGIC)) {
1733 printk (KERN_ERR 1747 ext3_msg(sb, KERN_ERR,
1734 "EXT3-fs: Magic mismatch, very weird !\n"); 1748 "error: magic mismatch");
1735 goto failed_mount; 1749 goto failed_mount;
1736 } 1750 }
1737 } 1751 }
@@ -1747,8 +1761,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1747 if ((sbi->s_inode_size < EXT3_GOOD_OLD_INODE_SIZE) || 1761 if ((sbi->s_inode_size < EXT3_GOOD_OLD_INODE_SIZE) ||
1748 (!is_power_of_2(sbi->s_inode_size)) || 1762 (!is_power_of_2(sbi->s_inode_size)) ||
1749 (sbi->s_inode_size > blocksize)) { 1763 (sbi->s_inode_size > blocksize)) {
1750 printk (KERN_ERR 1764 ext3_msg(sb, KERN_ERR,
1751 "EXT3-fs: unsupported inode size: %d\n", 1765 "error: unsupported inode size: %d",
1752 sbi->s_inode_size); 1766 sbi->s_inode_size);
1753 goto failed_mount; 1767 goto failed_mount;
1754 } 1768 }
@@ -1756,8 +1770,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1756 sbi->s_frag_size = EXT3_MIN_FRAG_SIZE << 1770 sbi->s_frag_size = EXT3_MIN_FRAG_SIZE <<
1757 le32_to_cpu(es->s_log_frag_size); 1771 le32_to_cpu(es->s_log_frag_size);
1758 if (blocksize != sbi->s_frag_size) { 1772 if (blocksize != sbi->s_frag_size) {
1759 printk(KERN_ERR 1773 ext3_msg(sb, KERN_ERR,
1760 "EXT3-fs: fragsize %lu != blocksize %u (unsupported)\n", 1774 "error: fragsize %lu != blocksize %u (unsupported)",
1761 sbi->s_frag_size, blocksize); 1775 sbi->s_frag_size, blocksize);
1762 goto failed_mount; 1776 goto failed_mount;
1763 } 1777 }
@@ -1793,31 +1807,31 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1793 } 1807 }
1794 1808
1795 if (sbi->s_blocks_per_group > blocksize * 8) { 1809 if (sbi->s_blocks_per_group > blocksize * 8) {
1796 printk (KERN_ERR 1810 ext3_msg(sb, KERN_ERR,
1797 "EXT3-fs: #blocks per group too big: %lu\n", 1811 "#blocks per group too big: %lu",
1798 sbi->s_blocks_per_group); 1812 sbi->s_blocks_per_group);
1799 goto failed_mount; 1813 goto failed_mount;
1800 } 1814 }
1801 if (sbi->s_frags_per_group > blocksize * 8) { 1815 if (sbi->s_frags_per_group > blocksize * 8) {
1802 printk (KERN_ERR 1816 ext3_msg(sb, KERN_ERR,
1803 "EXT3-fs: #fragments per group too big: %lu\n", 1817 "error: #fragments per group too big: %lu",
1804 sbi->s_frags_per_group); 1818 sbi->s_frags_per_group);
1805 goto failed_mount; 1819 goto failed_mount;
1806 } 1820 }
1807 if (sbi->s_inodes_per_group > blocksize * 8) { 1821 if (sbi->s_inodes_per_group > blocksize * 8) {
1808 printk (KERN_ERR 1822 ext3_msg(sb, KERN_ERR,
1809 "EXT3-fs: #inodes per group too big: %lu\n", 1823 "error: #inodes per group too big: %lu",
1810 sbi->s_inodes_per_group); 1824 sbi->s_inodes_per_group);
1811 goto failed_mount; 1825 goto failed_mount;
1812 } 1826 }
1813 1827
1814 if (le32_to_cpu(es->s_blocks_count) > 1828 if (le32_to_cpu(es->s_blocks_count) >
1815 (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) { 1829 (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) {
1816 printk(KERN_ERR "EXT3-fs: filesystem on %s:" 1830 ext3_msg(sb, KERN_ERR,
1817 " too large to mount safely\n", sb->s_id); 1831 "error: filesystem is too large to mount safely");
1818 if (sizeof(sector_t) < 8) 1832 if (sizeof(sector_t) < 8)
1819 printk(KERN_WARNING "EXT3-fs: CONFIG_LBDAF not " 1833 ext3_msg(sb, KERN_ERR,
1820 "enabled\n"); 1834 "error: CONFIG_LBDAF not enabled");
1821 goto failed_mount; 1835 goto failed_mount;
1822 } 1836 }
1823 1837
@@ -1831,7 +1845,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1831 sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *), 1845 sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
1832 GFP_KERNEL); 1846 GFP_KERNEL);
1833 if (sbi->s_group_desc == NULL) { 1847 if (sbi->s_group_desc == NULL) {
1834 printk (KERN_ERR "EXT3-fs: not enough memory\n"); 1848 ext3_msg(sb, KERN_ERR,
1849 "error: not enough memory");
1835 goto failed_mount; 1850 goto failed_mount;
1836 } 1851 }
1837 1852
@@ -1841,14 +1856,15 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1841 block = descriptor_loc(sb, logic_sb_block, i); 1856 block = descriptor_loc(sb, logic_sb_block, i);
1842 sbi->s_group_desc[i] = sb_bread(sb, block); 1857 sbi->s_group_desc[i] = sb_bread(sb, block);
1843 if (!sbi->s_group_desc[i]) { 1858 if (!sbi->s_group_desc[i]) {
1844 printk (KERN_ERR "EXT3-fs: " 1859 ext3_msg(sb, KERN_ERR,
1845 "can't read group descriptor %d\n", i); 1860 "error: can't read group descriptor %d", i);
1846 db_count = i; 1861 db_count = i;
1847 goto failed_mount2; 1862 goto failed_mount2;
1848 } 1863 }
1849 } 1864 }
1850 if (!ext3_check_descriptors (sb)) { 1865 if (!ext3_check_descriptors (sb)) {
1851 printk(KERN_ERR "EXT3-fs: group descriptors corrupted!\n"); 1866 ext3_msg(sb, KERN_ERR,
1867 "error: group descriptors corrupted");
1852 goto failed_mount2; 1868 goto failed_mount2;
1853 } 1869 }
1854 sbi->s_gdb_count = db_count; 1870 sbi->s_gdb_count = db_count;
@@ -1866,7 +1882,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1866 ext3_count_dirs(sb)); 1882 ext3_count_dirs(sb));
1867 } 1883 }
1868 if (err) { 1884 if (err) {
1869 printk(KERN_ERR "EXT3-fs: insufficient memory\n"); 1885 ext3_msg(sb, KERN_ERR, "error: insufficient memory");
1870 goto failed_mount3; 1886 goto failed_mount3;
1871 } 1887 }
1872 1888
@@ -1914,9 +1930,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1914 goto failed_mount3; 1930 goto failed_mount3;
1915 } else { 1931 } else {
1916 if (!silent) 1932 if (!silent)
1917 printk (KERN_ERR 1933 ext3_msg(sb, KERN_ERR,
1918 "ext3: No journal on filesystem on %s\n", 1934 "error: no journal found. "
1919 sb->s_id); 1935 "mounting ext3 over ext2?");
1920 goto failed_mount3; 1936 goto failed_mount3;
1921 } 1937 }
1922 1938
@@ -1938,8 +1954,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1938 case EXT3_MOUNT_WRITEBACK_DATA: 1954 case EXT3_MOUNT_WRITEBACK_DATA:
1939 if (!journal_check_available_features 1955 if (!journal_check_available_features
1940 (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { 1956 (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) {
1941 printk(KERN_ERR "EXT3-fs: Journal does not support " 1957 ext3_msg(sb, KERN_ERR,
1942 "requested data journaling mode\n"); 1958 "error: journal does not support "
1959 "requested data journaling mode");
1943 goto failed_mount4; 1960 goto failed_mount4;
1944 } 1961 }
1945 default: 1962 default:
@@ -1948,8 +1965,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1948 1965
1949 if (test_opt(sb, NOBH)) { 1966 if (test_opt(sb, NOBH)) {
1950 if (!(test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)) { 1967 if (!(test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)) {
1951 printk(KERN_WARNING "EXT3-fs: Ignoring nobh option - " 1968 ext3_msg(sb, KERN_WARNING,
1952 "its supported only with writeback mode\n"); 1969 "warning: ignoring nobh option - "
1970 "it is supported only with writeback mode");
1953 clear_opt(sbi->s_mount_opt, NOBH); 1971 clear_opt(sbi->s_mount_opt, NOBH);
1954 } 1972 }
1955 } 1973 }
@@ -1960,18 +1978,18 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1960 1978
1961 root = ext3_iget(sb, EXT3_ROOT_INO); 1979 root = ext3_iget(sb, EXT3_ROOT_INO);
1962 if (IS_ERR(root)) { 1980 if (IS_ERR(root)) {
1963 printk(KERN_ERR "EXT3-fs: get root inode failed\n"); 1981 ext3_msg(sb, KERN_ERR, "error: get root inode failed");
1964 ret = PTR_ERR(root); 1982 ret = PTR_ERR(root);
1965 goto failed_mount4; 1983 goto failed_mount4;
1966 } 1984 }
1967 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 1985 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
1968 iput(root); 1986 iput(root);
1969 printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n"); 1987 ext3_msg(sb, KERN_ERR, "error: corrupt root inode, run e2fsck");
1970 goto failed_mount4; 1988 goto failed_mount4;
1971 } 1989 }
1972 sb->s_root = d_alloc_root(root); 1990 sb->s_root = d_alloc_root(root);
1973 if (!sb->s_root) { 1991 if (!sb->s_root) {
1974 printk(KERN_ERR "EXT3-fs: get root dentry failed\n"); 1992 ext3_msg(sb, KERN_ERR, "error: get root dentry failed");
1975 iput(root); 1993 iput(root);
1976 ret = -ENOMEM; 1994 ret = -ENOMEM;
1977 goto failed_mount4; 1995 goto failed_mount4;
@@ -1990,9 +2008,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1990 ext3_orphan_cleanup(sb, es); 2008 ext3_orphan_cleanup(sb, es);
1991 EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS; 2009 EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS;
1992 if (needs_recovery) 2010 if (needs_recovery)
1993 printk (KERN_INFO "EXT3-fs: recovery complete.\n"); 2011 ext3_msg(sb, KERN_INFO, "recovery complete");
1994 ext3_mark_recovery_complete(sb, es); 2012 ext3_mark_recovery_complete(sb, es);
1995 printk (KERN_INFO "EXT3-fs: mounted filesystem with %s data mode.\n", 2013 ext3_msg(sb, KERN_INFO, "mounted filesystem with %s data mode",
1996 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA ? "journal": 2014 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA ? "journal":
1997 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": 2015 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered":
1998 "writeback"); 2016 "writeback");
@@ -2002,7 +2020,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
2002 2020
2003cantfind_ext3: 2021cantfind_ext3:
2004 if (!silent) 2022 if (!silent)
2005 printk(KERN_ERR "VFS: Can't find ext3 filesystem on dev %s.\n", 2023 ext3_msg(sb, KERN_INFO,
2024 "error: can't find ext3 filesystem on dev %s.",
2006 sb->s_id); 2025 sb->s_id);
2007 goto failed_mount; 2026 goto failed_mount;
2008 2027
@@ -2070,27 +2089,27 @@ static journal_t *ext3_get_journal(struct super_block *sb,
2070 2089
2071 journal_inode = ext3_iget(sb, journal_inum); 2090 journal_inode = ext3_iget(sb, journal_inum);
2072 if (IS_ERR(journal_inode)) { 2091 if (IS_ERR(journal_inode)) {
2073 printk(KERN_ERR "EXT3-fs: no journal found.\n"); 2092 ext3_msg(sb, KERN_ERR, "error: no journal found");
2074 return NULL; 2093 return NULL;
2075 } 2094 }
2076 if (!journal_inode->i_nlink) { 2095 if (!journal_inode->i_nlink) {
2077 make_bad_inode(journal_inode); 2096 make_bad_inode(journal_inode);
2078 iput(journal_inode); 2097 iput(journal_inode);
2079 printk(KERN_ERR "EXT3-fs: journal inode is deleted.\n"); 2098 ext3_msg(sb, KERN_ERR, "error: journal inode is deleted");
2080 return NULL; 2099 return NULL;
2081 } 2100 }
2082 2101
2083 jbd_debug(2, "Journal inode found at %p: %Ld bytes\n", 2102 jbd_debug(2, "Journal inode found at %p: %Ld bytes\n",
2084 journal_inode, journal_inode->i_size); 2103 journal_inode, journal_inode->i_size);
2085 if (!S_ISREG(journal_inode->i_mode)) { 2104 if (!S_ISREG(journal_inode->i_mode)) {
2086 printk(KERN_ERR "EXT3-fs: invalid journal inode.\n"); 2105 ext3_msg(sb, KERN_ERR, "error: invalid journal inode");
2087 iput(journal_inode); 2106 iput(journal_inode);
2088 return NULL; 2107 return NULL;
2089 } 2108 }
2090 2109
2091 journal = journal_init_inode(journal_inode); 2110 journal = journal_init_inode(journal_inode);
2092 if (!journal) { 2111 if (!journal) {
2093 printk(KERN_ERR "EXT3-fs: Could not load journal inode\n"); 2112 ext3_msg(sb, KERN_ERR, "error: could not load journal inode");
2094 iput(journal_inode); 2113 iput(journal_inode);
2095 return NULL; 2114 return NULL;
2096 } 2115 }
@@ -2112,13 +2131,13 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2112 struct ext3_super_block * es; 2131 struct ext3_super_block * es;
2113 struct block_device *bdev; 2132 struct block_device *bdev;
2114 2133
2115 bdev = ext3_blkdev_get(j_dev); 2134 bdev = ext3_blkdev_get(j_dev, sb);
2116 if (bdev == NULL) 2135 if (bdev == NULL)
2117 return NULL; 2136 return NULL;
2118 2137
2119 if (bd_claim(bdev, sb)) { 2138 if (bd_claim(bdev, sb)) {
2120 printk(KERN_ERR 2139 ext3_msg(sb, KERN_ERR,
2121 "EXT3: failed to claim external journal device.\n"); 2140 "error: failed to claim external journal device");
2122 blkdev_put(bdev, FMODE_READ|FMODE_WRITE); 2141 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
2123 return NULL; 2142 return NULL;
2124 } 2143 }
@@ -2126,8 +2145,8 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2126 blocksize = sb->s_blocksize; 2145 blocksize = sb->s_blocksize;
2127 hblock = bdev_logical_block_size(bdev); 2146 hblock = bdev_logical_block_size(bdev);
2128 if (blocksize < hblock) { 2147 if (blocksize < hblock) {
2129 printk(KERN_ERR 2148 ext3_msg(sb, KERN_ERR,
2130 "EXT3-fs: blocksize too small for journal device.\n"); 2149 "error: blocksize too small for journal device");
2131 goto out_bdev; 2150 goto out_bdev;
2132 } 2151 }
2133 2152
@@ -2135,8 +2154,8 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2135 offset = EXT3_MIN_BLOCK_SIZE % blocksize; 2154 offset = EXT3_MIN_BLOCK_SIZE % blocksize;
2136 set_blocksize(bdev, blocksize); 2155 set_blocksize(bdev, blocksize);
2137 if (!(bh = __bread(bdev, sb_block, blocksize))) { 2156 if (!(bh = __bread(bdev, sb_block, blocksize))) {
2138 printk(KERN_ERR "EXT3-fs: couldn't read superblock of " 2157 ext3_msg(sb, KERN_ERR, "error: couldn't read superblock of "
2139 "external journal\n"); 2158 "external journal");
2140 goto out_bdev; 2159 goto out_bdev;
2141 } 2160 }
2142 2161
@@ -2144,14 +2163,14 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2144 if ((le16_to_cpu(es->s_magic) != EXT3_SUPER_MAGIC) || 2163 if ((le16_to_cpu(es->s_magic) != EXT3_SUPER_MAGIC) ||
2145 !(le32_to_cpu(es->s_feature_incompat) & 2164 !(le32_to_cpu(es->s_feature_incompat) &
2146 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) { 2165 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) {
2147 printk(KERN_ERR "EXT3-fs: external journal has " 2166 ext3_msg(sb, KERN_ERR, "error: external journal has "
2148 "bad superblock\n"); 2167 "bad superblock");
2149 brelse(bh); 2168 brelse(bh);
2150 goto out_bdev; 2169 goto out_bdev;
2151 } 2170 }
2152 2171
2153 if (memcmp(EXT3_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) { 2172 if (memcmp(EXT3_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) {
2154 printk(KERN_ERR "EXT3-fs: journal UUID does not match\n"); 2173 ext3_msg(sb, KERN_ERR, "error: journal UUID does not match");
2155 brelse(bh); 2174 brelse(bh);
2156 goto out_bdev; 2175 goto out_bdev;
2157 } 2176 }
@@ -2163,19 +2182,21 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2163 journal = journal_init_dev(bdev, sb->s_bdev, 2182 journal = journal_init_dev(bdev, sb->s_bdev,
2164 start, len, blocksize); 2183 start, len, blocksize);
2165 if (!journal) { 2184 if (!journal) {
2166 printk(KERN_ERR "EXT3-fs: failed to create device journal\n"); 2185 ext3_msg(sb, KERN_ERR,
2186 "error: failed to create device journal");
2167 goto out_bdev; 2187 goto out_bdev;
2168 } 2188 }
2169 journal->j_private = sb; 2189 journal->j_private = sb;
2170 ll_rw_block(READ, 1, &journal->j_sb_buffer); 2190 ll_rw_block(READ, 1, &journal->j_sb_buffer);
2171 wait_on_buffer(journal->j_sb_buffer); 2191 wait_on_buffer(journal->j_sb_buffer);
2172 if (!buffer_uptodate(journal->j_sb_buffer)) { 2192 if (!buffer_uptodate(journal->j_sb_buffer)) {
2173 printk(KERN_ERR "EXT3-fs: I/O error on journal device\n"); 2193 ext3_msg(sb, KERN_ERR, "I/O error on journal device");
2174 goto out_journal; 2194 goto out_journal;
2175 } 2195 }
2176 if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { 2196 if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
2177 printk(KERN_ERR "EXT3-fs: External journal has more than one " 2197 ext3_msg(sb, KERN_ERR,
2178 "user (unsupported) - %d\n", 2198 "error: external journal has more than one "
2199 "user (unsupported) - %d",
2179 be32_to_cpu(journal->j_superblock->s_nr_users)); 2200 be32_to_cpu(journal->j_superblock->s_nr_users));
2180 goto out_journal; 2201 goto out_journal;
2181 } 2202 }
@@ -2201,8 +2222,8 @@ static int ext3_load_journal(struct super_block *sb,
2201 2222
2202 if (journal_devnum && 2223 if (journal_devnum &&
2203 journal_devnum != le32_to_cpu(es->s_journal_dev)) { 2224 journal_devnum != le32_to_cpu(es->s_journal_dev)) {
2204 printk(KERN_INFO "EXT3-fs: external journal device major/minor " 2225 ext3_msg(sb, KERN_INFO, "external journal device major/minor "
2205 "numbers have changed\n"); 2226 "numbers have changed");
2206 journal_dev = new_decode_dev(journal_devnum); 2227 journal_dev = new_decode_dev(journal_devnum);
2207 } else 2228 } else
2208 journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev)); 2229 journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev));
@@ -2217,21 +2238,21 @@ static int ext3_load_journal(struct super_block *sb,
2217 2238
2218 if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)) { 2239 if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)) {
2219 if (sb->s_flags & MS_RDONLY) { 2240 if (sb->s_flags & MS_RDONLY) {
2220 printk(KERN_INFO "EXT3-fs: INFO: recovery " 2241 ext3_msg(sb, KERN_INFO,
2221 "required on readonly filesystem.\n"); 2242 "recovery required on readonly filesystem");
2222 if (really_read_only) { 2243 if (really_read_only) {
2223 printk(KERN_ERR "EXT3-fs: write access " 2244 ext3_msg(sb, KERN_ERR, "error: write access "
2224 "unavailable, cannot proceed.\n"); 2245 "unavailable, cannot proceed");
2225 return -EROFS; 2246 return -EROFS;
2226 } 2247 }
2227 printk (KERN_INFO "EXT3-fs: write access will " 2248 ext3_msg(sb, KERN_INFO,
2228 "be enabled during recovery.\n"); 2249 "write access will be enabled during recovery");
2229 } 2250 }
2230 } 2251 }
2231 2252
2232 if (journal_inum && journal_dev) { 2253 if (journal_inum && journal_dev) {
2233 printk(KERN_ERR "EXT3-fs: filesystem has both journal " 2254 ext3_msg(sb, KERN_ERR, "error: filesystem has both journal "
2234 "and inode journals!\n"); 2255 "and inode journals");
2235 return -EINVAL; 2256 return -EINVAL;
2236 } 2257 }
2237 2258
@@ -2246,7 +2267,7 @@ static int ext3_load_journal(struct super_block *sb,
2246 if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) { 2267 if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) {
2247 err = journal_update_format(journal); 2268 err = journal_update_format(journal);
2248 if (err) { 2269 if (err) {
2249 printk(KERN_ERR "EXT3-fs: error updating journal.\n"); 2270 ext3_msg(sb, KERN_ERR, "error updating journal");
2250 journal_destroy(journal); 2271 journal_destroy(journal);
2251 return err; 2272 return err;
2252 } 2273 }
@@ -2258,7 +2279,7 @@ static int ext3_load_journal(struct super_block *sb,
2258 err = journal_load(journal); 2279 err = journal_load(journal);
2259 2280
2260 if (err) { 2281 if (err) {
2261 printk(KERN_ERR "EXT3-fs: error loading journal.\n"); 2282 ext3_msg(sb, KERN_ERR, "error loading journal");
2262 journal_destroy(journal); 2283 journal_destroy(journal);
2263 return err; 2284 return err;
2264 } 2285 }
@@ -2277,16 +2298,17 @@ static int ext3_load_journal(struct super_block *sb,
2277 return 0; 2298 return 0;
2278} 2299}
2279 2300
2280static int ext3_create_journal(struct super_block * sb, 2301static int ext3_create_journal(struct super_block *sb,
2281 struct ext3_super_block * es, 2302 struct ext3_super_block *es,
2282 unsigned int journal_inum) 2303 unsigned int journal_inum)
2283{ 2304{
2284 journal_t *journal; 2305 journal_t *journal;
2285 int err; 2306 int err;
2286 2307
2287 if (sb->s_flags & MS_RDONLY) { 2308 if (sb->s_flags & MS_RDONLY) {
2288 printk(KERN_ERR "EXT3-fs: readonly filesystem when trying to " 2309 ext3_msg(sb, KERN_ERR,
2289 "create journal.\n"); 2310 "error: readonly filesystem when trying to "
2311 "create journal");
2290 return -EROFS; 2312 return -EROFS;
2291 } 2313 }
2292 2314
@@ -2294,12 +2316,12 @@ static int ext3_create_journal(struct super_block * sb,
2294 if (!journal) 2316 if (!journal)
2295 return -EINVAL; 2317 return -EINVAL;
2296 2318
2297 printk(KERN_INFO "EXT3-fs: creating new journal on inode %u\n", 2319 ext3_msg(sb, KERN_INFO, "creating new journal on inode %u",
2298 journal_inum); 2320 journal_inum);
2299 2321
2300 err = journal_create(journal); 2322 err = journal_create(journal);
2301 if (err) { 2323 if (err) {
2302 printk(KERN_ERR "EXT3-fs: error creating journal.\n"); 2324 ext3_msg(sb, KERN_ERR, "error creating journal");
2303 journal_destroy(journal); 2325 journal_destroy(journal);
2304 return -EIO; 2326 return -EIO;
2305 } 2327 }
@@ -2380,8 +2402,8 @@ out:
2380 * has recorded an error from a previous lifetime, move that error to the 2402 * has recorded an error from a previous lifetime, move that error to the
2381 * main filesystem now. 2403 * main filesystem now.
2382 */ 2404 */
2383static void ext3_clear_journal_err(struct super_block * sb, 2405static void ext3_clear_journal_err(struct super_block *sb,
2384 struct ext3_super_block * es) 2406 struct ext3_super_block *es)
2385{ 2407{
2386 journal_t *journal; 2408 journal_t *journal;
2387 int j_errno; 2409 int j_errno;
@@ -2572,10 +2594,10 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2572 __le32 ret; 2594 __le32 ret;
2573 if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb, 2595 if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb,
2574 ~EXT3_FEATURE_RO_COMPAT_SUPP))) { 2596 ~EXT3_FEATURE_RO_COMPAT_SUPP))) {
2575 printk(KERN_WARNING "EXT3-fs: %s: couldn't " 2597 ext3_msg(sb, KERN_WARNING,
2576 "remount RDWR because of unsupported " 2598 "warning: couldn't remount RDWR "
2577 "optional features (%x).\n", 2599 "because of unsupported optional "
2578 sb->s_id, le32_to_cpu(ret)); 2600 "features (%x)", le32_to_cpu(ret));
2579 err = -EROFS; 2601 err = -EROFS;
2580 goto restore_opts; 2602 goto restore_opts;
2581 } 2603 }
@@ -2586,11 +2608,10 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2586 * require a full umount/remount for now. 2608 * require a full umount/remount for now.
2587 */ 2609 */
2588 if (es->s_last_orphan) { 2610 if (es->s_last_orphan) {
2589 printk(KERN_WARNING "EXT3-fs: %s: couldn't " 2611 ext3_msg(sb, KERN_WARNING, "warning: couldn't "
2590 "remount RDWR because of unprocessed " 2612 "remount RDWR because of unprocessed "
2591 "orphan inode list. Please " 2613 "orphan inode list. Please "
2592 "umount/remount instead.\n", 2614 "umount/remount instead.");
2593 sb->s_id);
2594 err = -EINVAL; 2615 err = -EINVAL;
2595 goto restore_opts; 2616 goto restore_opts;
2596 } 2617 }
@@ -2839,9 +2860,9 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2839 if (EXT3_SB(sb)->s_qf_names[type]) { 2860 if (EXT3_SB(sb)->s_qf_names[type]) {
2840 /* Quotafile not of fs root? */ 2861 /* Quotafile not of fs root? */
2841 if (path.dentry->d_parent != sb->s_root) 2862 if (path.dentry->d_parent != sb->s_root)
2842 printk(KERN_WARNING 2863 ext3_msg(sb, KERN_WARNING,
2843 "EXT3-fs: Quota file not on filesystem root. " 2864 "warning: Quota file not on filesystem root. "
2844 "Journaled quota will not work.\n"); 2865 "Journaled quota will not work.");
2845 } 2866 }
2846 2867
2847 /* 2868 /*
@@ -2923,8 +2944,9 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
2923 handle_t *handle = journal_current_handle(); 2944 handle_t *handle = journal_current_handle();
2924 2945
2925 if (!handle) { 2946 if (!handle) {
2926 printk(KERN_WARNING "EXT3-fs: Quota write (off=%Lu, len=%Lu)" 2947 ext3_msg(sb, KERN_WARNING,
2927 " cancelled because transaction is not started.\n", 2948 "warning: quota write (off=%llu, len=%llu)"
2949 " cancelled because transaction is not started.",
2928 (unsigned long long)off, (unsigned long long)len); 2950 (unsigned long long)off, (unsigned long long)len);
2929 return -EIO; 2951 return -EIO;
2930 } 2952 }