aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext3/super.c')
-rw-r--r--fs/ext3/super.c489
1 files changed, 260 insertions, 229 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 7a520a862f49..afa2b569da10 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,
@@ -466,6 +478,8 @@ static struct inode *ext3_alloc_inode(struct super_block *sb)
466 return NULL; 478 return NULL;
467 ei->i_block_alloc_info = NULL; 479 ei->i_block_alloc_info = NULL;
468 ei->vfs_inode.i_version = 1; 480 ei->vfs_inode.i_version = 1;
481 atomic_set(&ei->i_datasync_tid, 0);
482 atomic_set(&ei->i_sync_tid, 0);
469 return &ei->vfs_inode; 483 return &ei->vfs_inode;
470} 484}
471 485
@@ -525,9 +539,22 @@ static inline void ext3_show_quota_options(struct seq_file *seq, struct super_bl
525#if defined(CONFIG_QUOTA) 539#if defined(CONFIG_QUOTA)
526 struct ext3_sb_info *sbi = EXT3_SB(sb); 540 struct ext3_sb_info *sbi = EXT3_SB(sb);
527 541
528 if (sbi->s_jquota_fmt) 542 if (sbi->s_jquota_fmt) {
529 seq_printf(seq, ",jqfmt=%s", 543 char *fmtname = "";
530 (sbi->s_jquota_fmt == QFMT_VFS_OLD) ? "vfsold": "vfsv0"); 544
545 switch (sbi->s_jquota_fmt) {
546 case QFMT_VFS_OLD:
547 fmtname = "vfsold";
548 break;
549 case QFMT_VFS_V0:
550 fmtname = "vfsv0";
551 break;
552 case QFMT_VFS_V1:
553 fmtname = "vfsv1";
554 break;
555 }
556 seq_printf(seq, ",jqfmt=%s", fmtname);
557 }
531 558
532 if (sbi->s_qf_names[USRQUOTA]) 559 if (sbi->s_qf_names[USRQUOTA])
533 seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]); 560 seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]);
@@ -634,6 +661,9 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs)
634 if (test_opt(sb, DATA_ERR_ABORT)) 661 if (test_opt(sb, DATA_ERR_ABORT))
635 seq_puts(seq, ",data_err=abort"); 662 seq_puts(seq, ",data_err=abort");
636 663
664 if (test_opt(sb, NOLOAD))
665 seq_puts(seq, ",norecovery");
666
637 ext3_show_quota_options(seq, sb); 667 ext3_show_quota_options(seq, sb);
638 668
639 return 0; 669 return 0;
@@ -785,9 +815,9 @@ enum {
785 Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, 815 Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
786 Opt_data_err_abort, Opt_data_err_ignore, 816 Opt_data_err_abort, Opt_data_err_ignore,
787 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, 817 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
788 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota, 818 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
789 Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota, 819 Opt_noquota, Opt_ignore, Opt_barrier, Opt_err, Opt_resize,
790 Opt_grpquota 820 Opt_usrquota, Opt_grpquota
791}; 821};
792 822
793static const match_table_t tokens = { 823static const match_table_t tokens = {
@@ -816,6 +846,7 @@ static const match_table_t tokens = {
816 {Opt_reservation, "reservation"}, 846 {Opt_reservation, "reservation"},
817 {Opt_noreservation, "noreservation"}, 847 {Opt_noreservation, "noreservation"},
818 {Opt_noload, "noload"}, 848 {Opt_noload, "noload"},
849 {Opt_noload, "norecovery"},
819 {Opt_nobh, "nobh"}, 850 {Opt_nobh, "nobh"},
820 {Opt_bh, "bh"}, 851 {Opt_bh, "bh"},
821 {Opt_commit, "commit=%u"}, 852 {Opt_commit, "commit=%u"},
@@ -834,6 +865,7 @@ static const match_table_t tokens = {
834 {Opt_grpjquota, "grpjquota=%s"}, 865 {Opt_grpjquota, "grpjquota=%s"},
835 {Opt_jqfmt_vfsold, "jqfmt=vfsold"}, 866 {Opt_jqfmt_vfsold, "jqfmt=vfsold"},
836 {Opt_jqfmt_vfsv0, "jqfmt=vfsv0"}, 867 {Opt_jqfmt_vfsv0, "jqfmt=vfsv0"},
868 {Opt_jqfmt_vfsv1, "jqfmt=vfsv1"},
837 {Opt_grpquota, "grpquota"}, 869 {Opt_grpquota, "grpquota"},
838 {Opt_noquota, "noquota"}, 870 {Opt_noquota, "noquota"},
839 {Opt_quota, "quota"}, 871 {Opt_quota, "quota"},
@@ -843,7 +875,7 @@ static const match_table_t tokens = {
843 {Opt_err, NULL}, 875 {Opt_err, NULL},
844}; 876};
845 877
846static ext3_fsblk_t get_sb_block(void **data) 878static ext3_fsblk_t get_sb_block(void **data, struct super_block *sb)
847{ 879{
848 ext3_fsblk_t sb_block; 880 ext3_fsblk_t sb_block;
849 char *options = (char *) *data; 881 char *options = (char *) *data;
@@ -854,7 +886,7 @@ static ext3_fsblk_t get_sb_block(void **data)
854 /*todo: use simple_strtoll with >32bit ext3 */ 886 /*todo: use simple_strtoll with >32bit ext3 */
855 sb_block = simple_strtoul(options, &options, 0); 887 sb_block = simple_strtoul(options, &options, 0);
856 if (*options && *options != ',') { 888 if (*options && *options != ',') {
857 printk("EXT3-fs: Invalid sb specification: %s\n", 889 ext3_msg(sb, "error: invalid sb specification: %s",
858 (char *) *data); 890 (char *) *data);
859 return 1; 891 return 1;
860 } 892 }
@@ -954,7 +986,8 @@ static int parse_options (char *options, struct super_block *sb,
954#else 986#else
955 case Opt_user_xattr: 987 case Opt_user_xattr:
956 case Opt_nouser_xattr: 988 case Opt_nouser_xattr:
957 printk("EXT3 (no)user_xattr options not supported\n"); 989 ext3_msg(sb, KERN_INFO,
990 "(no)user_xattr options not supported");
958 break; 991 break;
959#endif 992#endif
960#ifdef CONFIG_EXT3_FS_POSIX_ACL 993#ifdef CONFIG_EXT3_FS_POSIX_ACL
@@ -967,7 +1000,8 @@ static int parse_options (char *options, struct super_block *sb,
967#else 1000#else
968 case Opt_acl: 1001 case Opt_acl:
969 case Opt_noacl: 1002 case Opt_noacl:
970 printk("EXT3 (no)acl options not supported\n"); 1003 ext3_msg(sb, KERN_INFO,
1004 "(no)acl options not supported");
971 break; 1005 break;
972#endif 1006#endif
973 case Opt_reservation: 1007 case Opt_reservation:
@@ -983,16 +1017,16 @@ static int parse_options (char *options, struct super_block *sb,
983 user to specify an existing inode to be the 1017 user to specify an existing inode to be the
984 journal file. */ 1018 journal file. */
985 if (is_remount) { 1019 if (is_remount) {
986 printk(KERN_ERR "EXT3-fs: cannot specify " 1020 ext3_msg(sb, KERN_ERR, "error: cannot specify "
987 "journal on remount\n"); 1021 "journal on remount");
988 return 0; 1022 return 0;
989 } 1023 }
990 set_opt (sbi->s_mount_opt, UPDATE_JOURNAL); 1024 set_opt (sbi->s_mount_opt, UPDATE_JOURNAL);
991 break; 1025 break;
992 case Opt_journal_inum: 1026 case Opt_journal_inum:
993 if (is_remount) { 1027 if (is_remount) {
994 printk(KERN_ERR "EXT3-fs: cannot specify " 1028 ext3_msg(sb, KERN_ERR, "error: cannot specify "
995 "journal on remount\n"); 1029 "journal on remount");
996 return 0; 1030 return 0;
997 } 1031 }
998 if (match_int(&args[0], &option)) 1032 if (match_int(&args[0], &option))
@@ -1001,8 +1035,8 @@ static int parse_options (char *options, struct super_block *sb,
1001 break; 1035 break;
1002 case Opt_journal_dev: 1036 case Opt_journal_dev:
1003 if (is_remount) { 1037 if (is_remount) {
1004 printk(KERN_ERR "EXT3-fs: cannot specify " 1038 ext3_msg(sb, KERN_ERR, "error: cannot specify "
1005 "journal on remount\n"); 1039 "journal on remount");
1006 return 0; 1040 return 0;
1007 } 1041 }
1008 if (match_int(&args[0], &option)) 1042 if (match_int(&args[0], &option))
@@ -1034,12 +1068,11 @@ static int parse_options (char *options, struct super_block *sb,
1034 if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS) 1068 if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS)
1035 == data_opt) 1069 == data_opt)
1036 break; 1070 break;
1037 printk(KERN_ERR 1071 ext3_msg(sb, KERN_ERR,
1038 "EXT3-fs (device %s): Cannot change " 1072 "error: cannot change "
1039 "data mode on remount. The filesystem " 1073 "data mode on remount. The filesystem "
1040 "is mounted in data=%s mode and you " 1074 "is mounted in data=%s mode and you "
1041 "try to remount it in data=%s mode.\n", 1075 "try to remount it in data=%s mode.",
1042 sb->s_id,
1043 data_mode_string(sbi->s_mount_opt & 1076 data_mode_string(sbi->s_mount_opt &
1044 EXT3_MOUNT_DATA_FLAGS), 1077 EXT3_MOUNT_DATA_FLAGS),
1045 data_mode_string(data_opt)); 1078 data_mode_string(data_opt));
@@ -1064,31 +1097,31 @@ static int parse_options (char *options, struct super_block *sb,
1064set_qf_name: 1097set_qf_name:
1065 if (sb_any_quota_loaded(sb) && 1098 if (sb_any_quota_loaded(sb) &&
1066 !sbi->s_qf_names[qtype]) { 1099 !sbi->s_qf_names[qtype]) {
1067 printk(KERN_ERR 1100 ext3_msg(sb, KERN_ERR,
1068 "EXT3-fs: Cannot change journaled " 1101 "error: cannot change journaled "
1069 "quota options when quota turned on.\n"); 1102 "quota options when quota turned on.");
1070 return 0; 1103 return 0;
1071 } 1104 }
1072 qname = match_strdup(&args[0]); 1105 qname = match_strdup(&args[0]);
1073 if (!qname) { 1106 if (!qname) {
1074 printk(KERN_ERR 1107 ext3_msg(sb, KERN_ERR,
1075 "EXT3-fs: not enough memory for " 1108 "error: not enough memory for "
1076 "storing quotafile name.\n"); 1109 "storing quotafile name.");
1077 return 0; 1110 return 0;
1078 } 1111 }
1079 if (sbi->s_qf_names[qtype] && 1112 if (sbi->s_qf_names[qtype] &&
1080 strcmp(sbi->s_qf_names[qtype], qname)) { 1113 strcmp(sbi->s_qf_names[qtype], qname)) {
1081 printk(KERN_ERR 1114 ext3_msg(sb, KERN_ERR,
1082 "EXT3-fs: %s quota file already " 1115 "error: %s quota file already "
1083 "specified.\n", QTYPE2NAME(qtype)); 1116 "specified.", QTYPE2NAME(qtype));
1084 kfree(qname); 1117 kfree(qname);
1085 return 0; 1118 return 0;
1086 } 1119 }
1087 sbi->s_qf_names[qtype] = qname; 1120 sbi->s_qf_names[qtype] = qname;
1088 if (strchr(sbi->s_qf_names[qtype], '/')) { 1121 if (strchr(sbi->s_qf_names[qtype], '/')) {
1089 printk(KERN_ERR 1122 ext3_msg(sb, KERN_ERR,
1090 "EXT3-fs: quotafile must be on " 1123 "error: quotafile must be on "
1091 "filesystem root.\n"); 1124 "filesystem root.");
1092 kfree(sbi->s_qf_names[qtype]); 1125 kfree(sbi->s_qf_names[qtype]);
1093 sbi->s_qf_names[qtype] = NULL; 1126 sbi->s_qf_names[qtype] = NULL;
1094 return 0; 1127 return 0;
@@ -1103,9 +1136,9 @@ set_qf_name:
1103clear_qf_name: 1136clear_qf_name:
1104 if (sb_any_quota_loaded(sb) && 1137 if (sb_any_quota_loaded(sb) &&
1105 sbi->s_qf_names[qtype]) { 1138 sbi->s_qf_names[qtype]) {
1106 printk(KERN_ERR "EXT3-fs: Cannot change " 1139 ext3_msg(sb, KERN_ERR, "error: cannot change "
1107 "journaled quota options when " 1140 "journaled quota options when "
1108 "quota turned on.\n"); 1141 "quota turned on.");
1109 return 0; 1142 return 0;
1110 } 1143 }
1111 /* 1144 /*
@@ -1119,12 +1152,15 @@ clear_qf_name:
1119 goto set_qf_format; 1152 goto set_qf_format;
1120 case Opt_jqfmt_vfsv0: 1153 case Opt_jqfmt_vfsv0:
1121 qfmt = QFMT_VFS_V0; 1154 qfmt = QFMT_VFS_V0;
1155 goto set_qf_format;
1156 case Opt_jqfmt_vfsv1:
1157 qfmt = QFMT_VFS_V1;
1122set_qf_format: 1158set_qf_format:
1123 if (sb_any_quota_loaded(sb) && 1159 if (sb_any_quota_loaded(sb) &&
1124 sbi->s_jquota_fmt != qfmt) { 1160 sbi->s_jquota_fmt != qfmt) {
1125 printk(KERN_ERR "EXT3-fs: Cannot change " 1161 ext3_msg(sb, KERN_ERR, "error: cannot change "
1126 "journaled quota options when " 1162 "journaled quota options when "
1127 "quota turned on.\n"); 1163 "quota turned on.");
1128 return 0; 1164 return 0;
1129 } 1165 }
1130 sbi->s_jquota_fmt = qfmt; 1166 sbi->s_jquota_fmt = qfmt;
@@ -1140,8 +1176,8 @@ set_qf_format:
1140 break; 1176 break;
1141 case Opt_noquota: 1177 case Opt_noquota:
1142 if (sb_any_quota_loaded(sb)) { 1178 if (sb_any_quota_loaded(sb)) {
1143 printk(KERN_ERR "EXT3-fs: Cannot change quota " 1179 ext3_msg(sb, KERN_ERR, "error: cannot change "
1144 "options when quota turned on.\n"); 1180 "quota options when quota turned on.");
1145 return 0; 1181 return 0;
1146 } 1182 }
1147 clear_opt(sbi->s_mount_opt, QUOTA); 1183 clear_opt(sbi->s_mount_opt, QUOTA);
@@ -1152,8 +1188,8 @@ set_qf_format:
1152 case Opt_quota: 1188 case Opt_quota:
1153 case Opt_usrquota: 1189 case Opt_usrquota:
1154 case Opt_grpquota: 1190 case Opt_grpquota:
1155 printk(KERN_ERR 1191 ext3_msg(sb, KERN_ERR,
1156 "EXT3-fs: quota options not supported.\n"); 1192 "error: quota options not supported.");
1157 break; 1193 break;
1158 case Opt_usrjquota: 1194 case Opt_usrjquota:
1159 case Opt_grpjquota: 1195 case Opt_grpjquota:
@@ -1161,9 +1197,10 @@ set_qf_format:
1161 case Opt_offgrpjquota: 1197 case Opt_offgrpjquota:
1162 case Opt_jqfmt_vfsold: 1198 case Opt_jqfmt_vfsold:
1163 case Opt_jqfmt_vfsv0: 1199 case Opt_jqfmt_vfsv0:
1164 printk(KERN_ERR 1200 case Opt_jqfmt_vfsv1:
1165 "EXT3-fs: journaled quota options not " 1201 ext3_msg(sb, KERN_ERR,
1166 "supported.\n"); 1202 "error: journaled quota options not "
1203 "supported.");
1167 break; 1204 break;
1168 case Opt_noquota: 1205 case Opt_noquota:
1169 break; 1206 break;
@@ -1183,8 +1220,9 @@ set_qf_format:
1183 break; 1220 break;
1184 case Opt_resize: 1221 case Opt_resize:
1185 if (!is_remount) { 1222 if (!is_remount) {
1186 printk("EXT3-fs: resize option only available " 1223 ext3_msg(sb, KERN_ERR,
1187 "for remount\n"); 1224 "error: resize option only available "
1225 "for remount");
1188 return 0; 1226 return 0;
1189 } 1227 }
1190 if (match_int(&args[0], &option) != 0) 1228 if (match_int(&args[0], &option) != 0)
@@ -1198,9 +1236,9 @@ set_qf_format:
1198 clear_opt(sbi->s_mount_opt, NOBH); 1236 clear_opt(sbi->s_mount_opt, NOBH);
1199 break; 1237 break;
1200 default: 1238 default:
1201 printk (KERN_ERR 1239 ext3_msg(sb, KERN_ERR,
1202 "EXT3-fs: Unrecognized mount option \"%s\" " 1240 "error: unrecognized mount option \"%s\" "
1203 "or missing value\n", p); 1241 "or missing value", p);
1204 return 0; 1242 return 0;
1205 } 1243 }
1206 } 1244 }
@@ -1218,21 +1256,21 @@ set_qf_format:
1218 (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA)) || 1256 (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA)) ||
1219 (sbi->s_qf_names[GRPQUOTA] && 1257 (sbi->s_qf_names[GRPQUOTA] &&
1220 (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA))) { 1258 (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA))) {
1221 printk(KERN_ERR "EXT3-fs: old and new quota " 1259 ext3_msg(sb, KERN_ERR, "error: old and new quota "
1222 "format mixing.\n"); 1260 "format mixing.");
1223 return 0; 1261 return 0;
1224 } 1262 }
1225 1263
1226 if (!sbi->s_jquota_fmt) { 1264 if (!sbi->s_jquota_fmt) {
1227 printk(KERN_ERR "EXT3-fs: journaled quota format " 1265 ext3_msg(sb, KERN_ERR, "error: journaled quota format "
1228 "not specified.\n"); 1266 "not specified.");
1229 return 0; 1267 return 0;
1230 } 1268 }
1231 } else { 1269 } else {
1232 if (sbi->s_jquota_fmt) { 1270 if (sbi->s_jquota_fmt) {
1233 printk(KERN_ERR "EXT3-fs: journaled quota format " 1271 ext3_msg(sb, KERN_ERR, "error: journaled quota format "
1234 "specified with no journaling " 1272 "specified with no journaling "
1235 "enabled.\n"); 1273 "enabled.");
1236 return 0; 1274 return 0;
1237 } 1275 }
1238 } 1276 }
@@ -1247,31 +1285,33 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
1247 int res = 0; 1285 int res = 0;
1248 1286
1249 if (le32_to_cpu(es->s_rev_level) > EXT3_MAX_SUPP_REV) { 1287 if (le32_to_cpu(es->s_rev_level) > EXT3_MAX_SUPP_REV) {
1250 printk (KERN_ERR "EXT3-fs warning: revision level too high, " 1288 ext3_msg(sb, KERN_ERR,
1251 "forcing read-only mode\n"); 1289 "error: revision level too high, "
1290 "forcing read-only mode");
1252 res = MS_RDONLY; 1291 res = MS_RDONLY;
1253 } 1292 }
1254 if (read_only) 1293 if (read_only)
1255 return res; 1294 return res;
1256 if (!(sbi->s_mount_state & EXT3_VALID_FS)) 1295 if (!(sbi->s_mount_state & EXT3_VALID_FS))
1257 printk (KERN_WARNING "EXT3-fs warning: mounting unchecked fs, " 1296 ext3_msg(sb, KERN_WARNING,
1258 "running e2fsck is recommended\n"); 1297 "warning: mounting unchecked fs, "
1298 "running e2fsck is recommended");
1259 else if ((sbi->s_mount_state & EXT3_ERROR_FS)) 1299 else if ((sbi->s_mount_state & EXT3_ERROR_FS))
1260 printk (KERN_WARNING 1300 ext3_msg(sb, KERN_WARNING,
1261 "EXT3-fs warning: mounting fs with errors, " 1301 "warning: mounting fs with errors, "
1262 "running e2fsck is recommended\n"); 1302 "running e2fsck is recommended");
1263 else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 && 1303 else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 &&
1264 le16_to_cpu(es->s_mnt_count) >= 1304 le16_to_cpu(es->s_mnt_count) >=
1265 (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count)) 1305 (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count))
1266 printk (KERN_WARNING 1306 ext3_msg(sb, KERN_WARNING,
1267 "EXT3-fs warning: maximal mount count reached, " 1307 "warning: maximal mount count reached, "
1268 "running e2fsck is recommended\n"); 1308 "running e2fsck is recommended");
1269 else if (le32_to_cpu(es->s_checkinterval) && 1309 else if (le32_to_cpu(es->s_checkinterval) &&
1270 (le32_to_cpu(es->s_lastcheck) + 1310 (le32_to_cpu(es->s_lastcheck) +
1271 le32_to_cpu(es->s_checkinterval) <= get_seconds())) 1311 le32_to_cpu(es->s_checkinterval) <= get_seconds()))
1272 printk (KERN_WARNING 1312 ext3_msg(sb, KERN_WARNING,
1273 "EXT3-fs warning: checktime reached, " 1313 "warning: checktime reached, "
1274 "running e2fsck is recommended\n"); 1314 "running e2fsck is recommended");
1275#if 0 1315#if 0
1276 /* @@@ We _will_ want to clear the valid bit if we find 1316 /* @@@ We _will_ want to clear the valid bit if we find
1277 inconsistencies, to force a fsck at reboot. But for 1317 inconsistencies, to force a fsck at reboot. But for
@@ -1288,22 +1328,20 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
1288 1328
1289 ext3_commit_super(sb, es, 1); 1329 ext3_commit_super(sb, es, 1);
1290 if (test_opt(sb, DEBUG)) 1330 if (test_opt(sb, DEBUG))
1291 printk(KERN_INFO "[EXT3 FS bs=%lu, gc=%lu, " 1331 ext3_msg(sb, KERN_INFO, "[bs=%lu, gc=%lu, "
1292 "bpg=%lu, ipg=%lu, mo=%04lx]\n", 1332 "bpg=%lu, ipg=%lu, mo=%04lx]",
1293 sb->s_blocksize, 1333 sb->s_blocksize,
1294 sbi->s_groups_count, 1334 sbi->s_groups_count,
1295 EXT3_BLOCKS_PER_GROUP(sb), 1335 EXT3_BLOCKS_PER_GROUP(sb),
1296 EXT3_INODES_PER_GROUP(sb), 1336 EXT3_INODES_PER_GROUP(sb),
1297 sbi->s_mount_opt); 1337 sbi->s_mount_opt);
1298 1338
1299 printk(KERN_INFO "EXT3 FS on %s, ", sb->s_id);
1300 if (EXT3_SB(sb)->s_journal->j_inode == NULL) { 1339 if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
1301 char b[BDEVNAME_SIZE]; 1340 char b[BDEVNAME_SIZE];
1302 1341 ext3_msg(sb, KERN_INFO, "using external journal on %s",
1303 printk("external journal on %s\n",
1304 bdevname(EXT3_SB(sb)->s_journal->j_dev, b)); 1342 bdevname(EXT3_SB(sb)->s_journal->j_dev, b));
1305 } else { 1343 } else {
1306 printk("internal journal\n"); 1344 ext3_msg(sb, KERN_INFO, "using internal journal");
1307 } 1345 }
1308 return res; 1346 return res;
1309} 1347}
@@ -1397,8 +1435,8 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1397 } 1435 }
1398 1436
1399 if (bdev_read_only(sb->s_bdev)) { 1437 if (bdev_read_only(sb->s_bdev)) {
1400 printk(KERN_ERR "EXT3-fs: write access " 1438 ext3_msg(sb, KERN_ERR, "error: write access "
1401 "unavailable, skipping orphan cleanup.\n"); 1439 "unavailable, skipping orphan cleanup.");
1402 return; 1440 return;
1403 } 1441 }
1404 1442
@@ -1412,8 +1450,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1412 } 1450 }
1413 1451
1414 if (s_flags & MS_RDONLY) { 1452 if (s_flags & MS_RDONLY) {
1415 printk(KERN_INFO "EXT3-fs: %s: orphan cleanup on readonly fs\n", 1453 ext3_msg(sb, KERN_INFO, "orphan cleanup on readonly fs");
1416 sb->s_id);
1417 sb->s_flags &= ~MS_RDONLY; 1454 sb->s_flags &= ~MS_RDONLY;
1418 } 1455 }
1419#ifdef CONFIG_QUOTA 1456#ifdef CONFIG_QUOTA
@@ -1424,9 +1461,9 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1424 if (EXT3_SB(sb)->s_qf_names[i]) { 1461 if (EXT3_SB(sb)->s_qf_names[i]) {
1425 int ret = ext3_quota_on_mount(sb, i); 1462 int ret = ext3_quota_on_mount(sb, i);
1426 if (ret < 0) 1463 if (ret < 0)
1427 printk(KERN_ERR 1464 ext3_msg(sb, KERN_ERR,
1428 "EXT3-fs: Cannot turn on journaled " 1465 "error: cannot turn on journaled "
1429 "quota: error %d\n", ret); 1466 "quota: %d", ret);
1430 } 1467 }
1431 } 1468 }
1432#endif 1469#endif
@@ -1464,11 +1501,11 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1464#define PLURAL(x) (x), ((x)==1) ? "" : "s" 1501#define PLURAL(x) (x), ((x)==1) ? "" : "s"
1465 1502
1466 if (nr_orphans) 1503 if (nr_orphans)
1467 printk(KERN_INFO "EXT3-fs: %s: %d orphan inode%s deleted\n", 1504 ext3_msg(sb, KERN_INFO, "%d orphan inode%s deleted",
1468 sb->s_id, PLURAL(nr_orphans)); 1505 PLURAL(nr_orphans));
1469 if (nr_truncates) 1506 if (nr_truncates)
1470 printk(KERN_INFO "EXT3-fs: %s: %d truncate%s cleaned up\n", 1507 ext3_msg(sb, KERN_INFO, "%d truncate%s cleaned up",
1471 sb->s_id, PLURAL(nr_truncates)); 1508 PLURAL(nr_truncates));
1472#ifdef CONFIG_QUOTA 1509#ifdef CONFIG_QUOTA
1473 /* Turn quotas off */ 1510 /* Turn quotas off */
1474 for (i = 0; i < MAXQUOTAS; i++) { 1511 for (i = 0; i < MAXQUOTAS; i++) {
@@ -1552,7 +1589,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1552 struct ext3_super_block *es = NULL; 1589 struct ext3_super_block *es = NULL;
1553 struct ext3_sb_info *sbi; 1590 struct ext3_sb_info *sbi;
1554 ext3_fsblk_t block; 1591 ext3_fsblk_t block;
1555 ext3_fsblk_t sb_block = get_sb_block(&data); 1592 ext3_fsblk_t sb_block = get_sb_block(&data, sb);
1556 ext3_fsblk_t logic_sb_block; 1593 ext3_fsblk_t logic_sb_block;
1557 unsigned long offset = 0; 1594 unsigned long offset = 0;
1558 unsigned int journal_inum = 0; 1595 unsigned int journal_inum = 0;
@@ -1588,7 +1625,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1588 1625
1589 blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE); 1626 blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE);
1590 if (!blocksize) { 1627 if (!blocksize) {
1591 printk(KERN_ERR "EXT3-fs: unable to set blocksize\n"); 1628 ext3_msg(sb, KERN_ERR, "error: unable to set blocksize");
1592 goto out_fail; 1629 goto out_fail;
1593 } 1630 }
1594 1631
@@ -1604,7 +1641,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1604 } 1641 }
1605 1642
1606 if (!(bh = sb_bread(sb, logic_sb_block))) { 1643 if (!(bh = sb_bread(sb, logic_sb_block))) {
1607 printk (KERN_ERR "EXT3-fs: unable to read superblock\n"); 1644 ext3_msg(sb, KERN_ERR, "error: unable to read superblock");
1608 goto out_fail; 1645 goto out_fail;
1609 } 1646 }
1610 /* 1647 /*
@@ -1663,9 +1700,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1663 (EXT3_HAS_COMPAT_FEATURE(sb, ~0U) || 1700 (EXT3_HAS_COMPAT_FEATURE(sb, ~0U) ||
1664 EXT3_HAS_RO_COMPAT_FEATURE(sb, ~0U) || 1701 EXT3_HAS_RO_COMPAT_FEATURE(sb, ~0U) ||
1665 EXT3_HAS_INCOMPAT_FEATURE(sb, ~0U))) 1702 EXT3_HAS_INCOMPAT_FEATURE(sb, ~0U)))
1666 printk(KERN_WARNING 1703 ext3_msg(sb, KERN_WARNING,
1667 "EXT3-fs warning: feature flags set on rev 0 fs, " 1704 "warning: feature flags set on rev 0 fs, "
1668 "running e2fsck is recommended\n"); 1705 "running e2fsck is recommended");
1669 /* 1706 /*
1670 * Check feature flags regardless of the revision level, since we 1707 * Check feature flags regardless of the revision level, since we
1671 * previously didn't change the revision level when setting the flags, 1708 * previously didn't change the revision level when setting the flags,
@@ -1673,25 +1710,25 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1673 */ 1710 */
1674 features = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP); 1711 features = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP);
1675 if (features) { 1712 if (features) {
1676 printk(KERN_ERR "EXT3-fs: %s: couldn't mount because of " 1713 ext3_msg(sb, KERN_ERR,
1677 "unsupported optional features (%x).\n", 1714 "error: couldn't mount because of unsupported "
1678 sb->s_id, le32_to_cpu(features)); 1715 "optional features (%x)", le32_to_cpu(features));
1679 goto failed_mount; 1716 goto failed_mount;
1680 } 1717 }
1681 features = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP); 1718 features = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP);
1682 if (!(sb->s_flags & MS_RDONLY) && features) { 1719 if (!(sb->s_flags & MS_RDONLY) && features) {
1683 printk(KERN_ERR "EXT3-fs: %s: couldn't mount RDWR because of " 1720 ext3_msg(sb, KERN_ERR,
1684 "unsupported optional features (%x).\n", 1721 "error: couldn't mount RDWR because of unsupported "
1685 sb->s_id, le32_to_cpu(features)); 1722 "optional features (%x)", le32_to_cpu(features));
1686 goto failed_mount; 1723 goto failed_mount;
1687 } 1724 }
1688 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); 1725 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
1689 1726
1690 if (blocksize < EXT3_MIN_BLOCK_SIZE || 1727 if (blocksize < EXT3_MIN_BLOCK_SIZE ||
1691 blocksize > EXT3_MAX_BLOCK_SIZE) { 1728 blocksize > EXT3_MAX_BLOCK_SIZE) {
1692 printk(KERN_ERR 1729 ext3_msg(sb, KERN_ERR,
1693 "EXT3-fs: Unsupported filesystem blocksize %d on %s.\n", 1730 "error: couldn't mount because of unsupported "
1694 blocksize, sb->s_id); 1731 "filesystem blocksize %d", blocksize);
1695 goto failed_mount; 1732 goto failed_mount;
1696 } 1733 }
1697 1734
@@ -1702,30 +1739,31 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1702 * than the hardware sectorsize for the machine. 1739 * than the hardware sectorsize for the machine.
1703 */ 1740 */
1704 if (blocksize < hblock) { 1741 if (blocksize < hblock) {
1705 printk(KERN_ERR "EXT3-fs: blocksize %d too small for " 1742 ext3_msg(sb, KERN_ERR,
1706 "device blocksize %d.\n", blocksize, hblock); 1743 "error: fsblocksize %d too small for "
1744 "hardware sectorsize %d", blocksize, hblock);
1707 goto failed_mount; 1745 goto failed_mount;
1708 } 1746 }
1709 1747
1710 brelse (bh); 1748 brelse (bh);
1711 if (!sb_set_blocksize(sb, blocksize)) { 1749 if (!sb_set_blocksize(sb, blocksize)) {
1712 printk(KERN_ERR "EXT3-fs: bad blocksize %d.\n", 1750 ext3_msg(sb, KERN_ERR,
1713 blocksize); 1751 "error: bad blocksize %d", blocksize);
1714 goto out_fail; 1752 goto out_fail;
1715 } 1753 }
1716 logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize; 1754 logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize;
1717 offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize; 1755 offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize;
1718 bh = sb_bread(sb, logic_sb_block); 1756 bh = sb_bread(sb, logic_sb_block);
1719 if (!bh) { 1757 if (!bh) {
1720 printk(KERN_ERR 1758 ext3_msg(sb, KERN_ERR,
1721 "EXT3-fs: Can't read superblock on 2nd try.\n"); 1759 "error: can't read superblock on 2nd try");
1722 goto failed_mount; 1760 goto failed_mount;
1723 } 1761 }
1724 es = (struct ext3_super_block *)(((char *)bh->b_data) + offset); 1762 es = (struct ext3_super_block *)(((char *)bh->b_data) + offset);
1725 sbi->s_es = es; 1763 sbi->s_es = es;
1726 if (es->s_magic != cpu_to_le16(EXT3_SUPER_MAGIC)) { 1764 if (es->s_magic != cpu_to_le16(EXT3_SUPER_MAGIC)) {
1727 printk (KERN_ERR 1765 ext3_msg(sb, KERN_ERR,
1728 "EXT3-fs: Magic mismatch, very weird !\n"); 1766 "error: magic mismatch");
1729 goto failed_mount; 1767 goto failed_mount;
1730 } 1768 }
1731 } 1769 }
@@ -1741,8 +1779,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1741 if ((sbi->s_inode_size < EXT3_GOOD_OLD_INODE_SIZE) || 1779 if ((sbi->s_inode_size < EXT3_GOOD_OLD_INODE_SIZE) ||
1742 (!is_power_of_2(sbi->s_inode_size)) || 1780 (!is_power_of_2(sbi->s_inode_size)) ||
1743 (sbi->s_inode_size > blocksize)) { 1781 (sbi->s_inode_size > blocksize)) {
1744 printk (KERN_ERR 1782 ext3_msg(sb, KERN_ERR,
1745 "EXT3-fs: unsupported inode size: %d\n", 1783 "error: unsupported inode size: %d",
1746 sbi->s_inode_size); 1784 sbi->s_inode_size);
1747 goto failed_mount; 1785 goto failed_mount;
1748 } 1786 }
@@ -1750,8 +1788,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1750 sbi->s_frag_size = EXT3_MIN_FRAG_SIZE << 1788 sbi->s_frag_size = EXT3_MIN_FRAG_SIZE <<
1751 le32_to_cpu(es->s_log_frag_size); 1789 le32_to_cpu(es->s_log_frag_size);
1752 if (blocksize != sbi->s_frag_size) { 1790 if (blocksize != sbi->s_frag_size) {
1753 printk(KERN_ERR 1791 ext3_msg(sb, KERN_ERR,
1754 "EXT3-fs: fragsize %lu != blocksize %u (unsupported)\n", 1792 "error: fragsize %lu != blocksize %u (unsupported)",
1755 sbi->s_frag_size, blocksize); 1793 sbi->s_frag_size, blocksize);
1756 goto failed_mount; 1794 goto failed_mount;
1757 } 1795 }
@@ -1787,31 +1825,31 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1787 } 1825 }
1788 1826
1789 if (sbi->s_blocks_per_group > blocksize * 8) { 1827 if (sbi->s_blocks_per_group > blocksize * 8) {
1790 printk (KERN_ERR 1828 ext3_msg(sb, KERN_ERR,
1791 "EXT3-fs: #blocks per group too big: %lu\n", 1829 "#blocks per group too big: %lu",
1792 sbi->s_blocks_per_group); 1830 sbi->s_blocks_per_group);
1793 goto failed_mount; 1831 goto failed_mount;
1794 } 1832 }
1795 if (sbi->s_frags_per_group > blocksize * 8) { 1833 if (sbi->s_frags_per_group > blocksize * 8) {
1796 printk (KERN_ERR 1834 ext3_msg(sb, KERN_ERR,
1797 "EXT3-fs: #fragments per group too big: %lu\n", 1835 "error: #fragments per group too big: %lu",
1798 sbi->s_frags_per_group); 1836 sbi->s_frags_per_group);
1799 goto failed_mount; 1837 goto failed_mount;
1800 } 1838 }
1801 if (sbi->s_inodes_per_group > blocksize * 8) { 1839 if (sbi->s_inodes_per_group > blocksize * 8) {
1802 printk (KERN_ERR 1840 ext3_msg(sb, KERN_ERR,
1803 "EXT3-fs: #inodes per group too big: %lu\n", 1841 "error: #inodes per group too big: %lu",
1804 sbi->s_inodes_per_group); 1842 sbi->s_inodes_per_group);
1805 goto failed_mount; 1843 goto failed_mount;
1806 } 1844 }
1807 1845
1808 if (le32_to_cpu(es->s_blocks_count) > 1846 if (le32_to_cpu(es->s_blocks_count) >
1809 (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) { 1847 (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) {
1810 printk(KERN_ERR "EXT3-fs: filesystem on %s:" 1848 ext3_msg(sb, KERN_ERR,
1811 " too large to mount safely\n", sb->s_id); 1849 "error: filesystem is too large to mount safely");
1812 if (sizeof(sector_t) < 8) 1850 if (sizeof(sector_t) < 8)
1813 printk(KERN_WARNING "EXT3-fs: CONFIG_LBDAF not " 1851 ext3_msg(sb, KERN_ERR,
1814 "enabled\n"); 1852 "error: CONFIG_LBDAF not enabled");
1815 goto failed_mount; 1853 goto failed_mount;
1816 } 1854 }
1817 1855
@@ -1825,7 +1863,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1825 sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *), 1863 sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
1826 GFP_KERNEL); 1864 GFP_KERNEL);
1827 if (sbi->s_group_desc == NULL) { 1865 if (sbi->s_group_desc == NULL) {
1828 printk (KERN_ERR "EXT3-fs: not enough memory\n"); 1866 ext3_msg(sb, KERN_ERR,
1867 "error: not enough memory");
1829 goto failed_mount; 1868 goto failed_mount;
1830 } 1869 }
1831 1870
@@ -1835,14 +1874,15 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1835 block = descriptor_loc(sb, logic_sb_block, i); 1874 block = descriptor_loc(sb, logic_sb_block, i);
1836 sbi->s_group_desc[i] = sb_bread(sb, block); 1875 sbi->s_group_desc[i] = sb_bread(sb, block);
1837 if (!sbi->s_group_desc[i]) { 1876 if (!sbi->s_group_desc[i]) {
1838 printk (KERN_ERR "EXT3-fs: " 1877 ext3_msg(sb, KERN_ERR,
1839 "can't read group descriptor %d\n", i); 1878 "error: can't read group descriptor %d", i);
1840 db_count = i; 1879 db_count = i;
1841 goto failed_mount2; 1880 goto failed_mount2;
1842 } 1881 }
1843 } 1882 }
1844 if (!ext3_check_descriptors (sb)) { 1883 if (!ext3_check_descriptors (sb)) {
1845 printk(KERN_ERR "EXT3-fs: group descriptors corrupted!\n"); 1884 ext3_msg(sb, KERN_ERR,
1885 "error: group descriptors corrupted");
1846 goto failed_mount2; 1886 goto failed_mount2;
1847 } 1887 }
1848 sbi->s_gdb_count = db_count; 1888 sbi->s_gdb_count = db_count;
@@ -1860,7 +1900,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1860 ext3_count_dirs(sb)); 1900 ext3_count_dirs(sb));
1861 } 1901 }
1862 if (err) { 1902 if (err) {
1863 printk(KERN_ERR "EXT3-fs: insufficient memory\n"); 1903 ext3_msg(sb, KERN_ERR, "error: insufficient memory");
1864 goto failed_mount3; 1904 goto failed_mount3;
1865 } 1905 }
1866 1906
@@ -1888,6 +1928,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1888 sb->dq_op = &ext3_quota_operations; 1928 sb->dq_op = &ext3_quota_operations;
1889#endif 1929#endif
1890 INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ 1930 INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
1931 mutex_init(&sbi->s_orphan_lock);
1932 mutex_init(&sbi->s_resize_lock);
1891 1933
1892 sb->s_root = NULL; 1934 sb->s_root = NULL;
1893 1935
@@ -1908,9 +1950,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1908 goto failed_mount3; 1950 goto failed_mount3;
1909 } else { 1951 } else {
1910 if (!silent) 1952 if (!silent)
1911 printk (KERN_ERR 1953 ext3_msg(sb, KERN_ERR,
1912 "ext3: No journal on filesystem on %s\n", 1954 "error: no journal found. "
1913 sb->s_id); 1955 "mounting ext3 over ext2?");
1914 goto failed_mount3; 1956 goto failed_mount3;
1915 } 1957 }
1916 1958
@@ -1932,8 +1974,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1932 case EXT3_MOUNT_WRITEBACK_DATA: 1974 case EXT3_MOUNT_WRITEBACK_DATA:
1933 if (!journal_check_available_features 1975 if (!journal_check_available_features
1934 (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { 1976 (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) {
1935 printk(KERN_ERR "EXT3-fs: Journal does not support " 1977 ext3_msg(sb, KERN_ERR,
1936 "requested data journaling mode\n"); 1978 "error: journal does not support "
1979 "requested data journaling mode");
1937 goto failed_mount4; 1980 goto failed_mount4;
1938 } 1981 }
1939 default: 1982 default:
@@ -1942,8 +1985,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1942 1985
1943 if (test_opt(sb, NOBH)) { 1986 if (test_opt(sb, NOBH)) {
1944 if (!(test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)) { 1987 if (!(test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)) {
1945 printk(KERN_WARNING "EXT3-fs: Ignoring nobh option - " 1988 ext3_msg(sb, KERN_WARNING,
1946 "its supported only with writeback mode\n"); 1989 "warning: ignoring nobh option - "
1990 "it is supported only with writeback mode");
1947 clear_opt(sbi->s_mount_opt, NOBH); 1991 clear_opt(sbi->s_mount_opt, NOBH);
1948 } 1992 }
1949 } 1993 }
@@ -1954,39 +1998,32 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1954 1998
1955 root = ext3_iget(sb, EXT3_ROOT_INO); 1999 root = ext3_iget(sb, EXT3_ROOT_INO);
1956 if (IS_ERR(root)) { 2000 if (IS_ERR(root)) {
1957 printk(KERN_ERR "EXT3-fs: get root inode failed\n"); 2001 ext3_msg(sb, KERN_ERR, "error: get root inode failed");
1958 ret = PTR_ERR(root); 2002 ret = PTR_ERR(root);
1959 goto failed_mount4; 2003 goto failed_mount4;
1960 } 2004 }
1961 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 2005 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
1962 iput(root); 2006 iput(root);
1963 printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n"); 2007 ext3_msg(sb, KERN_ERR, "error: corrupt root inode, run e2fsck");
1964 goto failed_mount4; 2008 goto failed_mount4;
1965 } 2009 }
1966 sb->s_root = d_alloc_root(root); 2010 sb->s_root = d_alloc_root(root);
1967 if (!sb->s_root) { 2011 if (!sb->s_root) {
1968 printk(KERN_ERR "EXT3-fs: get root dentry failed\n"); 2012 ext3_msg(sb, KERN_ERR, "error: get root dentry failed");
1969 iput(root); 2013 iput(root);
1970 ret = -ENOMEM; 2014 ret = -ENOMEM;
1971 goto failed_mount4; 2015 goto failed_mount4;
1972 } 2016 }
1973 2017
1974 ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY); 2018 ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
1975 /* 2019
1976 * akpm: core read_super() calls in here with the superblock locked.
1977 * That deadlocks, because orphan cleanup needs to lock the superblock
1978 * in numerous places. Here we just pop the lock - it's relatively
1979 * harmless, because we are now ready to accept write_super() requests,
1980 * and aviro says that's the only reason for hanging onto the
1981 * superblock lock.
1982 */
1983 EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS; 2020 EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS;
1984 ext3_orphan_cleanup(sb, es); 2021 ext3_orphan_cleanup(sb, es);
1985 EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS; 2022 EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS;
1986 if (needs_recovery) 2023 if (needs_recovery)
1987 printk (KERN_INFO "EXT3-fs: recovery complete.\n"); 2024 ext3_msg(sb, KERN_INFO, "recovery complete");
1988 ext3_mark_recovery_complete(sb, es); 2025 ext3_mark_recovery_complete(sb, es);
1989 printk (KERN_INFO "EXT3-fs: mounted filesystem with %s data mode.\n", 2026 ext3_msg(sb, KERN_INFO, "mounted filesystem with %s data mode",
1990 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA ? "journal": 2027 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA ? "journal":
1991 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": 2028 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered":
1992 "writeback"); 2029 "writeback");
@@ -1996,7 +2033,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1996 2033
1997cantfind_ext3: 2034cantfind_ext3:
1998 if (!silent) 2035 if (!silent)
1999 printk(KERN_ERR "VFS: Can't find ext3 filesystem on dev %s.\n", 2036 ext3_msg(sb, KERN_INFO,
2037 "error: can't find ext3 filesystem on dev %s.",
2000 sb->s_id); 2038 sb->s_id);
2001 goto failed_mount; 2039 goto failed_mount;
2002 2040
@@ -2064,27 +2102,27 @@ static journal_t *ext3_get_journal(struct super_block *sb,
2064 2102
2065 journal_inode = ext3_iget(sb, journal_inum); 2103 journal_inode = ext3_iget(sb, journal_inum);
2066 if (IS_ERR(journal_inode)) { 2104 if (IS_ERR(journal_inode)) {
2067 printk(KERN_ERR "EXT3-fs: no journal found.\n"); 2105 ext3_msg(sb, KERN_ERR, "error: no journal found");
2068 return NULL; 2106 return NULL;
2069 } 2107 }
2070 if (!journal_inode->i_nlink) { 2108 if (!journal_inode->i_nlink) {
2071 make_bad_inode(journal_inode); 2109 make_bad_inode(journal_inode);
2072 iput(journal_inode); 2110 iput(journal_inode);
2073 printk(KERN_ERR "EXT3-fs: journal inode is deleted.\n"); 2111 ext3_msg(sb, KERN_ERR, "error: journal inode is deleted");
2074 return NULL; 2112 return NULL;
2075 } 2113 }
2076 2114
2077 jbd_debug(2, "Journal inode found at %p: %Ld bytes\n", 2115 jbd_debug(2, "Journal inode found at %p: %Ld bytes\n",
2078 journal_inode, journal_inode->i_size); 2116 journal_inode, journal_inode->i_size);
2079 if (!S_ISREG(journal_inode->i_mode)) { 2117 if (!S_ISREG(journal_inode->i_mode)) {
2080 printk(KERN_ERR "EXT3-fs: invalid journal inode.\n"); 2118 ext3_msg(sb, KERN_ERR, "error: invalid journal inode");
2081 iput(journal_inode); 2119 iput(journal_inode);
2082 return NULL; 2120 return NULL;
2083 } 2121 }
2084 2122
2085 journal = journal_init_inode(journal_inode); 2123 journal = journal_init_inode(journal_inode);
2086 if (!journal) { 2124 if (!journal) {
2087 printk(KERN_ERR "EXT3-fs: Could not load journal inode\n"); 2125 ext3_msg(sb, KERN_ERR, "error: could not load journal inode");
2088 iput(journal_inode); 2126 iput(journal_inode);
2089 return NULL; 2127 return NULL;
2090 } 2128 }
@@ -2106,13 +2144,13 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2106 struct ext3_super_block * es; 2144 struct ext3_super_block * es;
2107 struct block_device *bdev; 2145 struct block_device *bdev;
2108 2146
2109 bdev = ext3_blkdev_get(j_dev); 2147 bdev = ext3_blkdev_get(j_dev, sb);
2110 if (bdev == NULL) 2148 if (bdev == NULL)
2111 return NULL; 2149 return NULL;
2112 2150
2113 if (bd_claim(bdev, sb)) { 2151 if (bd_claim(bdev, sb)) {
2114 printk(KERN_ERR 2152 ext3_msg(sb, KERN_ERR,
2115 "EXT3: failed to claim external journal device.\n"); 2153 "error: failed to claim external journal device");
2116 blkdev_put(bdev, FMODE_READ|FMODE_WRITE); 2154 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
2117 return NULL; 2155 return NULL;
2118 } 2156 }
@@ -2120,8 +2158,8 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2120 blocksize = sb->s_blocksize; 2158 blocksize = sb->s_blocksize;
2121 hblock = bdev_logical_block_size(bdev); 2159 hblock = bdev_logical_block_size(bdev);
2122 if (blocksize < hblock) { 2160 if (blocksize < hblock) {
2123 printk(KERN_ERR 2161 ext3_msg(sb, KERN_ERR,
2124 "EXT3-fs: blocksize too small for journal device.\n"); 2162 "error: blocksize too small for journal device");
2125 goto out_bdev; 2163 goto out_bdev;
2126 } 2164 }
2127 2165
@@ -2129,8 +2167,8 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2129 offset = EXT3_MIN_BLOCK_SIZE % blocksize; 2167 offset = EXT3_MIN_BLOCK_SIZE % blocksize;
2130 set_blocksize(bdev, blocksize); 2168 set_blocksize(bdev, blocksize);
2131 if (!(bh = __bread(bdev, sb_block, blocksize))) { 2169 if (!(bh = __bread(bdev, sb_block, blocksize))) {
2132 printk(KERN_ERR "EXT3-fs: couldn't read superblock of " 2170 ext3_msg(sb, KERN_ERR, "error: couldn't read superblock of "
2133 "external journal\n"); 2171 "external journal");
2134 goto out_bdev; 2172 goto out_bdev;
2135 } 2173 }
2136 2174
@@ -2138,14 +2176,14 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2138 if ((le16_to_cpu(es->s_magic) != EXT3_SUPER_MAGIC) || 2176 if ((le16_to_cpu(es->s_magic) != EXT3_SUPER_MAGIC) ||
2139 !(le32_to_cpu(es->s_feature_incompat) & 2177 !(le32_to_cpu(es->s_feature_incompat) &
2140 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) { 2178 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) {
2141 printk(KERN_ERR "EXT3-fs: external journal has " 2179 ext3_msg(sb, KERN_ERR, "error: external journal has "
2142 "bad superblock\n"); 2180 "bad superblock");
2143 brelse(bh); 2181 brelse(bh);
2144 goto out_bdev; 2182 goto out_bdev;
2145 } 2183 }
2146 2184
2147 if (memcmp(EXT3_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) { 2185 if (memcmp(EXT3_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) {
2148 printk(KERN_ERR "EXT3-fs: journal UUID does not match\n"); 2186 ext3_msg(sb, KERN_ERR, "error: journal UUID does not match");
2149 brelse(bh); 2187 brelse(bh);
2150 goto out_bdev; 2188 goto out_bdev;
2151 } 2189 }
@@ -2157,19 +2195,21 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
2157 journal = journal_init_dev(bdev, sb->s_bdev, 2195 journal = journal_init_dev(bdev, sb->s_bdev,
2158 start, len, blocksize); 2196 start, len, blocksize);
2159 if (!journal) { 2197 if (!journal) {
2160 printk(KERN_ERR "EXT3-fs: failed to create device journal\n"); 2198 ext3_msg(sb, KERN_ERR,
2199 "error: failed to create device journal");
2161 goto out_bdev; 2200 goto out_bdev;
2162 } 2201 }
2163 journal->j_private = sb; 2202 journal->j_private = sb;
2164 ll_rw_block(READ, 1, &journal->j_sb_buffer); 2203 ll_rw_block(READ, 1, &journal->j_sb_buffer);
2165 wait_on_buffer(journal->j_sb_buffer); 2204 wait_on_buffer(journal->j_sb_buffer);
2166 if (!buffer_uptodate(journal->j_sb_buffer)) { 2205 if (!buffer_uptodate(journal->j_sb_buffer)) {
2167 printk(KERN_ERR "EXT3-fs: I/O error on journal device\n"); 2206 ext3_msg(sb, KERN_ERR, "I/O error on journal device");
2168 goto out_journal; 2207 goto out_journal;
2169 } 2208 }
2170 if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { 2209 if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
2171 printk(KERN_ERR "EXT3-fs: External journal has more than one " 2210 ext3_msg(sb, KERN_ERR,
2172 "user (unsupported) - %d\n", 2211 "error: external journal has more than one "
2212 "user (unsupported) - %d",
2173 be32_to_cpu(journal->j_superblock->s_nr_users)); 2213 be32_to_cpu(journal->j_superblock->s_nr_users));
2174 goto out_journal; 2214 goto out_journal;
2175 } 2215 }
@@ -2195,8 +2235,8 @@ static int ext3_load_journal(struct super_block *sb,
2195 2235
2196 if (journal_devnum && 2236 if (journal_devnum &&
2197 journal_devnum != le32_to_cpu(es->s_journal_dev)) { 2237 journal_devnum != le32_to_cpu(es->s_journal_dev)) {
2198 printk(KERN_INFO "EXT3-fs: external journal device major/minor " 2238 ext3_msg(sb, KERN_INFO, "external journal device major/minor "
2199 "numbers have changed\n"); 2239 "numbers have changed");
2200 journal_dev = new_decode_dev(journal_devnum); 2240 journal_dev = new_decode_dev(journal_devnum);
2201 } else 2241 } else
2202 journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev)); 2242 journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev));
@@ -2211,21 +2251,21 @@ static int ext3_load_journal(struct super_block *sb,
2211 2251
2212 if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)) { 2252 if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)) {
2213 if (sb->s_flags & MS_RDONLY) { 2253 if (sb->s_flags & MS_RDONLY) {
2214 printk(KERN_INFO "EXT3-fs: INFO: recovery " 2254 ext3_msg(sb, KERN_INFO,
2215 "required on readonly filesystem.\n"); 2255 "recovery required on readonly filesystem");
2216 if (really_read_only) { 2256 if (really_read_only) {
2217 printk(KERN_ERR "EXT3-fs: write access " 2257 ext3_msg(sb, KERN_ERR, "error: write access "
2218 "unavailable, cannot proceed.\n"); 2258 "unavailable, cannot proceed");
2219 return -EROFS; 2259 return -EROFS;
2220 } 2260 }
2221 printk (KERN_INFO "EXT3-fs: write access will " 2261 ext3_msg(sb, KERN_INFO,
2222 "be enabled during recovery.\n"); 2262 "write access will be enabled during recovery");
2223 } 2263 }
2224 } 2264 }
2225 2265
2226 if (journal_inum && journal_dev) { 2266 if (journal_inum && journal_dev) {
2227 printk(KERN_ERR "EXT3-fs: filesystem has both journal " 2267 ext3_msg(sb, KERN_ERR, "error: filesystem has both journal "
2228 "and inode journals!\n"); 2268 "and inode journals");
2229 return -EINVAL; 2269 return -EINVAL;
2230 } 2270 }
2231 2271
@@ -2240,7 +2280,7 @@ static int ext3_load_journal(struct super_block *sb,
2240 if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) { 2280 if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) {
2241 err = journal_update_format(journal); 2281 err = journal_update_format(journal);
2242 if (err) { 2282 if (err) {
2243 printk(KERN_ERR "EXT3-fs: error updating journal.\n"); 2283 ext3_msg(sb, KERN_ERR, "error updating journal");
2244 journal_destroy(journal); 2284 journal_destroy(journal);
2245 return err; 2285 return err;
2246 } 2286 }
@@ -2252,7 +2292,7 @@ static int ext3_load_journal(struct super_block *sb,
2252 err = journal_load(journal); 2292 err = journal_load(journal);
2253 2293
2254 if (err) { 2294 if (err) {
2255 printk(KERN_ERR "EXT3-fs: error loading journal.\n"); 2295 ext3_msg(sb, KERN_ERR, "error loading journal");
2256 journal_destroy(journal); 2296 journal_destroy(journal);
2257 return err; 2297 return err;
2258 } 2298 }
@@ -2271,16 +2311,17 @@ static int ext3_load_journal(struct super_block *sb,
2271 return 0; 2311 return 0;
2272} 2312}
2273 2313
2274static int ext3_create_journal(struct super_block * sb, 2314static int ext3_create_journal(struct super_block *sb,
2275 struct ext3_super_block * es, 2315 struct ext3_super_block *es,
2276 unsigned int journal_inum) 2316 unsigned int journal_inum)
2277{ 2317{
2278 journal_t *journal; 2318 journal_t *journal;
2279 int err; 2319 int err;
2280 2320
2281 if (sb->s_flags & MS_RDONLY) { 2321 if (sb->s_flags & MS_RDONLY) {
2282 printk(KERN_ERR "EXT3-fs: readonly filesystem when trying to " 2322 ext3_msg(sb, KERN_ERR,
2283 "create journal.\n"); 2323 "error: readonly filesystem when trying to "
2324 "create journal");
2284 return -EROFS; 2325 return -EROFS;
2285 } 2326 }
2286 2327
@@ -2288,12 +2329,12 @@ static int ext3_create_journal(struct super_block * sb,
2288 if (!journal) 2329 if (!journal)
2289 return -EINVAL; 2330 return -EINVAL;
2290 2331
2291 printk(KERN_INFO "EXT3-fs: creating new journal on inode %u\n", 2332 ext3_msg(sb, KERN_INFO, "creating new journal on inode %u",
2292 journal_inum); 2333 journal_inum);
2293 2334
2294 err = journal_create(journal); 2335 err = journal_create(journal);
2295 if (err) { 2336 if (err) {
2296 printk(KERN_ERR "EXT3-fs: error creating journal.\n"); 2337 ext3_msg(sb, KERN_ERR, "error creating journal");
2297 journal_destroy(journal); 2338 journal_destroy(journal);
2298 return -EIO; 2339 return -EIO;
2299 } 2340 }
@@ -2357,13 +2398,11 @@ static void ext3_mark_recovery_complete(struct super_block * sb,
2357 if (journal_flush(journal) < 0) 2398 if (journal_flush(journal) < 0)
2358 goto out; 2399 goto out;
2359 2400
2360 lock_super(sb);
2361 if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) && 2401 if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) &&
2362 sb->s_flags & MS_RDONLY) { 2402 sb->s_flags & MS_RDONLY) {
2363 EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); 2403 EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
2364 ext3_commit_super(sb, es, 1); 2404 ext3_commit_super(sb, es, 1);
2365 } 2405 }
2366 unlock_super(sb);
2367 2406
2368out: 2407out:
2369 journal_unlock_updates(journal); 2408 journal_unlock_updates(journal);
@@ -2374,8 +2413,8 @@ out:
2374 * has recorded an error from a previous lifetime, move that error to the 2413 * has recorded an error from a previous lifetime, move that error to the
2375 * main filesystem now. 2414 * main filesystem now.
2376 */ 2415 */
2377static void ext3_clear_journal_err(struct super_block * sb, 2416static void ext3_clear_journal_err(struct super_block *sb,
2378 struct ext3_super_block * es) 2417 struct ext3_super_block *es)
2379{ 2418{
2380 journal_t *journal; 2419 journal_t *journal;
2381 int j_errno; 2420 int j_errno;
@@ -2555,21 +2594,15 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2555 (sbi->s_mount_state & EXT3_VALID_FS)) 2594 (sbi->s_mount_state & EXT3_VALID_FS))
2556 es->s_state = cpu_to_le16(sbi->s_mount_state); 2595 es->s_state = cpu_to_le16(sbi->s_mount_state);
2557 2596
2558 /*
2559 * We have to unlock super so that we can wait for
2560 * transactions.
2561 */
2562 unlock_super(sb);
2563 ext3_mark_recovery_complete(sb, es); 2597 ext3_mark_recovery_complete(sb, es);
2564 lock_super(sb);
2565 } else { 2598 } else {
2566 __le32 ret; 2599 __le32 ret;
2567 if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb, 2600 if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb,
2568 ~EXT3_FEATURE_RO_COMPAT_SUPP))) { 2601 ~EXT3_FEATURE_RO_COMPAT_SUPP))) {
2569 printk(KERN_WARNING "EXT3-fs: %s: couldn't " 2602 ext3_msg(sb, KERN_WARNING,
2570 "remount RDWR because of unsupported " 2603 "warning: couldn't remount RDWR "
2571 "optional features (%x).\n", 2604 "because of unsupported optional "
2572 sb->s_id, le32_to_cpu(ret)); 2605 "features (%x)", le32_to_cpu(ret));
2573 err = -EROFS; 2606 err = -EROFS;
2574 goto restore_opts; 2607 goto restore_opts;
2575 } 2608 }
@@ -2580,11 +2613,10 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2580 * require a full umount/remount for now. 2613 * require a full umount/remount for now.
2581 */ 2614 */
2582 if (es->s_last_orphan) { 2615 if (es->s_last_orphan) {
2583 printk(KERN_WARNING "EXT3-fs: %s: couldn't " 2616 ext3_msg(sb, KERN_WARNING, "warning: couldn't "
2584 "remount RDWR because of unprocessed " 2617 "remount RDWR because of unprocessed "
2585 "orphan inode list. Please " 2618 "orphan inode list. Please "
2586 "umount/remount instead.\n", 2619 "umount/remount instead.");
2587 sb->s_id);
2588 err = -EINVAL; 2620 err = -EINVAL;
2589 goto restore_opts; 2621 goto restore_opts;
2590 } 2622 }
@@ -2684,13 +2716,11 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)
2684 buf->f_bsize = sb->s_blocksize; 2716 buf->f_bsize = sb->s_blocksize;
2685 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; 2717 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last;
2686 buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter); 2718 buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter);
2687 es->s_free_blocks_count = cpu_to_le32(buf->f_bfree);
2688 buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count); 2719 buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count);
2689 if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count)) 2720 if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count))
2690 buf->f_bavail = 0; 2721 buf->f_bavail = 0;
2691 buf->f_files = le32_to_cpu(es->s_inodes_count); 2722 buf->f_files = le32_to_cpu(es->s_inodes_count);
2692 buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter); 2723 buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter);
2693 es->s_free_inodes_count = cpu_to_le32(buf->f_ffree);
2694 buf->f_namelen = EXT3_NAME_LEN; 2724 buf->f_namelen = EXT3_NAME_LEN;
2695 fsid = le64_to_cpup((void *)es->s_uuid) ^ 2725 fsid = le64_to_cpup((void *)es->s_uuid) ^
2696 le64_to_cpup((void *)es->s_uuid + sizeof(u64)); 2726 le64_to_cpup((void *)es->s_uuid + sizeof(u64));
@@ -2835,9 +2865,9 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2835 if (EXT3_SB(sb)->s_qf_names[type]) { 2865 if (EXT3_SB(sb)->s_qf_names[type]) {
2836 /* Quotafile not of fs root? */ 2866 /* Quotafile not of fs root? */
2837 if (path.dentry->d_parent != sb->s_root) 2867 if (path.dentry->d_parent != sb->s_root)
2838 printk(KERN_WARNING 2868 ext3_msg(sb, KERN_WARNING,
2839 "EXT3-fs: Quota file not on filesystem root. " 2869 "warning: Quota file not on filesystem root. "
2840 "Journaled quota will not work.\n"); 2870 "Journaled quota will not work.");
2841 } 2871 }
2842 2872
2843 /* 2873 /*
@@ -2919,8 +2949,9 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
2919 handle_t *handle = journal_current_handle(); 2949 handle_t *handle = journal_current_handle();
2920 2950
2921 if (!handle) { 2951 if (!handle) {
2922 printk(KERN_WARNING "EXT3-fs: Quota write (off=%Lu, len=%Lu)" 2952 ext3_msg(sb, KERN_WARNING,
2923 " cancelled because transaction is not started.\n", 2953 "warning: quota write (off=%llu, len=%llu)"
2954 " cancelled because transaction is not started.",
2924 (unsigned long long)off, (unsigned long long)len); 2955 (unsigned long long)off, (unsigned long long)len);
2925 return -EIO; 2956 return -EIO;
2926 } 2957 }