aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/ext4.h2
-rw-r--r--fs/ext4/super.c462
2 files changed, 235 insertions, 229 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 59657ff7b8f4..cc7d5edc38c9 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1401,6 +1401,8 @@ extern void ext4_abort(struct super_block *, const char *, const char *, ...)
1401 __attribute__ ((format (printf, 3, 4))); 1401 __attribute__ ((format (printf, 3, 4)));
1402extern void ext4_warning(struct super_block *, const char *, const char *, ...) 1402extern void ext4_warning(struct super_block *, const char *, const char *, ...)
1403 __attribute__ ((format (printf, 3, 4))); 1403 __attribute__ ((format (printf, 3, 4)));
1404extern void ext4_msg(struct super_block *, const char *, const char *, ...)
1405 __attribute__ ((format (printf, 3, 4)));
1404extern void ext4_grp_locked_error(struct super_block *, ext4_group_t, 1406extern void ext4_grp_locked_error(struct super_block *, ext4_group_t,
1405 const char *, const char *, ...) 1407 const char *, const char *, ...)
1406 __attribute__ ((format (printf, 4, 5))); 1408 __attribute__ ((format (printf, 4, 5)));
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0a97b1ad3e19..c191d0f65fed 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -306,7 +306,7 @@ static void ext4_handle_error(struct super_block *sb)
306 jbd2_journal_abort(journal, -EIO); 306 jbd2_journal_abort(journal, -EIO);
307 } 307 }
308 if (test_opt(sb, ERRORS_RO)) { 308 if (test_opt(sb, ERRORS_RO)) {
309 printk(KERN_CRIT "Remounting filesystem read-only\n"); 309 ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only");
310 sb->s_flags |= MS_RDONLY; 310 sb->s_flags |= MS_RDONLY;
311 } 311 }
312 ext4_commit_super(sb, 1); 312 ext4_commit_super(sb, 1);
@@ -399,8 +399,6 @@ void ext4_abort(struct super_block *sb, const char *function,
399{ 399{
400 va_list args; 400 va_list args;
401 401
402 printk(KERN_CRIT "ext4_abort called.\n");
403
404 va_start(args, fmt); 402 va_start(args, fmt);
405 printk(KERN_CRIT "EXT4-fs error (device %s): %s: ", sb->s_id, function); 403 printk(KERN_CRIT "EXT4-fs error (device %s): %s: ", sb->s_id, function);
406 vprintk(fmt, args); 404 vprintk(fmt, args);
@@ -413,7 +411,7 @@ void ext4_abort(struct super_block *sb, const char *function,
413 if (sb->s_flags & MS_RDONLY) 411 if (sb->s_flags & MS_RDONLY)
414 return; 412 return;
415 413
416 printk(KERN_CRIT "Remounting filesystem read-only\n"); 414 ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only");
417 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; 415 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
418 sb->s_flags |= MS_RDONLY; 416 sb->s_flags |= MS_RDONLY;
419 EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT; 417 EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT;
@@ -421,6 +419,18 @@ void ext4_abort(struct super_block *sb, const char *function,
421 jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); 419 jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO);
422} 420}
423 421
422void ext4_msg (struct super_block * sb, const char *prefix,
423 const char *fmt, ...)
424{
425 va_list args;
426
427 va_start(args, fmt);
428 printk("%sEXT4-fs (%s): ", prefix, sb->s_id);
429 vprintk(fmt, args);
430 printk("\n");
431 va_end(args);
432}
433
424void ext4_warning(struct super_block *sb, const char *function, 434void ext4_warning(struct super_block *sb, const char *function,
425 const char *fmt, ...) 435 const char *fmt, ...)
426{ 436{
@@ -499,7 +509,7 @@ void ext4_update_dynamic_rev(struct super_block *sb)
499/* 509/*
500 * Open the external journal device 510 * Open the external journal device
501 */ 511 */
502static struct block_device *ext4_blkdev_get(dev_t dev) 512static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb)
503{ 513{
504 struct block_device *bdev; 514 struct block_device *bdev;
505 char b[BDEVNAME_SIZE]; 515 char b[BDEVNAME_SIZE];
@@ -510,7 +520,7 @@ static struct block_device *ext4_blkdev_get(dev_t dev)
510 return bdev; 520 return bdev;
511 521
512fail: 522fail:
513 printk(KERN_ERR "EXT4-fs: failed to open journal device %s: %ld\n", 523 ext4_msg(sb, KERN_ERR, "failed to open journal device %s: %ld",
514 __bdevname(dev, b), PTR_ERR(bdev)); 524 __bdevname(dev, b), PTR_ERR(bdev));
515 return NULL; 525 return NULL;
516} 526}
@@ -546,8 +556,8 @@ static void dump_orphan_list(struct super_block *sb, struct ext4_sb_info *sbi)
546{ 556{
547 struct list_head *l; 557 struct list_head *l;
548 558
549 printk(KERN_ERR "sb orphan head is %d\n", 559 ext4_msg(sb, KERN_ERR, "sb orphan head is %d",
550 le32_to_cpu(sbi->s_es->s_last_orphan)); 560 le32_to_cpu(sbi->s_es->s_last_orphan));
551 561
552 printk(KERN_ERR "sb_info orphan list:\n"); 562 printk(KERN_ERR "sb_info orphan list:\n");
553 list_for_each(l, &sbi->s_orphan) { 563 list_for_each(l, &sbi->s_orphan) {
@@ -678,8 +688,9 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
678static void ext4_destroy_inode(struct inode *inode) 688static void ext4_destroy_inode(struct inode *inode)
679{ 689{
680 if (!list_empty(&(EXT4_I(inode)->i_orphan))) { 690 if (!list_empty(&(EXT4_I(inode)->i_orphan))) {
681 printk("EXT4 Inode %p: orphan list check failed!\n", 691 ext4_msg(inode->i_sb, KERN_ERR,
682 EXT4_I(inode)); 692 "Inode %lu (%p): orphan list check failed!",
693 inode->i_ino, EXT4_I(inode));
683 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, 16, 4, 694 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, 16, 4,
684 EXT4_I(inode), sizeof(struct ext4_inode_info), 695 EXT4_I(inode), sizeof(struct ext4_inode_info),
685 true); 696 true);
@@ -1239,8 +1250,7 @@ static int parse_options(char *options, struct super_block *sb,
1239#else 1250#else
1240 case Opt_user_xattr: 1251 case Opt_user_xattr:
1241 case Opt_nouser_xattr: 1252 case Opt_nouser_xattr:
1242 printk(KERN_ERR "EXT4 (no)user_xattr options " 1253 ext4_msg(sb, KERN_ERR, "(no)user_xattr options not supported");
1243 "not supported\n");
1244 break; 1254 break;
1245#endif 1255#endif
1246#ifdef CONFIG_EXT4_FS_POSIX_ACL 1256#ifdef CONFIG_EXT4_FS_POSIX_ACL
@@ -1253,8 +1263,7 @@ static int parse_options(char *options, struct super_block *sb,
1253#else 1263#else
1254 case Opt_acl: 1264 case Opt_acl:
1255 case Opt_noacl: 1265 case Opt_noacl:
1256 printk(KERN_ERR "EXT4 (no)acl options " 1266 ext4_msg(sb, KERN_ERR, "(no)acl options not supported");
1257 "not supported\n");
1258 break; 1267 break;
1259#endif 1268#endif
1260 case Opt_journal_update: 1269 case Opt_journal_update:
@@ -1264,16 +1273,16 @@ static int parse_options(char *options, struct super_block *sb,
1264 user to specify an existing inode to be the 1273 user to specify an existing inode to be the
1265 journal file. */ 1274 journal file. */
1266 if (is_remount) { 1275 if (is_remount) {
1267 printk(KERN_ERR "EXT4-fs: cannot specify " 1276 ext4_msg(sb, KERN_ERR,
1268 "journal on remount\n"); 1277 "Cannot specify journal on remount");
1269 return 0; 1278 return 0;
1270 } 1279 }
1271 set_opt(sbi->s_mount_opt, UPDATE_JOURNAL); 1280 set_opt(sbi->s_mount_opt, UPDATE_JOURNAL);
1272 break; 1281 break;
1273 case Opt_journal_dev: 1282 case Opt_journal_dev:
1274 if (is_remount) { 1283 if (is_remount) {
1275 printk(KERN_ERR "EXT4-fs: cannot specify " 1284 ext4_msg(sb, KERN_ERR,
1276 "journal on remount\n"); 1285 "Cannot specify journal on remount");
1277 return 0; 1286 return 0;
1278 } 1287 }
1279 if (match_int(&args[0], &option)) 1288 if (match_int(&args[0], &option))
@@ -1327,9 +1336,8 @@ static int parse_options(char *options, struct super_block *sb,
1327 if (is_remount) { 1336 if (is_remount) {
1328 if ((sbi->s_mount_opt & EXT4_MOUNT_DATA_FLAGS) 1337 if ((sbi->s_mount_opt & EXT4_MOUNT_DATA_FLAGS)
1329 != data_opt) { 1338 != data_opt) {
1330 printk(KERN_ERR 1339 ext4_msg(sb, KERN_ERR,
1331 "EXT4-fs: cannot change data " 1340 "Cannot change data mode on remount");
1332 "mode on remount\n");
1333 return 0; 1341 return 0;
1334 } 1342 }
1335 } else { 1343 } else {
@@ -1359,31 +1367,31 @@ static int parse_options(char *options, struct super_block *sb,
1359set_qf_name: 1367set_qf_name:
1360 if (sb_any_quota_loaded(sb) && 1368 if (sb_any_quota_loaded(sb) &&
1361 !sbi->s_qf_names[qtype]) { 1369 !sbi->s_qf_names[qtype]) {
1362 printk(KERN_ERR 1370 ext4_msg(sb, KERN_ERR,
1363 "EXT4-fs: Cannot change journaled " 1371 "Cannot change journaled "
1364 "quota options when quota turned on.\n"); 1372 "quota options when quota turned on");
1365 return 0; 1373 return 0;
1366 } 1374 }
1367 qname = match_strdup(&args[0]); 1375 qname = match_strdup(&args[0]);
1368 if (!qname) { 1376 if (!qname) {
1369 printk(KERN_ERR 1377 ext4_msg(sb, KERN_ERR,
1370 "EXT4-fs: not enough memory for " 1378 "Not enough memory for "
1371 "storing quotafile name.\n"); 1379 "storing quotafile name");
1372 return 0; 1380 return 0;
1373 } 1381 }
1374 if (sbi->s_qf_names[qtype] && 1382 if (sbi->s_qf_names[qtype] &&
1375 strcmp(sbi->s_qf_names[qtype], qname)) { 1383 strcmp(sbi->s_qf_names[qtype], qname)) {
1376 printk(KERN_ERR 1384 ext4_msg(sb, KERN_ERR,
1377 "EXT4-fs: %s quota file already " 1385 "%s quota file already "
1378 "specified.\n", QTYPE2NAME(qtype)); 1386 "specified", QTYPE2NAME(qtype));
1379 kfree(qname); 1387 kfree(qname);
1380 return 0; 1388 return 0;
1381 } 1389 }
1382 sbi->s_qf_names[qtype] = qname; 1390 sbi->s_qf_names[qtype] = qname;
1383 if (strchr(sbi->s_qf_names[qtype], '/')) { 1391 if (strchr(sbi->s_qf_names[qtype], '/')) {
1384 printk(KERN_ERR 1392 ext4_msg(sb, KERN_ERR,
1385 "EXT4-fs: quotafile must be on " 1393 "quotafile must be on "
1386 "filesystem root.\n"); 1394 "filesystem root");
1387 kfree(sbi->s_qf_names[qtype]); 1395 kfree(sbi->s_qf_names[qtype]);
1388 sbi->s_qf_names[qtype] = NULL; 1396 sbi->s_qf_names[qtype] = NULL;
1389 return 0; 1397 return 0;
@@ -1398,9 +1406,9 @@ set_qf_name:
1398clear_qf_name: 1406clear_qf_name:
1399 if (sb_any_quota_loaded(sb) && 1407 if (sb_any_quota_loaded(sb) &&
1400 sbi->s_qf_names[qtype]) { 1408 sbi->s_qf_names[qtype]) {
1401 printk(KERN_ERR "EXT4-fs: Cannot change " 1409 ext4_msg(sb, KERN_ERR, "Cannot change "
1402 "journaled quota options when " 1410 "journaled quota options when "
1403 "quota turned on.\n"); 1411 "quota turned on");
1404 return 0; 1412 return 0;
1405 } 1413 }
1406 /* 1414 /*
@@ -1417,9 +1425,9 @@ clear_qf_name:
1417set_qf_format: 1425set_qf_format:
1418 if (sb_any_quota_loaded(sb) && 1426 if (sb_any_quota_loaded(sb) &&
1419 sbi->s_jquota_fmt != qfmt) { 1427 sbi->s_jquota_fmt != qfmt) {
1420 printk(KERN_ERR "EXT4-fs: Cannot change " 1428 ext4_msg(sb, KERN_ERR, "Cannot change "
1421 "journaled quota options when " 1429 "journaled quota options when "
1422 "quota turned on.\n"); 1430 "quota turned on");
1423 return 0; 1431 return 0;
1424 } 1432 }
1425 sbi->s_jquota_fmt = qfmt; 1433 sbi->s_jquota_fmt = qfmt;
@@ -1435,8 +1443,8 @@ set_qf_format:
1435 break; 1443 break;
1436 case Opt_noquota: 1444 case Opt_noquota:
1437 if (sb_any_quota_loaded(sb)) { 1445 if (sb_any_quota_loaded(sb)) {
1438 printk(KERN_ERR "EXT4-fs: Cannot change quota " 1446 ext4_msg(sb, KERN_ERR, "Cannot change quota "
1439 "options when quota turned on.\n"); 1447 "options when quota turned on");
1440 return 0; 1448 return 0;
1441 } 1449 }
1442 clear_opt(sbi->s_mount_opt, QUOTA); 1450 clear_opt(sbi->s_mount_opt, QUOTA);
@@ -1447,8 +1455,8 @@ set_qf_format:
1447 case Opt_quota: 1455 case Opt_quota:
1448 case Opt_usrquota: 1456 case Opt_usrquota:
1449 case Opt_grpquota: 1457 case Opt_grpquota:
1450 printk(KERN_ERR 1458 ext4_msg(sb, KERN_ERR,
1451 "EXT4-fs: quota options not supported.\n"); 1459 "quota options not supported");
1452 break; 1460 break;
1453 case Opt_usrjquota: 1461 case Opt_usrjquota:
1454 case Opt_grpjquota: 1462 case Opt_grpjquota:
@@ -1456,9 +1464,8 @@ set_qf_format:
1456 case Opt_offgrpjquota: 1464 case Opt_offgrpjquota:
1457 case Opt_jqfmt_vfsold: 1465 case Opt_jqfmt_vfsold:
1458 case Opt_jqfmt_vfsv0: 1466 case Opt_jqfmt_vfsv0:
1459 printk(KERN_ERR 1467 ext4_msg(sb, KERN_ERR,
1460 "EXT4-fs: journaled quota options not " 1468 "journaled quota options not supported");
1461 "supported.\n");
1462 break; 1469 break;
1463 case Opt_noquota: 1470 case Opt_noquota:
1464 break; 1471 break;
@@ -1483,8 +1490,9 @@ set_qf_format:
1483 break; 1490 break;
1484 case Opt_resize: 1491 case Opt_resize:
1485 if (!is_remount) { 1492 if (!is_remount) {
1486 printk("EXT4-fs: resize option only available " 1493 ext4_msg(sb, KERN_ERR,
1487 "for remount\n"); 1494 "resize option only available "
1495 "for remount");
1488 return 0; 1496 return 0;
1489 } 1497 }
1490 if (match_int(&args[0], &option) != 0) 1498 if (match_int(&args[0], &option) != 0)
@@ -1526,8 +1534,9 @@ set_qf_format:
1526 if (option < 0 || option > (1 << 30)) 1534 if (option < 0 || option > (1 << 30))
1527 return 0; 1535 return 0;
1528 if (!is_power_of_2(option)) { 1536 if (!is_power_of_2(option)) {
1529 printk(KERN_ERR "EXT4-fs: inode_readahead_blks" 1537 ext4_msg(sb, KERN_ERR,
1530 " must be a power of 2\n"); 1538 "EXT4-fs: inode_readahead_blks"
1539 " must be a power of 2");
1531 return 0; 1540 return 0;
1532 } 1541 }
1533 sbi->s_inode_readahead_blks = option; 1542 sbi->s_inode_readahead_blks = option;
@@ -1554,9 +1563,9 @@ set_qf_format:
1554 set_opt(sbi->s_mount_opt,NO_AUTO_DA_ALLOC); 1563 set_opt(sbi->s_mount_opt,NO_AUTO_DA_ALLOC);
1555 break; 1564 break;
1556 default: 1565 default:
1557 printk(KERN_ERR 1566 ext4_msg(sb, KERN_ERR,
1558 "EXT4-fs: Unrecognized mount option \"%s\" " 1567 "Unrecognized mount option \"%s\" "
1559 "or missing value\n", p); 1568 "or missing value", p);
1560 return 0; 1569 return 0;
1561 } 1570 }
1562 } 1571 }
@@ -1574,21 +1583,21 @@ set_qf_format:
1574 (sbi->s_mount_opt & EXT4_MOUNT_GRPQUOTA)) || 1583 (sbi->s_mount_opt & EXT4_MOUNT_GRPQUOTA)) ||
1575 (sbi->s_qf_names[GRPQUOTA] && 1584 (sbi->s_qf_names[GRPQUOTA] &&
1576 (sbi->s_mount_opt & EXT4_MOUNT_USRQUOTA))) { 1585 (sbi->s_mount_opt & EXT4_MOUNT_USRQUOTA))) {
1577 printk(KERN_ERR "EXT4-fs: old and new quota " 1586 ext4_msg(sb, KERN_ERR, "old and new quota "
1578 "format mixing.\n"); 1587 "format mixing");
1579 return 0; 1588 return 0;
1580 } 1589 }
1581 1590
1582 if (!sbi->s_jquota_fmt) { 1591 if (!sbi->s_jquota_fmt) {
1583 printk(KERN_ERR "EXT4-fs: journaled quota format " 1592 ext4_msg(sb, KERN_ERR, "journaled quota format "
1584 "not specified.\n"); 1593 "not specified");
1585 return 0; 1594 return 0;
1586 } 1595 }
1587 } else { 1596 } else {
1588 if (sbi->s_jquota_fmt) { 1597 if (sbi->s_jquota_fmt) {
1589 printk(KERN_ERR "EXT4-fs: journaled quota format " 1598 ext4_msg(sb, KERN_ERR, "journaled quota format "
1590 "specified with no journaling " 1599 "specified with no journaling "
1591 "enabled.\n"); 1600 "enabled");
1592 return 0; 1601 return 0;
1593 } 1602 }
1594 } 1603 }
@@ -1603,31 +1612,31 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
1603 int res = 0; 1612 int res = 0;
1604 1613
1605 if (le32_to_cpu(es->s_rev_level) > EXT4_MAX_SUPP_REV) { 1614 if (le32_to_cpu(es->s_rev_level) > EXT4_MAX_SUPP_REV) {
1606 printk(KERN_ERR "EXT4-fs warning: revision level too high, " 1615 ext4_msg(sb, KERN_ERR, "revision level too high, "
1607 "forcing read-only mode\n"); 1616 "forcing read-only mode");
1608 res = MS_RDONLY; 1617 res = MS_RDONLY;
1609 } 1618 }
1610 if (read_only) 1619 if (read_only)
1611 return res; 1620 return res;
1612 if (!(sbi->s_mount_state & EXT4_VALID_FS)) 1621 if (!(sbi->s_mount_state & EXT4_VALID_FS))
1613 printk(KERN_WARNING "EXT4-fs warning: mounting unchecked fs, " 1622 ext4_msg(sb, KERN_WARNING, "warning: mounting unchecked fs, "
1614 "running e2fsck is recommended\n"); 1623 "running e2fsck is recommended");
1615 else if ((sbi->s_mount_state & EXT4_ERROR_FS)) 1624 else if ((sbi->s_mount_state & EXT4_ERROR_FS))
1616 printk(KERN_WARNING 1625 ext4_msg(sb, KERN_WARNING,
1617 "EXT4-fs warning: mounting fs with errors, " 1626 "warning: mounting fs with errors, "
1618 "running e2fsck is recommended\n"); 1627 "running e2fsck is recommended");
1619 else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 && 1628 else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 &&
1620 le16_to_cpu(es->s_mnt_count) >= 1629 le16_to_cpu(es->s_mnt_count) >=
1621 (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count)) 1630 (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count))
1622 printk(KERN_WARNING 1631 ext4_msg(sb, KERN_WARNING,
1623 "EXT4-fs warning: maximal mount count reached, " 1632 "warning: maximal mount count reached, "
1624 "running e2fsck is recommended\n"); 1633 "running e2fsck is recommended");
1625 else if (le32_to_cpu(es->s_checkinterval) && 1634 else if (le32_to_cpu(es->s_checkinterval) &&
1626 (le32_to_cpu(es->s_lastcheck) + 1635 (le32_to_cpu(es->s_lastcheck) +
1627 le32_to_cpu(es->s_checkinterval) <= get_seconds())) 1636 le32_to_cpu(es->s_checkinterval) <= get_seconds()))
1628 printk(KERN_WARNING 1637 ext4_msg(sb, KERN_WARNING,
1629 "EXT4-fs warning: checktime reached, " 1638 "warning: checktime reached, "
1630 "running e2fsck is recommended\n"); 1639 "running e2fsck is recommended");
1631 if (!sbi->s_journal) 1640 if (!sbi->s_journal)
1632 es->s_state &= cpu_to_le16(~EXT4_VALID_FS); 1641 es->s_state &= cpu_to_le16(~EXT4_VALID_FS);
1633 if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) 1642 if (!(__s16) le16_to_cpu(es->s_max_mnt_count))
@@ -1649,11 +1658,11 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
1649 sbi->s_mount_opt); 1658 sbi->s_mount_opt);
1650 1659
1651 if (EXT4_SB(sb)->s_journal) { 1660 if (EXT4_SB(sb)->s_journal) {
1652 printk(KERN_INFO "EXT4 FS on %s, %s journal on %s\n", 1661 ext4_msg(sb, KERN_INFO, "%s journal on %s",
1653 sb->s_id, EXT4_SB(sb)->s_journal->j_inode ? "internal" : 1662 EXT4_SB(sb)->s_journal->j_inode ? "internal" :
1654 "external", EXT4_SB(sb)->s_journal->j_devname); 1663 "external", EXT4_SB(sb)->s_journal->j_devname);
1655 } else { 1664 } else {
1656 printk(KERN_INFO "EXT4 FS on %s, no journal\n", sb->s_id); 1665 ext4_msg(sb, KERN_INFO, "no journal");
1657 } 1666 }
1658 return res; 1667 return res;
1659} 1668}
@@ -1688,8 +1697,8 @@ static int ext4_fill_flex_info(struct super_block *sb)
1688 memset(sbi->s_flex_groups, 0, size); 1697 memset(sbi->s_flex_groups, 0, size);
1689 } 1698 }
1690 if (sbi->s_flex_groups == NULL) { 1699 if (sbi->s_flex_groups == NULL) {
1691 printk(KERN_ERR "EXT4-fs: not enough memory for " 1700 ext4_msg(sb, KERN_ERR, "not enough memory for "
1692 "%u flex groups\n", flex_group_count); 1701 "%u flex groups", flex_group_count);
1693 goto failed; 1702 goto failed;
1694 } 1703 }
1695 1704
@@ -1775,32 +1784,32 @@ static int ext4_check_descriptors(struct super_block *sb)
1775 1784
1776 block_bitmap = ext4_block_bitmap(sb, gdp); 1785 block_bitmap = ext4_block_bitmap(sb, gdp);
1777 if (block_bitmap < first_block || block_bitmap > last_block) { 1786 if (block_bitmap < first_block || block_bitmap > last_block) {
1778 printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: " 1787 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
1779 "Block bitmap for group %u not in group " 1788 "Block bitmap for group %u not in group "
1780 "(block %llu)!\n", i, block_bitmap); 1789 "(block %llu)!", i, block_bitmap);
1781 return 0; 1790 return 0;
1782 } 1791 }
1783 inode_bitmap = ext4_inode_bitmap(sb, gdp); 1792 inode_bitmap = ext4_inode_bitmap(sb, gdp);
1784 if (inode_bitmap < first_block || inode_bitmap > last_block) { 1793 if (inode_bitmap < first_block || inode_bitmap > last_block) {
1785 printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: " 1794 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
1786 "Inode bitmap for group %u not in group " 1795 "Inode bitmap for group %u not in group "
1787 "(block %llu)!\n", i, inode_bitmap); 1796 "(block %llu)!", i, inode_bitmap);
1788 return 0; 1797 return 0;
1789 } 1798 }
1790 inode_table = ext4_inode_table(sb, gdp); 1799 inode_table = ext4_inode_table(sb, gdp);
1791 if (inode_table < first_block || 1800 if (inode_table < first_block ||
1792 inode_table + sbi->s_itb_per_group - 1 > last_block) { 1801 inode_table + sbi->s_itb_per_group - 1 > last_block) {
1793 printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: " 1802 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
1794 "Inode table for group %u not in group " 1803 "Inode table for group %u not in group "
1795 "(block %llu)!\n", i, inode_table); 1804 "(block %llu)!", i, inode_table);
1796 return 0; 1805 return 0;
1797 } 1806 }
1798 ext4_lock_group(sb, i); 1807 ext4_lock_group(sb, i);
1799 if (!ext4_group_desc_csum_verify(sbi, i, gdp)) { 1808 if (!ext4_group_desc_csum_verify(sbi, i, gdp)) {
1800 printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: " 1809 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
1801 "Checksum for group %u failed (%u!=%u)\n", 1810 "Checksum for group %u failed (%u!=%u)",
1802 i, le16_to_cpu(ext4_group_desc_csum(sbi, i, 1811 i, le16_to_cpu(ext4_group_desc_csum(sbi, i,
1803 gdp)), le16_to_cpu(gdp->bg_checksum)); 1812 gdp)), le16_to_cpu(gdp->bg_checksum));
1804 if (!(sb->s_flags & MS_RDONLY)) { 1813 if (!(sb->s_flags & MS_RDONLY)) {
1805 ext4_unlock_group(sb, i); 1814 ext4_unlock_group(sb, i);
1806 return 0; 1815 return 0;
@@ -1847,8 +1856,8 @@ static void ext4_orphan_cleanup(struct super_block *sb,
1847 } 1856 }
1848 1857
1849 if (bdev_read_only(sb->s_bdev)) { 1858 if (bdev_read_only(sb->s_bdev)) {
1850 printk(KERN_ERR "EXT4-fs: write access " 1859 ext4_msg(sb, KERN_ERR, "write access "
1851 "unavailable, skipping orphan cleanup.\n"); 1860 "unavailable, skipping orphan cleanup");
1852 return; 1861 return;
1853 } 1862 }
1854 1863
@@ -1862,8 +1871,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
1862 } 1871 }
1863 1872
1864 if (s_flags & MS_RDONLY) { 1873 if (s_flags & MS_RDONLY) {
1865 printk(KERN_INFO "EXT4-fs: %s: orphan cleanup on readonly fs\n", 1874 ext4_msg(sb, KERN_INFO, "orphan cleanup on readonly fs");
1866 sb->s_id);
1867 sb->s_flags &= ~MS_RDONLY; 1875 sb->s_flags &= ~MS_RDONLY;
1868 } 1876 }
1869#ifdef CONFIG_QUOTA 1877#ifdef CONFIG_QUOTA
@@ -1874,9 +1882,9 @@ static void ext4_orphan_cleanup(struct super_block *sb,
1874 if (EXT4_SB(sb)->s_qf_names[i]) { 1882 if (EXT4_SB(sb)->s_qf_names[i]) {
1875 int ret = ext4_quota_on_mount(sb, i); 1883 int ret = ext4_quota_on_mount(sb, i);
1876 if (ret < 0) 1884 if (ret < 0)
1877 printk(KERN_ERR 1885 ext4_msg(sb, KERN_ERR,
1878 "EXT4-fs: Cannot turn on journaled " 1886 "Cannot turn on journaled "
1879 "quota: error %d\n", ret); 1887 "quota: error %d", ret);
1880 } 1888 }
1881 } 1889 }
1882#endif 1890#endif
@@ -1893,16 +1901,16 @@ static void ext4_orphan_cleanup(struct super_block *sb,
1893 list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan); 1901 list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan);
1894 vfs_dq_init(inode); 1902 vfs_dq_init(inode);
1895 if (inode->i_nlink) { 1903 if (inode->i_nlink) {
1896 printk(KERN_DEBUG 1904 ext4_msg(sb, KERN_DEBUG,
1897 "%s: truncating inode %lu to %lld bytes\n", 1905 "%s: truncating inode %lu to %lld bytes",
1898 __func__, inode->i_ino, inode->i_size); 1906 __func__, inode->i_ino, inode->i_size);
1899 jbd_debug(2, "truncating inode %lu to %lld bytes\n", 1907 jbd_debug(2, "truncating inode %lu to %lld bytes\n",
1900 inode->i_ino, inode->i_size); 1908 inode->i_ino, inode->i_size);
1901 ext4_truncate(inode); 1909 ext4_truncate(inode);
1902 nr_truncates++; 1910 nr_truncates++;
1903 } else { 1911 } else {
1904 printk(KERN_DEBUG 1912 ext4_msg(sb, KERN_DEBUG,
1905 "%s: deleting unreferenced inode %lu\n", 1913 "%s: deleting unreferenced inode %lu",
1906 __func__, inode->i_ino); 1914 __func__, inode->i_ino);
1907 jbd_debug(2, "deleting unreferenced inode %lu\n", 1915 jbd_debug(2, "deleting unreferenced inode %lu\n",
1908 inode->i_ino); 1916 inode->i_ino);
@@ -1914,11 +1922,11 @@ static void ext4_orphan_cleanup(struct super_block *sb,
1914#define PLURAL(x) (x), ((x) == 1) ? "" : "s" 1922#define PLURAL(x) (x), ((x) == 1) ? "" : "s"
1915 1923
1916 if (nr_orphans) 1924 if (nr_orphans)
1917 printk(KERN_INFO "EXT4-fs: %s: %d orphan inode%s deleted\n", 1925 ext4_msg(sb, KERN_INFO, "%d orphan inode%s deleted",
1918 sb->s_id, PLURAL(nr_orphans)); 1926 PLURAL(nr_orphans));
1919 if (nr_truncates) 1927 if (nr_truncates)
1920 printk(KERN_INFO "EXT4-fs: %s: %d truncate%s cleaned up\n", 1928 ext4_msg(sb, KERN_INFO, "%d truncate%s cleaned up",
1921 sb->s_id, PLURAL(nr_truncates)); 1929 PLURAL(nr_truncates));
1922#ifdef CONFIG_QUOTA 1930#ifdef CONFIG_QUOTA
1923 /* Turn quotas off */ 1931 /* Turn quotas off */
1924 for (i = 0; i < MAXQUOTAS; i++) { 1932 for (i = 0; i < MAXQUOTAS; i++) {
@@ -2307,7 +2315,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2307 2315
2308 blocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE); 2316 blocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE);
2309 if (!blocksize) { 2317 if (!blocksize) {
2310 printk(KERN_ERR "EXT4-fs: unable to set blocksize\n"); 2318 ext4_msg(sb, KERN_ERR, "unable to set blocksize");
2311 goto out_fail; 2319 goto out_fail;
2312 } 2320 }
2313 2321
@@ -2323,7 +2331,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2323 } 2331 }
2324 2332
2325 if (!(bh = sb_bread(sb, logical_sb_block))) { 2333 if (!(bh = sb_bread(sb, logical_sb_block))) {
2326 printk(KERN_ERR "EXT4-fs: unable to read superblock\n"); 2334 ext4_msg(sb, KERN_ERR, "unable to read superblock");
2327 goto out_fail; 2335 goto out_fail;
2328 } 2336 }
2329 /* 2337 /*
@@ -2393,9 +2401,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2393 (EXT4_HAS_COMPAT_FEATURE(sb, ~0U) || 2401 (EXT4_HAS_COMPAT_FEATURE(sb, ~0U) ||
2394 EXT4_HAS_RO_COMPAT_FEATURE(sb, ~0U) || 2402 EXT4_HAS_RO_COMPAT_FEATURE(sb, ~0U) ||
2395 EXT4_HAS_INCOMPAT_FEATURE(sb, ~0U))) 2403 EXT4_HAS_INCOMPAT_FEATURE(sb, ~0U)))
2396 printk(KERN_WARNING 2404 ext4_msg(sb, KERN_WARNING,
2397 "EXT4-fs warning: feature flags set on rev 0 fs, " 2405 "feature flags set on rev 0 fs, "
2398 "running e2fsck is recommended\n"); 2406 "running e2fsck is recommended");
2399 2407
2400 /* 2408 /*
2401 * Check feature flags regardless of the revision level, since we 2409 * Check feature flags regardless of the revision level, since we
@@ -2404,16 +2412,18 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2404 */ 2412 */
2405 features = EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT4_FEATURE_INCOMPAT_SUPP); 2413 features = EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT4_FEATURE_INCOMPAT_SUPP);
2406 if (features) { 2414 if (features) {
2407 printk(KERN_ERR "EXT4-fs: %s: couldn't mount because of " 2415 ext4_msg(sb, KERN_ERR,
2408 "unsupported optional features (%x).\n", sb->s_id, 2416 "Couldn't mount because of "
2417 "unsupported optional features (%x)",
2409 (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_incompat) & 2418 (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_incompat) &
2410 ~EXT4_FEATURE_INCOMPAT_SUPP)); 2419 ~EXT4_FEATURE_INCOMPAT_SUPP));
2411 goto failed_mount; 2420 goto failed_mount;
2412 } 2421 }
2413 features = EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT4_FEATURE_RO_COMPAT_SUPP); 2422 features = EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT4_FEATURE_RO_COMPAT_SUPP);
2414 if (!(sb->s_flags & MS_RDONLY) && features) { 2423 if (!(sb->s_flags & MS_RDONLY) && features) {
2415 printk(KERN_ERR "EXT4-fs: %s: couldn't mount RDWR because of " 2424 ext4_msg(sb, KERN_ERR,
2416 "unsupported optional features (%x).\n", sb->s_id, 2425 "Couldn't mount RDWR because of "
2426 "unsupported optional features (%x)",
2417 (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_ro_compat) & 2427 (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_ro_compat) &
2418 ~EXT4_FEATURE_RO_COMPAT_SUPP)); 2428 ~EXT4_FEATURE_RO_COMPAT_SUPP));
2419 goto failed_mount; 2429 goto failed_mount;
@@ -2427,9 +2437,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2427 */ 2437 */
2428 if (sizeof(root->i_blocks) < sizeof(u64) && 2438 if (sizeof(root->i_blocks) < sizeof(u64) &&
2429 !(sb->s_flags & MS_RDONLY)) { 2439 !(sb->s_flags & MS_RDONLY)) {
2430 printk(KERN_ERR "EXT4-fs: %s: Filesystem with huge " 2440 ext4_msg(sb, KERN_ERR, "Filesystem with huge "
2431 "files cannot be mounted read-write " 2441 "files cannot be mounted read-write "
2432 "without CONFIG_LBD.\n", sb->s_id); 2442 "without CONFIG_LBD");
2433 goto failed_mount; 2443 goto failed_mount;
2434 } 2444 }
2435 } 2445 }
@@ -2437,16 +2447,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2437 2447
2438 if (blocksize < EXT4_MIN_BLOCK_SIZE || 2448 if (blocksize < EXT4_MIN_BLOCK_SIZE ||
2439 blocksize > EXT4_MAX_BLOCK_SIZE) { 2449 blocksize > EXT4_MAX_BLOCK_SIZE) {
2440 printk(KERN_ERR 2450 ext4_msg(sb, KERN_ERR,
2441 "EXT4-fs: Unsupported filesystem blocksize %d on %s.\n", 2451 "Unsupported filesystem blocksize %d", blocksize);
2442 blocksize, sb->s_id);
2443 goto failed_mount; 2452 goto failed_mount;
2444 } 2453 }
2445 2454
2446 if (sb->s_blocksize != blocksize) { 2455 if (sb->s_blocksize != blocksize) {
2447 /* Validate the filesystem blocksize */ 2456 /* Validate the filesystem blocksize */
2448 if (!sb_set_blocksize(sb, blocksize)) { 2457 if (!sb_set_blocksize(sb, blocksize)) {
2449 printk(KERN_ERR "EXT4-fs: bad block size %d.\n", 2458 ext4_msg(sb, KERN_ERR, "bad block size %d",
2450 blocksize); 2459 blocksize);
2451 goto failed_mount; 2460 goto failed_mount;
2452 } 2461 }
@@ -2456,15 +2465,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2456 offset = do_div(logical_sb_block, blocksize); 2465 offset = do_div(logical_sb_block, blocksize);
2457 bh = sb_bread(sb, logical_sb_block); 2466 bh = sb_bread(sb, logical_sb_block);
2458 if (!bh) { 2467 if (!bh) {
2459 printk(KERN_ERR 2468 ext4_msg(sb, KERN_ERR,
2460 "EXT4-fs: Can't read superblock on 2nd try.\n"); 2469 "Can't read superblock on 2nd try");
2461 goto failed_mount; 2470 goto failed_mount;
2462 } 2471 }
2463 es = (struct ext4_super_block *)(((char *)bh->b_data) + offset); 2472 es = (struct ext4_super_block *)(((char *)bh->b_data) + offset);
2464 sbi->s_es = es; 2473 sbi->s_es = es;
2465 if (es->s_magic != cpu_to_le16(EXT4_SUPER_MAGIC)) { 2474 if (es->s_magic != cpu_to_le16(EXT4_SUPER_MAGIC)) {
2466 printk(KERN_ERR 2475 ext4_msg(sb, KERN_ERR,
2467 "EXT4-fs: Magic mismatch, very weird !\n"); 2476 "Magic mismatch, very weird!");
2468 goto failed_mount; 2477 goto failed_mount;
2469 } 2478 }
2470 } 2479 }
@@ -2482,8 +2491,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2482 if ((sbi->s_inode_size < EXT4_GOOD_OLD_INODE_SIZE) || 2491 if ((sbi->s_inode_size < EXT4_GOOD_OLD_INODE_SIZE) ||
2483 (!is_power_of_2(sbi->s_inode_size)) || 2492 (!is_power_of_2(sbi->s_inode_size)) ||
2484 (sbi->s_inode_size > blocksize)) { 2493 (sbi->s_inode_size > blocksize)) {
2485 printk(KERN_ERR 2494 ext4_msg(sb, KERN_ERR,
2486 "EXT4-fs: unsupported inode size: %d\n", 2495 "unsupported inode size: %d",
2487 sbi->s_inode_size); 2496 sbi->s_inode_size);
2488 goto failed_mount; 2497 goto failed_mount;
2489 } 2498 }
@@ -2496,8 +2505,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2496 if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT || 2505 if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||
2497 sbi->s_desc_size > EXT4_MAX_DESC_SIZE || 2506 sbi->s_desc_size > EXT4_MAX_DESC_SIZE ||
2498 !is_power_of_2(sbi->s_desc_size)) { 2507 !is_power_of_2(sbi->s_desc_size)) {
2499 printk(KERN_ERR 2508 ext4_msg(sb, KERN_ERR,
2500 "EXT4-fs: unsupported descriptor size %lu\n", 2509 "unsupported descriptor size %lu",
2501 sbi->s_desc_size); 2510 sbi->s_desc_size);
2502 goto failed_mount; 2511 goto failed_mount;
2503 } 2512 }
@@ -2537,25 +2546,24 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2537 } 2546 }
2538 2547
2539 if (sbi->s_blocks_per_group > blocksize * 8) { 2548 if (sbi->s_blocks_per_group > blocksize * 8) {
2540 printk(KERN_ERR 2549 ext4_msg(sb, KERN_ERR,
2541 "EXT4-fs: #blocks per group too big: %lu\n", 2550 "#blocks per group too big: %lu",
2542 sbi->s_blocks_per_group); 2551 sbi->s_blocks_per_group);
2543 goto failed_mount; 2552 goto failed_mount;
2544 } 2553 }
2545 if (sbi->s_inodes_per_group > blocksize * 8) { 2554 if (sbi->s_inodes_per_group > blocksize * 8) {
2546 printk(KERN_ERR 2555 ext4_msg(sb, KERN_ERR,
2547 "EXT4-fs: #inodes per group too big: %lu\n", 2556 "#inodes per group too big: %lu",
2548 sbi->s_inodes_per_group); 2557 sbi->s_inodes_per_group);
2549 goto failed_mount; 2558 goto failed_mount;
2550 } 2559 }
2551 2560
2552 if (ext4_blocks_count(es) > 2561 if (ext4_blocks_count(es) >
2553 (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) { 2562 (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) {
2554 printk(KERN_ERR "EXT4-fs: filesystem on %s:" 2563 ext4_msg(sb, KERN_ERR, "filesystem"
2555 " too large to mount safely\n", sb->s_id); 2564 " too large to mount safely");
2556 if (sizeof(sector_t) < 8) 2565 if (sizeof(sector_t) < 8)
2557 printk(KERN_WARNING "EXT4-fs: CONFIG_LBD not " 2566 ext4_msg(sb, KERN_WARNING, "CONFIG_LBD not enabled");
2558 "enabled\n");
2559 goto failed_mount; 2567 goto failed_mount;
2560 } 2568 }
2561 2569
@@ -2565,8 +2573,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2565 /* check blocks count against device size */ 2573 /* check blocks count against device size */
2566 blocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits; 2574 blocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;
2567 if (blocks_count && ext4_blocks_count(es) > blocks_count) { 2575 if (blocks_count && ext4_blocks_count(es) > blocks_count) {
2568 printk(KERN_WARNING "EXT4-fs: bad geometry: block count %llu " 2576 ext4_msg(sb, KERN_WARNING, "bad geometry: block count %llu "
2569 "exceeds size of device (%llu blocks)\n", 2577 "exceeds size of device (%llu blocks)",
2570 ext4_blocks_count(es), blocks_count); 2578 ext4_blocks_count(es), blocks_count);
2571 goto failed_mount; 2579 goto failed_mount;
2572 } 2580 }
@@ -2576,10 +2584,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2576 * of the filesystem. 2584 * of the filesystem.
2577 */ 2585 */
2578 if (le32_to_cpu(es->s_first_data_block) >= ext4_blocks_count(es)) { 2586 if (le32_to_cpu(es->s_first_data_block) >= ext4_blocks_count(es)) {
2579 printk(KERN_WARNING "EXT4-fs: bad geometry: first data" 2587 ext4_msg(sb, KERN_WARNING, "bad geometry: first data"
2580 "block %u is beyond end of filesystem (%llu)\n", 2588 "block %u is beyond end of filesystem (%llu)",
2581 le32_to_cpu(es->s_first_data_block), 2589 le32_to_cpu(es->s_first_data_block),
2582 ext4_blocks_count(es)); 2590 ext4_blocks_count(es));
2583 goto failed_mount; 2591 goto failed_mount;
2584 } 2592 }
2585 blocks_count = (ext4_blocks_count(es) - 2593 blocks_count = (ext4_blocks_count(es) -
@@ -2587,9 +2595,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2587 EXT4_BLOCKS_PER_GROUP(sb) - 1); 2595 EXT4_BLOCKS_PER_GROUP(sb) - 1);
2588 do_div(blocks_count, EXT4_BLOCKS_PER_GROUP(sb)); 2596 do_div(blocks_count, EXT4_BLOCKS_PER_GROUP(sb));
2589 if (blocks_count > ((uint64_t)1<<32) - EXT4_DESC_PER_BLOCK(sb)) { 2597 if (blocks_count > ((uint64_t)1<<32) - EXT4_DESC_PER_BLOCK(sb)) {
2590 printk(KERN_WARNING "EXT4-fs: groups count too large: %u " 2598 ext4_msg(sb, KERN_WARNING, "groups count too large: %u "
2591 "(block count %llu, first data block %u, " 2599 "(block count %llu, first data block %u, "
2592 "blocks per group %lu)\n", sbi->s_groups_count, 2600 "blocks per group %lu)", sbi->s_groups_count,
2593 ext4_blocks_count(es), 2601 ext4_blocks_count(es),
2594 le32_to_cpu(es->s_first_data_block), 2602 le32_to_cpu(es->s_first_data_block),
2595 EXT4_BLOCKS_PER_GROUP(sb)); 2603 EXT4_BLOCKS_PER_GROUP(sb));
@@ -2601,7 +2609,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2601 sbi->s_group_desc = kmalloc(db_count * sizeof(struct buffer_head *), 2609 sbi->s_group_desc = kmalloc(db_count * sizeof(struct buffer_head *),
2602 GFP_KERNEL); 2610 GFP_KERNEL);
2603 if (sbi->s_group_desc == NULL) { 2611 if (sbi->s_group_desc == NULL) {
2604 printk(KERN_ERR "EXT4-fs: not enough memory\n"); 2612 ext4_msg(sb, KERN_ERR, "not enough memory");
2605 goto failed_mount; 2613 goto failed_mount;
2606 } 2614 }
2607 2615
@@ -2616,21 +2624,21 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2616 block = descriptor_loc(sb, logical_sb_block, i); 2624 block = descriptor_loc(sb, logical_sb_block, i);
2617 sbi->s_group_desc[i] = sb_bread(sb, block); 2625 sbi->s_group_desc[i] = sb_bread(sb, block);
2618 if (!sbi->s_group_desc[i]) { 2626 if (!sbi->s_group_desc[i]) {
2619 printk(KERN_ERR "EXT4-fs: " 2627 ext4_msg(sb, KERN_ERR,
2620 "can't read group descriptor %d\n", i); 2628 "can't read group descriptor %d", i);
2621 db_count = i; 2629 db_count = i;
2622 goto failed_mount2; 2630 goto failed_mount2;
2623 } 2631 }
2624 } 2632 }
2625 if (!ext4_check_descriptors(sb)) { 2633 if (!ext4_check_descriptors(sb)) {
2626 printk(KERN_ERR "EXT4-fs: group descriptors corrupted!\n"); 2634 ext4_msg(sb, KERN_ERR, "group descriptors corrupted!");
2627 goto failed_mount2; 2635 goto failed_mount2;
2628 } 2636 }
2629 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) 2637 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG))
2630 if (!ext4_fill_flex_info(sb)) { 2638 if (!ext4_fill_flex_info(sb)) {
2631 printk(KERN_ERR 2639 ext4_msg(sb, KERN_ERR,
2632 "EXT4-fs: unable to initialize " 2640 "unable to initialize "
2633 "flex_bg meta info!\n"); 2641 "flex_bg meta info!");
2634 goto failed_mount2; 2642 goto failed_mount2;
2635 } 2643 }
2636 2644
@@ -2652,7 +2660,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2652 err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0); 2660 err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0);
2653 } 2661 }
2654 if (err) { 2662 if (err) {
2655 printk(KERN_ERR "EXT4-fs: insufficient memory\n"); 2663 ext4_msg(sb, KERN_ERR, "insufficient memory");
2656 goto failed_mount3; 2664 goto failed_mount3;
2657 } 2665 }
2658 2666
@@ -2692,13 +2700,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2692 goto failed_mount3; 2700 goto failed_mount3;
2693 if (!(sb->s_flags & MS_RDONLY) && 2701 if (!(sb->s_flags & MS_RDONLY) &&
2694 EXT4_SB(sb)->s_journal->j_failed_commit) { 2702 EXT4_SB(sb)->s_journal->j_failed_commit) {
2695 printk(KERN_CRIT "EXT4-fs error (device %s): " 2703 ext4_msg(sb, KERN_CRIT, "error: "
2696 "ext4_fill_super: Journal transaction " 2704 "ext4_fill_super: Journal transaction "
2697 "%u is corrupt\n", sb->s_id, 2705 "%u is corrupt",
2698 EXT4_SB(sb)->s_journal->j_failed_commit); 2706 EXT4_SB(sb)->s_journal->j_failed_commit);
2699 if (test_opt(sb, ERRORS_RO)) { 2707 if (test_opt(sb, ERRORS_RO)) {
2700 printk(KERN_CRIT 2708 ext4_msg(sb, KERN_CRIT,
2701 "Mounting filesystem read-only\n"); 2709 "Mounting filesystem read-only");
2702 sb->s_flags |= MS_RDONLY; 2710 sb->s_flags |= MS_RDONLY;
2703 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; 2711 EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
2704 es->s_state |= cpu_to_le16(EXT4_ERROR_FS); 2712 es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
@@ -2712,8 +2720,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2712 } 2720 }
2713 } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && 2721 } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) &&
2714 EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { 2722 EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) {
2715 printk(KERN_ERR "EXT4-fs: required journal recovery " 2723 ext4_msg(sb, KERN_ERR, "required journal recovery "
2716 "suppressed and not mounted read-only\n"); 2724 "suppressed and not mounted read-only");
2717 goto failed_mount4; 2725 goto failed_mount4;
2718 } else { 2726 } else {
2719 clear_opt(sbi->s_mount_opt, DATA_FLAGS); 2727 clear_opt(sbi->s_mount_opt, DATA_FLAGS);
@@ -2726,7 +2734,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2726 if (ext4_blocks_count(es) > 0xffffffffULL && 2734 if (ext4_blocks_count(es) > 0xffffffffULL &&
2727 !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0, 2735 !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0,
2728 JBD2_FEATURE_INCOMPAT_64BIT)) { 2736 JBD2_FEATURE_INCOMPAT_64BIT)) {
2729 printk(KERN_ERR "EXT4-fs: Failed to set 64-bit journal feature\n"); 2737 ext4_msg(sb, KERN_ERR, "Failed to set 64-bit journal feature");
2730 goto failed_mount4; 2738 goto failed_mount4;
2731 } 2739 }
2732 2740
@@ -2764,8 +2772,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2764 case EXT4_MOUNT_WRITEBACK_DATA: 2772 case EXT4_MOUNT_WRITEBACK_DATA:
2765 if (!jbd2_journal_check_available_features 2773 if (!jbd2_journal_check_available_features
2766 (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)) { 2774 (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)) {
2767 printk(KERN_ERR "EXT4-fs: Journal does not support " 2775 ext4_msg(sb, KERN_ERR, "Journal does not support "
2768 "requested data journaling mode\n"); 2776 "requested data journaling mode");
2769 goto failed_mount4; 2777 goto failed_mount4;
2770 } 2778 }
2771 default: 2779 default:
@@ -2777,8 +2785,8 @@ no_journal:
2777 2785
2778 if (test_opt(sb, NOBH)) { 2786 if (test_opt(sb, NOBH)) {
2779 if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) { 2787 if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) {
2780 printk(KERN_WARNING "EXT4-fs: Ignoring nobh option - " 2788 ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - "
2781 "its supported only with writeback mode\n"); 2789 "its supported only with writeback mode");
2782 clear_opt(sbi->s_mount_opt, NOBH); 2790 clear_opt(sbi->s_mount_opt, NOBH);
2783 } 2791 }
2784 } 2792 }
@@ -2789,18 +2797,18 @@ no_journal:
2789 2797
2790 root = ext4_iget(sb, EXT4_ROOT_INO); 2798 root = ext4_iget(sb, EXT4_ROOT_INO);
2791 if (IS_ERR(root)) { 2799 if (IS_ERR(root)) {
2792 printk(KERN_ERR "EXT4-fs: get root inode failed\n"); 2800 ext4_msg(sb, KERN_ERR, "get root inode failed");
2793 ret = PTR_ERR(root); 2801 ret = PTR_ERR(root);
2794 goto failed_mount4; 2802 goto failed_mount4;
2795 } 2803 }
2796 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 2804 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
2797 iput(root); 2805 iput(root);
2798 printk(KERN_ERR "EXT4-fs: corrupt root inode, run e2fsck\n"); 2806 ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck");
2799 goto failed_mount4; 2807 goto failed_mount4;
2800 } 2808 }
2801 sb->s_root = d_alloc_root(root); 2809 sb->s_root = d_alloc_root(root);
2802 if (!sb->s_root) { 2810 if (!sb->s_root) {
2803 printk(KERN_ERR "EXT4-fs: get root dentry failed\n"); 2811 ext4_msg(sb, KERN_ERR, "get root dentry failed");
2804 iput(root); 2812 iput(root);
2805 ret = -ENOMEM; 2813 ret = -ENOMEM;
2806 goto failed_mount4; 2814 goto failed_mount4;
@@ -2829,29 +2837,29 @@ no_journal:
2829 sbi->s_inode_size) { 2837 sbi->s_inode_size) {
2830 sbi->s_want_extra_isize = sizeof(struct ext4_inode) - 2838 sbi->s_want_extra_isize = sizeof(struct ext4_inode) -
2831 EXT4_GOOD_OLD_INODE_SIZE; 2839 EXT4_GOOD_OLD_INODE_SIZE;
2832 printk(KERN_INFO "EXT4-fs: required extra inode space not" 2840 ext4_msg(sb, KERN_INFO, "required extra inode space not"
2833 "available.\n"); 2841 "available");
2834 } 2842 }
2835 2843
2836 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { 2844 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
2837 printk(KERN_WARNING "EXT4-fs: Ignoring delalloc option - " 2845 ext4_msg(sb, KERN_WARNING, "Ignoring delalloc option - "
2838 "requested data journaling mode\n"); 2846 "requested data journaling mode");
2839 clear_opt(sbi->s_mount_opt, DELALLOC); 2847 clear_opt(sbi->s_mount_opt, DELALLOC);
2840 } else if (test_opt(sb, DELALLOC)) 2848 } else if (test_opt(sb, DELALLOC))
2841 printk(KERN_INFO "EXT4-fs: delayed allocation enabled\n"); 2849 ext4_msg(sb, KERN_INFO, "delayed allocation enabled");
2842 2850
2843 err = ext4_setup_system_zone(sb); 2851 err = ext4_setup_system_zone(sb);
2844 if (err) { 2852 if (err) {
2845 printk(KERN_ERR "EXT4-fs: failed to initialize system " 2853 ext4_msg(sb, KERN_ERR, "failed to initialize system "
2846 "zone (%d)\n", err); 2854 "zone (%d)\n", err);
2847 goto failed_mount4; 2855 goto failed_mount4;
2848 } 2856 }
2849 2857
2850 ext4_ext_init(sb); 2858 ext4_ext_init(sb);
2851 err = ext4_mb_init(sb, needs_recovery); 2859 err = ext4_mb_init(sb, needs_recovery);
2852 if (err) { 2860 if (err) {
2853 printk(KERN_ERR "EXT4-fs: failed to initalize mballoc (%d)\n", 2861 ext4_msg(sb, KERN_ERR, "failed to initalize mballoc (%d)",
2854 err); 2862 err);
2855 goto failed_mount4; 2863 goto failed_mount4;
2856 } 2864 }
2857 2865
@@ -2869,7 +2877,7 @@ no_journal:
2869 ext4_orphan_cleanup(sb, es); 2877 ext4_orphan_cleanup(sb, es);
2870 EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS; 2878 EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;
2871 if (needs_recovery) { 2879 if (needs_recovery) {
2872 printk(KERN_INFO "EXT4-fs: recovery complete.\n"); 2880 ext4_msg(sb, KERN_INFO, "recovery complete");
2873 ext4_mark_recovery_complete(sb, es); 2881 ext4_mark_recovery_complete(sb, es);
2874 } 2882 }
2875 if (EXT4_SB(sb)->s_journal) { 2883 if (EXT4_SB(sb)->s_journal) {
@@ -2882,20 +2890,18 @@ no_journal:
2882 } else 2890 } else
2883 descr = "out journal"; 2891 descr = "out journal";
2884 2892
2885 printk(KERN_INFO "EXT4-fs: mounted filesystem %s with%s\n", 2893 ext4_msg(sb, KERN_INFO, "mounted filesystem with%s", descr);
2886 sb->s_id, descr);
2887 2894
2888 lock_kernel(); 2895 lock_kernel();
2889 return 0; 2896 return 0;
2890 2897
2891cantfind_ext4: 2898cantfind_ext4:
2892 if (!silent) 2899 if (!silent)
2893 printk(KERN_ERR "VFS: Can't find ext4 filesystem on dev %s.\n", 2900 ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem");
2894 sb->s_id);
2895 goto failed_mount; 2901 goto failed_mount;
2896 2902
2897failed_mount4: 2903failed_mount4:
2898 printk(KERN_ERR "EXT4-fs (device %s): mount failed\n", sb->s_id); 2904 ext4_msg(sb, KERN_ERR, "mount failed");
2899 ext4_release_system_zone(sb); 2905 ext4_release_system_zone(sb);
2900 if (sbi->s_journal) { 2906 if (sbi->s_journal) {
2901 jbd2_journal_destroy(sbi->s_journal); 2907 jbd2_journal_destroy(sbi->s_journal);
@@ -2973,27 +2979,27 @@ static journal_t *ext4_get_journal(struct super_block *sb,
2973 2979
2974 journal_inode = ext4_iget(sb, journal_inum); 2980 journal_inode = ext4_iget(sb, journal_inum);
2975 if (IS_ERR(journal_inode)) { 2981 if (IS_ERR(journal_inode)) {
2976 printk(KERN_ERR "EXT4-fs: no journal found.\n"); 2982 ext4_msg(sb, KERN_ERR, "no journal found");
2977 return NULL; 2983 return NULL;
2978 } 2984 }
2979 if (!journal_inode->i_nlink) { 2985 if (!journal_inode->i_nlink) {
2980 make_bad_inode(journal_inode); 2986 make_bad_inode(journal_inode);
2981 iput(journal_inode); 2987 iput(journal_inode);
2982 printk(KERN_ERR "EXT4-fs: journal inode is deleted.\n"); 2988 ext4_msg(sb, KERN_ERR, "journal inode is deleted");
2983 return NULL; 2989 return NULL;
2984 } 2990 }
2985 2991
2986 jbd_debug(2, "Journal inode found at %p: %lld bytes\n", 2992 jbd_debug(2, "Journal inode found at %p: %lld bytes\n",
2987 journal_inode, journal_inode->i_size); 2993 journal_inode, journal_inode->i_size);
2988 if (!S_ISREG(journal_inode->i_mode)) { 2994 if (!S_ISREG(journal_inode->i_mode)) {
2989 printk(KERN_ERR "EXT4-fs: invalid journal inode.\n"); 2995 ext4_msg(sb, KERN_ERR, "invalid journal inode");
2990 iput(journal_inode); 2996 iput(journal_inode);
2991 return NULL; 2997 return NULL;
2992 } 2998 }
2993 2999
2994 journal = jbd2_journal_init_inode(journal_inode); 3000 journal = jbd2_journal_init_inode(journal_inode);
2995 if (!journal) { 3001 if (!journal) {
2996 printk(KERN_ERR "EXT4-fs: Could not load journal inode\n"); 3002 ext4_msg(sb, KERN_ERR, "Could not load journal inode");
2997 iput(journal_inode); 3003 iput(journal_inode);
2998 return NULL; 3004 return NULL;
2999 } 3005 }
@@ -3017,13 +3023,13 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
3017 3023
3018 BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)); 3024 BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL));
3019 3025
3020 bdev = ext4_blkdev_get(j_dev); 3026 bdev = ext4_blkdev_get(j_dev, sb);
3021 if (bdev == NULL) 3027 if (bdev == NULL)
3022 return NULL; 3028 return NULL;
3023 3029
3024 if (bd_claim(bdev, sb)) { 3030 if (bd_claim(bdev, sb)) {
3025 printk(KERN_ERR 3031 ext4_msg(sb, KERN_ERR,
3026 "EXT4-fs: failed to claim external journal device.\n"); 3032 "failed to claim external journal device");
3027 blkdev_put(bdev, FMODE_READ|FMODE_WRITE); 3033 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
3028 return NULL; 3034 return NULL;
3029 } 3035 }
@@ -3031,8 +3037,8 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
3031 blocksize = sb->s_blocksize; 3037 blocksize = sb->s_blocksize;
3032 hblock = bdev_hardsect_size(bdev); 3038 hblock = bdev_hardsect_size(bdev);
3033 if (blocksize < hblock) { 3039 if (blocksize < hblock) {
3034 printk(KERN_ERR 3040 ext4_msg(sb, KERN_ERR,
3035 "EXT4-fs: blocksize too small for journal device.\n"); 3041 "blocksize too small for journal device");
3036 goto out_bdev; 3042 goto out_bdev;
3037 } 3043 }
3038 3044
@@ -3040,8 +3046,8 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
3040 offset = EXT4_MIN_BLOCK_SIZE % blocksize; 3046 offset = EXT4_MIN_BLOCK_SIZE % blocksize;
3041 set_blocksize(bdev, blocksize); 3047 set_blocksize(bdev, blocksize);
3042 if (!(bh = __bread(bdev, sb_block, blocksize))) { 3048 if (!(bh = __bread(bdev, sb_block, blocksize))) {
3043 printk(KERN_ERR "EXT4-fs: couldn't read superblock of " 3049 ext4_msg(sb, KERN_ERR, "couldn't read superblock of "
3044 "external journal\n"); 3050 "external journal");
3045 goto out_bdev; 3051 goto out_bdev;
3046 } 3052 }
3047 3053
@@ -3049,14 +3055,14 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
3049 if ((le16_to_cpu(es->s_magic) != EXT4_SUPER_MAGIC) || 3055 if ((le16_to_cpu(es->s_magic) != EXT4_SUPER_MAGIC) ||
3050 !(le32_to_cpu(es->s_feature_incompat) & 3056 !(le32_to_cpu(es->s_feature_incompat) &
3051 EXT4_FEATURE_INCOMPAT_JOURNAL_DEV)) { 3057 EXT4_FEATURE_INCOMPAT_JOURNAL_DEV)) {
3052 printk(KERN_ERR "EXT4-fs: external journal has " 3058 ext4_msg(sb, KERN_ERR, "external journal has "
3053 "bad superblock\n"); 3059 "bad superblock");
3054 brelse(bh); 3060 brelse(bh);
3055 goto out_bdev; 3061 goto out_bdev;
3056 } 3062 }
3057 3063
3058 if (memcmp(EXT4_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) { 3064 if (memcmp(EXT4_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) {
3059 printk(KERN_ERR "EXT4-fs: journal UUID does not match\n"); 3065 ext4_msg(sb, KERN_ERR, "journal UUID does not match");
3060 brelse(bh); 3066 brelse(bh);
3061 goto out_bdev; 3067 goto out_bdev;
3062 } 3068 }
@@ -3068,19 +3074,19 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
3068 journal = jbd2_journal_init_dev(bdev, sb->s_bdev, 3074 journal = jbd2_journal_init_dev(bdev, sb->s_bdev,
3069 start, len, blocksize); 3075 start, len, blocksize);
3070 if (!journal) { 3076 if (!journal) {
3071 printk(KERN_ERR "EXT4-fs: failed to create device journal\n"); 3077 ext4_msg(sb, KERN_ERR, "failed to create device journal");
3072 goto out_bdev; 3078 goto out_bdev;
3073 } 3079 }
3074 journal->j_private = sb; 3080 journal->j_private = sb;
3075 ll_rw_block(READ, 1, &journal->j_sb_buffer); 3081 ll_rw_block(READ, 1, &journal->j_sb_buffer);
3076 wait_on_buffer(journal->j_sb_buffer); 3082 wait_on_buffer(journal->j_sb_buffer);
3077 if (!buffer_uptodate(journal->j_sb_buffer)) { 3083 if (!buffer_uptodate(journal->j_sb_buffer)) {
3078 printk(KERN_ERR "EXT4-fs: I/O error on journal device\n"); 3084 ext4_msg(sb, KERN_ERR, "I/O error on journal device");
3079 goto out_journal; 3085 goto out_journal;
3080 } 3086 }
3081 if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { 3087 if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
3082 printk(KERN_ERR "EXT4-fs: External journal has more than one " 3088 ext4_msg(sb, KERN_ERR, "External journal has more than one "
3083 "user (unsupported) - %d\n", 3089 "user (unsupported) - %d",
3084 be32_to_cpu(journal->j_superblock->s_nr_users)); 3090 be32_to_cpu(journal->j_superblock->s_nr_users));
3085 goto out_journal; 3091 goto out_journal;
3086 } 3092 }
@@ -3109,8 +3115,8 @@ static int ext4_load_journal(struct super_block *sb,
3109 3115
3110 if (journal_devnum && 3116 if (journal_devnum &&
3111 journal_devnum != le32_to_cpu(es->s_journal_dev)) { 3117 journal_devnum != le32_to_cpu(es->s_journal_dev)) {
3112 printk(KERN_INFO "EXT4-fs: external journal device major/minor " 3118 ext4_msg(sb, KERN_INFO, "external journal device major/minor "
3113 "numbers have changed\n"); 3119 "numbers have changed");
3114 journal_dev = new_decode_dev(journal_devnum); 3120 journal_dev = new_decode_dev(journal_devnum);
3115 } else 3121 } else
3116 journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev)); 3122 journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev));
@@ -3124,21 +3130,21 @@ static int ext4_load_journal(struct super_block *sb,
3124 */ 3130 */
3125 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { 3131 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) {
3126 if (sb->s_flags & MS_RDONLY) { 3132 if (sb->s_flags & MS_RDONLY) {
3127 printk(KERN_INFO "EXT4-fs: INFO: recovery " 3133 ext4_msg(sb, KERN_INFO, "INFO: recovery "
3128 "required on readonly filesystem.\n"); 3134 "required on readonly filesystem");
3129 if (really_read_only) { 3135 if (really_read_only) {
3130 printk(KERN_ERR "EXT4-fs: write access " 3136 ext4_msg(sb, KERN_ERR, "write access "
3131 "unavailable, cannot proceed.\n"); 3137 "unavailable, cannot proceed");
3132 return -EROFS; 3138 return -EROFS;
3133 } 3139 }
3134 printk(KERN_INFO "EXT4-fs: write access will " 3140 ext4_msg(sb, KERN_INFO, "write access will "
3135 "be enabled during recovery.\n"); 3141 "be enabled during recovery");
3136 } 3142 }
3137 } 3143 }
3138 3144
3139 if (journal_inum && journal_dev) { 3145 if (journal_inum && journal_dev) {
3140 printk(KERN_ERR "EXT4-fs: filesystem has both journal " 3146 ext4_msg(sb, KERN_ERR, "filesystem has both journal "
3141 "and inode journals!\n"); 3147 "and inode journals!");
3142 return -EINVAL; 3148 return -EINVAL;
3143 } 3149 }
3144 3150
@@ -3151,14 +3157,14 @@ static int ext4_load_journal(struct super_block *sb,
3151 } 3157 }
3152 3158
3153 if (journal->j_flags & JBD2_BARRIER) 3159 if (journal->j_flags & JBD2_BARRIER)
3154 printk(KERN_INFO "EXT4-fs: barriers enabled\n"); 3160 ext4_msg(sb, KERN_INFO, "barriers enabled");
3155 else 3161 else
3156 printk(KERN_INFO "EXT4-fs: barriers disabled\n"); 3162 ext4_msg(sb, KERN_INFO, "barriers disabled");
3157 3163
3158 if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) { 3164 if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) {
3159 err = jbd2_journal_update_format(journal); 3165 err = jbd2_journal_update_format(journal);
3160 if (err) { 3166 if (err) {
3161 printk(KERN_ERR "EXT4-fs: error updating journal.\n"); 3167 ext4_msg(sb, KERN_ERR, "error updating journal");
3162 jbd2_journal_destroy(journal); 3168 jbd2_journal_destroy(journal);
3163 return err; 3169 return err;
3164 } 3170 }
@@ -3170,7 +3176,7 @@ static int ext4_load_journal(struct super_block *sb,
3170 err = jbd2_journal_load(journal); 3176 err = jbd2_journal_load(journal);
3171 3177
3172 if (err) { 3178 if (err) {
3173 printk(KERN_ERR "EXT4-fs: error loading journal.\n"); 3179 ext4_msg(sb, KERN_ERR, "error loading journal");
3174 jbd2_journal_destroy(journal); 3180 jbd2_journal_destroy(journal);
3175 return err; 3181 return err;
3176 } 3182 }
@@ -3206,8 +3212,8 @@ static int ext4_commit_super(struct super_block *sb, int sync)
3206 * be remapped. Nothing we can do but to retry the 3212 * be remapped. Nothing we can do but to retry the
3207 * write and hope for the best. 3213 * write and hope for the best.
3208 */ 3214 */
3209 printk(KERN_ERR "EXT4-fs: previous I/O error to " 3215 ext4_msg(sb, KERN_ERR, "previous I/O error to "
3210 "superblock detected for %s.\n", sb->s_id); 3216 "superblock detected");
3211 clear_buffer_write_io_error(sbh); 3217 clear_buffer_write_io_error(sbh);
3212 set_buffer_uptodate(sbh); 3218 set_buffer_uptodate(sbh);
3213 } 3219 }
@@ -3230,8 +3236,8 @@ static int ext4_commit_super(struct super_block *sb, int sync)
3230 3236
3231 error = buffer_write_io_error(sbh); 3237 error = buffer_write_io_error(sbh);
3232 if (error) { 3238 if (error) {
3233 printk(KERN_ERR "EXT4-fs: I/O error while writing " 3239 ext4_msg(sb, KERN_ERR, "I/O error while writing "
3234 "superblock for %s.\n", sb->s_id); 3240 "superblock");
3235 clear_buffer_write_io_error(sbh); 3241 clear_buffer_write_io_error(sbh);
3236 set_buffer_uptodate(sbh); 3242 set_buffer_uptodate(sbh);
3237 } 3243 }
@@ -3478,9 +3484,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
3478 int ret; 3484 int ret;
3479 if ((ret = EXT4_HAS_RO_COMPAT_FEATURE(sb, 3485 if ((ret = EXT4_HAS_RO_COMPAT_FEATURE(sb,
3480 ~EXT4_FEATURE_RO_COMPAT_SUPP))) { 3486 ~EXT4_FEATURE_RO_COMPAT_SUPP))) {
3481 printk(KERN_WARNING "EXT4-fs: %s: couldn't " 3487 ext4_msg(sb, KERN_WARNING, "couldn't "
3482 "remount RDWR because of unsupported " 3488 "remount RDWR because of unsupported "
3483 "optional features (%x).\n", sb->s_id, 3489 "optional features (%x)",
3484 (le32_to_cpu(sbi->s_es->s_feature_ro_compat) & 3490 (le32_to_cpu(sbi->s_es->s_feature_ro_compat) &
3485 ~EXT4_FEATURE_RO_COMPAT_SUPP)); 3491 ~EXT4_FEATURE_RO_COMPAT_SUPP));
3486 err = -EROFS; 3492 err = -EROFS;
@@ -3496,9 +3502,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
3496 ext4_get_group_desc(sb, g, NULL); 3502 ext4_get_group_desc(sb, g, NULL);
3497 3503
3498 if (!ext4_group_desc_csum_verify(sbi, g, gdp)) { 3504 if (!ext4_group_desc_csum_verify(sbi, g, gdp)) {
3499 printk(KERN_ERR 3505 ext4_msg(sb, KERN_ERR,
3500 "EXT4-fs: ext4_remount: " 3506 "ext4_remount: Checksum for group %u failed (%u!=%u)",
3501 "Checksum for group %u failed (%u!=%u)\n",
3502 g, le16_to_cpu(ext4_group_desc_csum(sbi, g, gdp)), 3507 g, le16_to_cpu(ext4_group_desc_csum(sbi, g, gdp)),
3503 le16_to_cpu(gdp->bg_checksum)); 3508 le16_to_cpu(gdp->bg_checksum));
3504 err = -EINVAL; 3509 err = -EINVAL;
@@ -3512,11 +3517,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
3512 * require a full umount/remount for now. 3517 * require a full umount/remount for now.
3513 */ 3518 */
3514 if (es->s_last_orphan) { 3519 if (es->s_last_orphan) {
3515 printk(KERN_WARNING "EXT4-fs: %s: couldn't " 3520 ext4_msg(sb, KERN_WARNING, "Couldn't "
3516 "remount RDWR because of unprocessed " 3521 "remount RDWR because of unprocessed "
3517 "orphan inode list. Please " 3522 "orphan inode list. Please "
3518 "umount/remount instead.\n", 3523 "umount/remount instead");
3519 sb->s_id);
3520 err = -EINVAL; 3524 err = -EINVAL;
3521 goto restore_opts; 3525 goto restore_opts;
3522 } 3526 }
@@ -3772,9 +3776,9 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
3772 if (EXT4_SB(sb)->s_qf_names[type]) { 3776 if (EXT4_SB(sb)->s_qf_names[type]) {
3773 /* Quotafile not in fs root? */ 3777 /* Quotafile not in fs root? */
3774 if (path.dentry->d_parent != sb->s_root) 3778 if (path.dentry->d_parent != sb->s_root)
3775 printk(KERN_WARNING 3779 ext4_msg(sb, KERN_WARNING,
3776 "EXT4-fs: Quota file not on filesystem root. " 3780 "Quota file not on filesystem root. "
3777 "Journaled quota will not work.\n"); 3781 "Journaled quota will not work");
3778 } 3782 }
3779 3783
3780 /* 3784 /*
@@ -3857,8 +3861,8 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
3857 handle_t *handle = journal_current_handle(); 3861 handle_t *handle = journal_current_handle();
3858 3862
3859 if (EXT4_SB(sb)->s_journal && !handle) { 3863 if (EXT4_SB(sb)->s_journal && !handle) {
3860 printk(KERN_WARNING "EXT4-fs: Quota write (off=%llu, len=%llu)" 3864 ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)"
3861 " cancelled because transaction is not started.\n", 3865 " cancelled because transaction is not started",
3862 (unsigned long long)off, (unsigned long long)len); 3866 (unsigned long long)off, (unsigned long long)len);
3863 return -EIO; 3867 return -EIO;
3864 } 3868 }
@@ -3930,10 +3934,10 @@ static struct file_system_type ext4_fs_type = {
3930static int ext4dev_get_sb(struct file_system_type *fs_type, int flags, 3934static int ext4dev_get_sb(struct file_system_type *fs_type, int flags,
3931 const char *dev_name, void *data,struct vfsmount *mnt) 3935 const char *dev_name, void *data,struct vfsmount *mnt)
3932{ 3936{
3933 printk(KERN_WARNING "EXT4-fs: Update your userspace programs " 3937 printk(KERN_WARNING "EXT4-fs (%s): Update your userspace programs "
3934 "to mount using ext4\n"); 3938 "to mount using ext4\n", dev_name);
3935 printk(KERN_WARNING "EXT4-fs: ext4dev backwards compatibility " 3939 printk(KERN_WARNING "EXT4-fs (%s): ext4dev backwards compatibility "
3936 "will go away by 2.6.31\n"); 3940 "will go away by 2.6.31\n", dev_name);
3937 return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt); 3941 return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt);
3938} 3942}
3939 3943