diff options
Diffstat (limited to 'fs/ext2')
-rw-r--r-- | fs/ext2/dir.c | 4 | ||||
-rw-r--r-- | fs/ext2/ext2.h | 2 | ||||
-rw-r--r-- | fs/ext2/inode.c | 6 | ||||
-rw-r--r-- | fs/ext2/super.c | 184 | ||||
-rw-r--r-- | fs/ext2/xip.c | 5 |
5 files changed, 119 insertions, 82 deletions
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 6cde970b0a1a..fc2bd05d3559 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c | |||
@@ -353,8 +353,8 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir) | |||
353 | * ext2_find_entry() | 353 | * ext2_find_entry() |
354 | * | 354 | * |
355 | * finds an entry in the specified directory with the wanted name. It | 355 | * finds an entry in the specified directory with the wanted name. It |
356 | * returns the page in which the entry was found, and the entry itself | 356 | * returns the page in which the entry was found (as a parameter - res_page), |
357 | * (as a parameter - res_dir). Page is returned mapped and unlocked. | 357 | * and the entry itself. Page is returned mapped and unlocked. |
358 | * Entry is guaranteed to be valid. | 358 | * Entry is guaranteed to be valid. |
359 | */ | 359 | */ |
360 | struct ext2_dir_entry_2 *ext2_find_entry (struct inode * dir, | 360 | struct ext2_dir_entry_2 *ext2_find_entry (struct inode * dir, |
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index 9a8a8e27a063..da318b0fa637 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h | |||
@@ -142,7 +142,7 @@ struct dentry *ext2_get_parent(struct dentry *child); | |||
142 | /* super.c */ | 142 | /* super.c */ |
143 | extern void ext2_error (struct super_block *, const char *, const char *, ...) | 143 | extern void ext2_error (struct super_block *, const char *, const char *, ...) |
144 | __attribute__ ((format (printf, 3, 4))); | 144 | __attribute__ ((format (printf, 3, 4))); |
145 | extern void ext2_warning (struct super_block *, const char *, const char *, ...) | 145 | extern void ext2_msg(struct super_block *, const char *, const char *, ...) |
146 | __attribute__ ((format (printf, 3, 4))); | 146 | __attribute__ ((format (printf, 3, 4))); |
147 | extern void ext2_update_dynamic_rev (struct super_block *sb); | 147 | extern void ext2_update_dynamic_rev (struct super_block *sb); |
148 | extern void ext2_write_super (struct super_block *); | 148 | extern void ext2_write_super (struct super_block *); |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index ade634076d0a..71b032c65a02 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -137,7 +137,8 @@ static int ext2_block_to_path(struct inode *inode, | |||
137 | int final = 0; | 137 | int final = 0; |
138 | 138 | ||
139 | if (i_block < 0) { | 139 | if (i_block < 0) { |
140 | ext2_warning (inode->i_sb, "ext2_block_to_path", "block < 0"); | 140 | ext2_msg(inode->i_sb, KERN_WARNING, |
141 | "warning: %s: block < 0", __func__); | ||
141 | } else if (i_block < direct_blocks) { | 142 | } else if (i_block < direct_blocks) { |
142 | offsets[n++] = i_block; | 143 | offsets[n++] = i_block; |
143 | final = direct_blocks; | 144 | final = direct_blocks; |
@@ -157,7 +158,8 @@ static int ext2_block_to_path(struct inode *inode, | |||
157 | offsets[n++] = i_block & (ptrs - 1); | 158 | offsets[n++] = i_block & (ptrs - 1); |
158 | final = ptrs; | 159 | final = ptrs; |
159 | } else { | 160 | } else { |
160 | ext2_warning (inode->i_sb, "ext2_block_to_path", "block > big"); | 161 | ext2_msg(inode->i_sb, KERN_WARNING, |
162 | "warning: %s: block is too big", __func__); | ||
161 | } | 163 | } |
162 | if (boundary) | 164 | if (boundary) |
163 | *boundary = final - 1 - (i_block & (ptrs - 1)); | 165 | *boundary = final - 1 - (i_block & (ptrs - 1)); |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 1a9ffee47d56..1388802b7803 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -58,27 +58,27 @@ void ext2_error (struct super_block * sb, const char * function, | |||
58 | } | 58 | } |
59 | 59 | ||
60 | va_start(args, fmt); | 60 | va_start(args, fmt); |
61 | printk(KERN_CRIT "EXT2-fs error (device %s): %s: ",sb->s_id, function); | 61 | printk(KERN_CRIT "EXT2-fs (%s): error: %s: ", sb->s_id, function); |
62 | vprintk(fmt, args); | 62 | vprintk(fmt, args); |
63 | printk("\n"); | 63 | printk("\n"); |
64 | va_end(args); | 64 | va_end(args); |
65 | 65 | ||
66 | if (test_opt(sb, ERRORS_PANIC)) | 66 | if (test_opt(sb, ERRORS_PANIC)) |
67 | panic("EXT2-fs panic from previous error\n"); | 67 | panic("EXT2-fs: panic from previous error\n"); |
68 | if (test_opt(sb, ERRORS_RO)) { | 68 | if (test_opt(sb, ERRORS_RO)) { |
69 | printk("Remounting filesystem read-only\n"); | 69 | ext2_msg(sb, KERN_CRIT, |
70 | "error: remounting filesystem read-only"); | ||
70 | sb->s_flags |= MS_RDONLY; | 71 | sb->s_flags |= MS_RDONLY; |
71 | } | 72 | } |
72 | } | 73 | } |
73 | 74 | ||
74 | void ext2_warning (struct super_block * sb, const char * function, | 75 | void ext2_msg(struct super_block *sb, const char *prefix, |
75 | const char * fmt, ...) | 76 | const char *fmt, ...) |
76 | { | 77 | { |
77 | va_list args; | 78 | va_list args; |
78 | 79 | ||
79 | va_start(args, fmt); | 80 | va_start(args, fmt); |
80 | printk(KERN_WARNING "EXT2-fs warning (device %s): %s: ", | 81 | printk("%sEXT2-fs (%s): ", prefix, sb->s_id); |
81 | sb->s_id, function); | ||
82 | vprintk(fmt, args); | 82 | vprintk(fmt, args); |
83 | printk("\n"); | 83 | printk("\n"); |
84 | va_end(args); | 84 | va_end(args); |
@@ -91,9 +91,9 @@ void ext2_update_dynamic_rev(struct super_block *sb) | |||
91 | if (le32_to_cpu(es->s_rev_level) > EXT2_GOOD_OLD_REV) | 91 | if (le32_to_cpu(es->s_rev_level) > EXT2_GOOD_OLD_REV) |
92 | return; | 92 | return; |
93 | 93 | ||
94 | ext2_warning(sb, __func__, | 94 | ext2_msg(sb, KERN_WARNING, |
95 | "updating to rev %d because of new feature flag, " | 95 | "warning: updating to rev %d because of " |
96 | "running e2fsck is recommended", | 96 | "new feature flag, running e2fsck is recommended", |
97 | EXT2_DYNAMIC_REV); | 97 | EXT2_DYNAMIC_REV); |
98 | 98 | ||
99 | es->s_first_ino = cpu_to_le32(EXT2_GOOD_OLD_FIRST_INO); | 99 | es->s_first_ino = cpu_to_le32(EXT2_GOOD_OLD_FIRST_INO); |
@@ -419,10 +419,10 @@ static const match_table_t tokens = { | |||
419 | {Opt_err, NULL} | 419 | {Opt_err, NULL} |
420 | }; | 420 | }; |
421 | 421 | ||
422 | static int parse_options (char * options, | 422 | static int parse_options(char *options, struct super_block *sb) |
423 | struct ext2_sb_info *sbi) | ||
424 | { | 423 | { |
425 | char * p; | 424 | char *p; |
425 | struct ext2_sb_info *sbi = EXT2_SB(sb); | ||
426 | substring_t args[MAX_OPT_ARGS]; | 426 | substring_t args[MAX_OPT_ARGS]; |
427 | int option; | 427 | int option; |
428 | 428 | ||
@@ -505,7 +505,8 @@ static int parse_options (char * options, | |||
505 | #else | 505 | #else |
506 | case Opt_user_xattr: | 506 | case Opt_user_xattr: |
507 | case Opt_nouser_xattr: | 507 | case Opt_nouser_xattr: |
508 | printk("EXT2 (no)user_xattr options not supported\n"); | 508 | ext2_msg(sb, KERN_INFO, "(no)user_xattr options" |
509 | "not supported"); | ||
509 | break; | 510 | break; |
510 | #endif | 511 | #endif |
511 | #ifdef CONFIG_EXT2_FS_POSIX_ACL | 512 | #ifdef CONFIG_EXT2_FS_POSIX_ACL |
@@ -518,14 +519,15 @@ static int parse_options (char * options, | |||
518 | #else | 519 | #else |
519 | case Opt_acl: | 520 | case Opt_acl: |
520 | case Opt_noacl: | 521 | case Opt_noacl: |
521 | printk("EXT2 (no)acl options not supported\n"); | 522 | ext2_msg(sb, KERN_INFO, |
523 | "(no)acl options not supported"); | ||
522 | break; | 524 | break; |
523 | #endif | 525 | #endif |
524 | case Opt_xip: | 526 | case Opt_xip: |
525 | #ifdef CONFIG_EXT2_FS_XIP | 527 | #ifdef CONFIG_EXT2_FS_XIP |
526 | set_opt (sbi->s_mount_opt, XIP); | 528 | set_opt (sbi->s_mount_opt, XIP); |
527 | #else | 529 | #else |
528 | printk("EXT2 xip option not supported\n"); | 530 | ext2_msg(sb, KERN_INFO, "xip option not supported"); |
529 | #endif | 531 | #endif |
530 | break; | 532 | break; |
531 | 533 | ||
@@ -542,19 +544,18 @@ static int parse_options (char * options, | |||
542 | case Opt_quota: | 544 | case Opt_quota: |
543 | case Opt_usrquota: | 545 | case Opt_usrquota: |
544 | case Opt_grpquota: | 546 | case Opt_grpquota: |
545 | printk(KERN_ERR | 547 | ext2_msg(sb, KERN_INFO, |
546 | "EXT2-fs: quota operations not supported.\n"); | 548 | "quota operations not supported"); |
547 | |||
548 | break; | 549 | break; |
549 | #endif | 550 | #endif |
550 | 551 | ||
551 | case Opt_reservation: | 552 | case Opt_reservation: |
552 | set_opt(sbi->s_mount_opt, RESERVATION); | 553 | set_opt(sbi->s_mount_opt, RESERVATION); |
553 | printk("reservations ON\n"); | 554 | ext2_msg(sb, KERN_INFO, "reservations ON"); |
554 | break; | 555 | break; |
555 | case Opt_noreservation: | 556 | case Opt_noreservation: |
556 | clear_opt(sbi->s_mount_opt, RESERVATION); | 557 | clear_opt(sbi->s_mount_opt, RESERVATION); |
557 | printk("reservations OFF\n"); | 558 | ext2_msg(sb, KERN_INFO, "reservations OFF"); |
558 | break; | 559 | break; |
559 | case Opt_ignore: | 560 | case Opt_ignore: |
560 | break; | 561 | break; |
@@ -573,34 +574,40 @@ static int ext2_setup_super (struct super_block * sb, | |||
573 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 574 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
574 | 575 | ||
575 | if (le32_to_cpu(es->s_rev_level) > EXT2_MAX_SUPP_REV) { | 576 | if (le32_to_cpu(es->s_rev_level) > EXT2_MAX_SUPP_REV) { |
576 | printk ("EXT2-fs warning: revision level too high, " | 577 | ext2_msg(sb, KERN_ERR, |
577 | "forcing read-only mode\n"); | 578 | "error: revision level too high, " |
579 | "forcing read-only mode"); | ||
578 | res = MS_RDONLY; | 580 | res = MS_RDONLY; |
579 | } | 581 | } |
580 | if (read_only) | 582 | if (read_only) |
581 | return res; | 583 | return res; |
582 | if (!(sbi->s_mount_state & EXT2_VALID_FS)) | 584 | if (!(sbi->s_mount_state & EXT2_VALID_FS)) |
583 | printk ("EXT2-fs warning: mounting unchecked fs, " | 585 | ext2_msg(sb, KERN_WARNING, |
584 | "running e2fsck is recommended\n"); | 586 | "warning: mounting unchecked fs, " |
587 | "running e2fsck is recommended"); | ||
585 | else if ((sbi->s_mount_state & EXT2_ERROR_FS)) | 588 | else if ((sbi->s_mount_state & EXT2_ERROR_FS)) |
586 | printk ("EXT2-fs warning: mounting fs with errors, " | 589 | ext2_msg(sb, KERN_WARNING, |
587 | "running e2fsck is recommended\n"); | 590 | "warning: mounting fs with errors, " |
591 | "running e2fsck is recommended"); | ||
588 | else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 && | 592 | else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 && |
589 | le16_to_cpu(es->s_mnt_count) >= | 593 | le16_to_cpu(es->s_mnt_count) >= |
590 | (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count)) | 594 | (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count)) |
591 | printk ("EXT2-fs warning: maximal mount count reached, " | 595 | ext2_msg(sb, KERN_WARNING, |
592 | "running e2fsck is recommended\n"); | 596 | "warning: maximal mount count reached, " |
597 | "running e2fsck is recommended"); | ||
593 | else if (le32_to_cpu(es->s_checkinterval) && | 598 | else if (le32_to_cpu(es->s_checkinterval) && |
594 | (le32_to_cpu(es->s_lastcheck) + le32_to_cpu(es->s_checkinterval) <= get_seconds())) | 599 | (le32_to_cpu(es->s_lastcheck) + |
595 | printk ("EXT2-fs warning: checktime reached, " | 600 | le32_to_cpu(es->s_checkinterval) <= get_seconds())) |
596 | "running e2fsck is recommended\n"); | 601 | ext2_msg(sb, KERN_WARNING, |
602 | "warning: checktime reached, " | ||
603 | "running e2fsck is recommended"); | ||
597 | if (!le16_to_cpu(es->s_max_mnt_count)) | 604 | if (!le16_to_cpu(es->s_max_mnt_count)) |
598 | es->s_max_mnt_count = cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT); | 605 | es->s_max_mnt_count = cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT); |
599 | le16_add_cpu(&es->s_mnt_count, 1); | 606 | le16_add_cpu(&es->s_mnt_count, 1); |
600 | ext2_write_super(sb); | 607 | ext2_write_super(sb); |
601 | if (test_opt (sb, DEBUG)) | 608 | if (test_opt (sb, DEBUG)) |
602 | printk ("[EXT II FS %s, %s, bs=%lu, fs=%lu, gc=%lu, " | 609 | ext2_msg(sb, KERN_INFO, "%s, %s, bs=%lu, fs=%lu, gc=%lu, " |
603 | "bpg=%lu, ipg=%lu, mo=%04lx]\n", | 610 | "bpg=%lu, ipg=%lu, mo=%04lx]", |
604 | EXT2FS_VERSION, EXT2FS_DATE, sb->s_blocksize, | 611 | EXT2FS_VERSION, EXT2FS_DATE, sb->s_blocksize, |
605 | sbi->s_frag_size, | 612 | sbi->s_frag_size, |
606 | sbi->s_groups_count, | 613 | sbi->s_groups_count, |
@@ -767,7 +774,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
767 | */ | 774 | */ |
768 | blocksize = sb_min_blocksize(sb, BLOCK_SIZE); | 775 | blocksize = sb_min_blocksize(sb, BLOCK_SIZE); |
769 | if (!blocksize) { | 776 | if (!blocksize) { |
770 | printk ("EXT2-fs: unable to set blocksize\n"); | 777 | ext2_msg(sb, KERN_ERR, "error: unable to set blocksize"); |
771 | goto failed_sbi; | 778 | goto failed_sbi; |
772 | } | 779 | } |
773 | 780 | ||
@@ -783,7 +790,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
783 | } | 790 | } |
784 | 791 | ||
785 | if (!(bh = sb_bread(sb, logic_sb_block))) { | 792 | if (!(bh = sb_bread(sb, logic_sb_block))) { |
786 | printk ("EXT2-fs: unable to read superblock\n"); | 793 | ext2_msg(sb, KERN_ERR, "error: unable to read superblock"); |
787 | goto failed_sbi; | 794 | goto failed_sbi; |
788 | } | 795 | } |
789 | /* | 796 | /* |
@@ -826,7 +833,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
826 | 833 | ||
827 | set_opt(sbi->s_mount_opt, RESERVATION); | 834 | set_opt(sbi->s_mount_opt, RESERVATION); |
828 | 835 | ||
829 | if (!parse_options ((char *) data, sbi)) | 836 | if (!parse_options((char *) data, sb)) |
830 | goto failed_mount; | 837 | goto failed_mount; |
831 | 838 | ||
832 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 839 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
@@ -840,8 +847,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
840 | (EXT2_HAS_COMPAT_FEATURE(sb, ~0U) || | 847 | (EXT2_HAS_COMPAT_FEATURE(sb, ~0U) || |
841 | EXT2_HAS_RO_COMPAT_FEATURE(sb, ~0U) || | 848 | EXT2_HAS_RO_COMPAT_FEATURE(sb, ~0U) || |
842 | EXT2_HAS_INCOMPAT_FEATURE(sb, ~0U))) | 849 | EXT2_HAS_INCOMPAT_FEATURE(sb, ~0U))) |
843 | printk("EXT2-fs warning: feature flags set on rev 0 fs, " | 850 | ext2_msg(sb, KERN_WARNING, |
844 | "running e2fsck is recommended\n"); | 851 | "warning: feature flags set on rev 0 fs, " |
852 | "running e2fsck is recommended"); | ||
845 | /* | 853 | /* |
846 | * Check feature flags regardless of the revision level, since we | 854 | * Check feature flags regardless of the revision level, since we |
847 | * previously didn't change the revision level when setting the flags, | 855 | * previously didn't change the revision level when setting the flags, |
@@ -849,16 +857,16 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
849 | */ | 857 | */ |
850 | features = EXT2_HAS_INCOMPAT_FEATURE(sb, ~EXT2_FEATURE_INCOMPAT_SUPP); | 858 | features = EXT2_HAS_INCOMPAT_FEATURE(sb, ~EXT2_FEATURE_INCOMPAT_SUPP); |
851 | if (features) { | 859 | if (features) { |
852 | printk("EXT2-fs: %s: couldn't mount because of " | 860 | ext2_msg(sb, KERN_ERR, "error: couldn't mount because of " |
853 | "unsupported optional features (%x).\n", | 861 | "unsupported optional features (%x)", |
854 | sb->s_id, le32_to_cpu(features)); | 862 | le32_to_cpu(features)); |
855 | goto failed_mount; | 863 | goto failed_mount; |
856 | } | 864 | } |
857 | if (!(sb->s_flags & MS_RDONLY) && | 865 | if (!(sb->s_flags & MS_RDONLY) && |
858 | (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ | 866 | (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ |
859 | printk("EXT2-fs: %s: couldn't mount RDWR because of " | 867 | ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of " |
860 | "unsupported optional features (%x).\n", | 868 | "unsupported optional features (%x)", |
861 | sb->s_id, le32_to_cpu(features)); | 869 | le32_to_cpu(features)); |
862 | goto failed_mount; | 870 | goto failed_mount; |
863 | } | 871 | } |
864 | 872 | ||
@@ -866,7 +874,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
866 | 874 | ||
867 | if (ext2_use_xip(sb) && blocksize != PAGE_SIZE) { | 875 | if (ext2_use_xip(sb) && blocksize != PAGE_SIZE) { |
868 | if (!silent) | 876 | if (!silent) |
869 | printk("XIP: Unsupported blocksize\n"); | 877 | ext2_msg(sb, KERN_ERR, |
878 | "error: unsupported blocksize for xip"); | ||
870 | goto failed_mount; | 879 | goto failed_mount; |
871 | } | 880 | } |
872 | 881 | ||
@@ -875,7 +884,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
875 | brelse(bh); | 884 | brelse(bh); |
876 | 885 | ||
877 | if (!sb_set_blocksize(sb, blocksize)) { | 886 | if (!sb_set_blocksize(sb, blocksize)) { |
878 | printk(KERN_ERR "EXT2-fs: blocksize too small for device.\n"); | 887 | ext2_msg(sb, KERN_ERR, "error: blocksize is too small"); |
879 | goto failed_sbi; | 888 | goto failed_sbi; |
880 | } | 889 | } |
881 | 890 | ||
@@ -883,14 +892,14 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
883 | offset = (sb_block*BLOCK_SIZE) % blocksize; | 892 | offset = (sb_block*BLOCK_SIZE) % blocksize; |
884 | bh = sb_bread(sb, logic_sb_block); | 893 | bh = sb_bread(sb, logic_sb_block); |
885 | if(!bh) { | 894 | if(!bh) { |
886 | printk("EXT2-fs: Couldn't read superblock on " | 895 | ext2_msg(sb, KERN_ERR, "error: couldn't read" |
887 | "2nd try.\n"); | 896 | "superblock on 2nd try"); |
888 | goto failed_sbi; | 897 | goto failed_sbi; |
889 | } | 898 | } |
890 | es = (struct ext2_super_block *) (((char *)bh->b_data) + offset); | 899 | es = (struct ext2_super_block *) (((char *)bh->b_data) + offset); |
891 | sbi->s_es = es; | 900 | sbi->s_es = es; |
892 | if (es->s_magic != cpu_to_le16(EXT2_SUPER_MAGIC)) { | 901 | if (es->s_magic != cpu_to_le16(EXT2_SUPER_MAGIC)) { |
893 | printk ("EXT2-fs: Magic mismatch, very weird !\n"); | 902 | ext2_msg(sb, KERN_ERR, "error: magic mismatch"); |
894 | goto failed_mount; | 903 | goto failed_mount; |
895 | } | 904 | } |
896 | } | 905 | } |
@@ -906,7 +915,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
906 | if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) || | 915 | if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) || |
907 | !is_power_of_2(sbi->s_inode_size) || | 916 | !is_power_of_2(sbi->s_inode_size) || |
908 | (sbi->s_inode_size > blocksize)) { | 917 | (sbi->s_inode_size > blocksize)) { |
909 | printk ("EXT2-fs: unsupported inode size: %d\n", | 918 | ext2_msg(sb, KERN_ERR, |
919 | "error: unsupported inode size: %d", | ||
910 | sbi->s_inode_size); | 920 | sbi->s_inode_size); |
911 | goto failed_mount; | 921 | goto failed_mount; |
912 | } | 922 | } |
@@ -943,29 +953,33 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
943 | 953 | ||
944 | if (sb->s_blocksize != bh->b_size) { | 954 | if (sb->s_blocksize != bh->b_size) { |
945 | if (!silent) | 955 | if (!silent) |
946 | printk ("VFS: Unsupported blocksize on dev " | 956 | ext2_msg(sb, KERN_ERR, "error: unsupported blocksize"); |
947 | "%s.\n", sb->s_id); | ||
948 | goto failed_mount; | 957 | goto failed_mount; |
949 | } | 958 | } |
950 | 959 | ||
951 | if (sb->s_blocksize != sbi->s_frag_size) { | 960 | if (sb->s_blocksize != sbi->s_frag_size) { |
952 | printk ("EXT2-fs: fragsize %lu != blocksize %lu (not supported yet)\n", | 961 | ext2_msg(sb, KERN_ERR, |
962 | "error: fragsize %lu != blocksize %lu" | ||
963 | "(not supported yet)", | ||
953 | sbi->s_frag_size, sb->s_blocksize); | 964 | sbi->s_frag_size, sb->s_blocksize); |
954 | goto failed_mount; | 965 | goto failed_mount; |
955 | } | 966 | } |
956 | 967 | ||
957 | if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { | 968 | if (sbi->s_blocks_per_group > sb->s_blocksize * 8) { |
958 | printk ("EXT2-fs: #blocks per group too big: %lu\n", | 969 | ext2_msg(sb, KERN_ERR, |
970 | "error: #blocks per group too big: %lu", | ||
959 | sbi->s_blocks_per_group); | 971 | sbi->s_blocks_per_group); |
960 | goto failed_mount; | 972 | goto failed_mount; |
961 | } | 973 | } |
962 | if (sbi->s_frags_per_group > sb->s_blocksize * 8) { | 974 | if (sbi->s_frags_per_group > sb->s_blocksize * 8) { |
963 | printk ("EXT2-fs: #fragments per group too big: %lu\n", | 975 | ext2_msg(sb, KERN_ERR, |
976 | "error: #fragments per group too big: %lu", | ||
964 | sbi->s_frags_per_group); | 977 | sbi->s_frags_per_group); |
965 | goto failed_mount; | 978 | goto failed_mount; |
966 | } | 979 | } |
967 | if (sbi->s_inodes_per_group > sb->s_blocksize * 8) { | 980 | if (sbi->s_inodes_per_group > sb->s_blocksize * 8) { |
968 | printk ("EXT2-fs: #inodes per group too big: %lu\n", | 981 | ext2_msg(sb, KERN_ERR, |
982 | "error: #inodes per group too big: %lu", | ||
969 | sbi->s_inodes_per_group); | 983 | sbi->s_inodes_per_group); |
970 | goto failed_mount; | 984 | goto failed_mount; |
971 | } | 985 | } |
@@ -979,13 +993,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
979 | EXT2_DESC_PER_BLOCK(sb); | 993 | EXT2_DESC_PER_BLOCK(sb); |
980 | sbi->s_group_desc = kmalloc (db_count * sizeof (struct buffer_head *), GFP_KERNEL); | 994 | sbi->s_group_desc = kmalloc (db_count * sizeof (struct buffer_head *), GFP_KERNEL); |
981 | if (sbi->s_group_desc == NULL) { | 995 | if (sbi->s_group_desc == NULL) { |
982 | printk ("EXT2-fs: not enough memory\n"); | 996 | ext2_msg(sb, KERN_ERR, "error: not enough memory"); |
983 | goto failed_mount; | 997 | goto failed_mount; |
984 | } | 998 | } |
985 | bgl_lock_init(sbi->s_blockgroup_lock); | 999 | bgl_lock_init(sbi->s_blockgroup_lock); |
986 | sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); | 1000 | sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); |
987 | if (!sbi->s_debts) { | 1001 | if (!sbi->s_debts) { |
988 | printk ("EXT2-fs: not enough memory\n"); | 1002 | ext2_msg(sb, KERN_ERR, "error: not enough memory"); |
989 | goto failed_mount_group_desc; | 1003 | goto failed_mount_group_desc; |
990 | } | 1004 | } |
991 | for (i = 0; i < db_count; i++) { | 1005 | for (i = 0; i < db_count; i++) { |
@@ -994,12 +1008,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
994 | if (!sbi->s_group_desc[i]) { | 1008 | if (!sbi->s_group_desc[i]) { |
995 | for (j = 0; j < i; j++) | 1009 | for (j = 0; j < i; j++) |
996 | brelse (sbi->s_group_desc[j]); | 1010 | brelse (sbi->s_group_desc[j]); |
997 | printk ("EXT2-fs: unable to read group descriptors\n"); | 1011 | ext2_msg(sb, KERN_ERR, |
1012 | "error: unable to read group descriptors"); | ||
998 | goto failed_mount_group_desc; | 1013 | goto failed_mount_group_desc; |
999 | } | 1014 | } |
1000 | } | 1015 | } |
1001 | if (!ext2_check_descriptors (sb)) { | 1016 | if (!ext2_check_descriptors (sb)) { |
1002 | printk ("EXT2-fs: group descriptors corrupted!\n"); | 1017 | ext2_msg(sb, KERN_ERR, "group descriptors corrupted"); |
1003 | goto failed_mount2; | 1018 | goto failed_mount2; |
1004 | } | 1019 | } |
1005 | sbi->s_gdb_count = db_count; | 1020 | sbi->s_gdb_count = db_count; |
@@ -1032,7 +1047,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
1032 | ext2_count_dirs(sb)); | 1047 | ext2_count_dirs(sb)); |
1033 | } | 1048 | } |
1034 | if (err) { | 1049 | if (err) { |
1035 | printk(KERN_ERR "EXT2-fs: insufficient memory\n"); | 1050 | ext2_msg(sb, KERN_ERR, "error: insufficient memory"); |
1036 | goto failed_mount3; | 1051 | goto failed_mount3; |
1037 | } | 1052 | } |
1038 | /* | 1053 | /* |
@@ -1048,27 +1063,28 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
1048 | } | 1063 | } |
1049 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { | 1064 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { |
1050 | iput(root); | 1065 | iput(root); |
1051 | printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n"); | 1066 | ext2_msg(sb, KERN_ERR, "error: corrupt root inode, run e2fsck"); |
1052 | goto failed_mount3; | 1067 | goto failed_mount3; |
1053 | } | 1068 | } |
1054 | 1069 | ||
1055 | sb->s_root = d_alloc_root(root); | 1070 | sb->s_root = d_alloc_root(root); |
1056 | if (!sb->s_root) { | 1071 | if (!sb->s_root) { |
1057 | iput(root); | 1072 | iput(root); |
1058 | printk(KERN_ERR "EXT2-fs: get root inode failed\n"); | 1073 | ext2_msg(sb, KERN_ERR, "error: get root inode failed"); |
1059 | ret = -ENOMEM; | 1074 | ret = -ENOMEM; |
1060 | goto failed_mount3; | 1075 | goto failed_mount3; |
1061 | } | 1076 | } |
1062 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) | 1077 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) |
1063 | ext2_warning(sb, __func__, | 1078 | ext2_msg(sb, KERN_WARNING, |
1064 | "mounting ext3 filesystem as ext2"); | 1079 | "warning: mounting ext3 filesystem as ext2"); |
1065 | ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY); | 1080 | ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY); |
1066 | return 0; | 1081 | return 0; |
1067 | 1082 | ||
1068 | cantfind_ext2: | 1083 | cantfind_ext2: |
1069 | if (!silent) | 1084 | if (!silent) |
1070 | printk("VFS: Can't find an ext2 filesystem on dev %s.\n", | 1085 | ext2_msg(sb, KERN_ERR, |
1071 | sb->s_id); | 1086 | "error: can't find an ext2 filesystem on dev %s.", |
1087 | sb->s_id); | ||
1072 | goto failed_mount; | 1088 | goto failed_mount; |
1073 | failed_mount3: | 1089 | failed_mount3: |
1074 | percpu_counter_destroy(&sbi->s_freeblocks_counter); | 1090 | percpu_counter_destroy(&sbi->s_freeblocks_counter); |
@@ -1121,8 +1137,24 @@ static void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es) | |||
1121 | static int ext2_sync_fs(struct super_block *sb, int wait) | 1137 | static int ext2_sync_fs(struct super_block *sb, int wait) |
1122 | { | 1138 | { |
1123 | struct ext2_super_block *es = EXT2_SB(sb)->s_es; | 1139 | struct ext2_super_block *es = EXT2_SB(sb)->s_es; |
1140 | struct buffer_head *sbh = EXT2_SB(sb)->s_sbh; | ||
1124 | 1141 | ||
1125 | lock_kernel(); | 1142 | lock_kernel(); |
1143 | if (buffer_write_io_error(sbh)) { | ||
1144 | /* | ||
1145 | * Oh, dear. A previous attempt to write the | ||
1146 | * superblock failed. This could happen because the | ||
1147 | * USB device was yanked out. Or it could happen to | ||
1148 | * be a transient write error and maybe the block will | ||
1149 | * be remapped. Nothing we can do but to retry the | ||
1150 | * write and hope for the best. | ||
1151 | */ | ||
1152 | ext2_msg(sb, KERN_ERR, | ||
1153 | "previous I/O error to superblock detected\n"); | ||
1154 | clear_buffer_write_io_error(sbh); | ||
1155 | set_buffer_uptodate(sbh); | ||
1156 | } | ||
1157 | |||
1126 | if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) { | 1158 | if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) { |
1127 | ext2_debug("setting valid to 0\n"); | 1159 | ext2_debug("setting valid to 0\n"); |
1128 | es->s_state &= cpu_to_le16(~EXT2_VALID_FS); | 1160 | es->s_state &= cpu_to_le16(~EXT2_VALID_FS); |
@@ -1170,7 +1202,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1170 | /* | 1202 | /* |
1171 | * Allow the "check" option to be passed as a remount option. | 1203 | * Allow the "check" option to be passed as a remount option. |
1172 | */ | 1204 | */ |
1173 | if (!parse_options (data, sbi)) { | 1205 | if (!parse_options(data, sb)) { |
1174 | err = -EINVAL; | 1206 | err = -EINVAL; |
1175 | goto restore_opts; | 1207 | goto restore_opts; |
1176 | } | 1208 | } |
@@ -1182,7 +1214,8 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1182 | EXT2_MOUNT_XIP if not */ | 1214 | EXT2_MOUNT_XIP if not */ |
1183 | 1215 | ||
1184 | if ((ext2_use_xip(sb)) && (sb->s_blocksize != PAGE_SIZE)) { | 1216 | if ((ext2_use_xip(sb)) && (sb->s_blocksize != PAGE_SIZE)) { |
1185 | printk("XIP: Unsupported blocksize\n"); | 1217 | ext2_msg(sb, KERN_WARNING, |
1218 | "warning: unsupported blocksize for xip"); | ||
1186 | err = -EINVAL; | 1219 | err = -EINVAL; |
1187 | goto restore_opts; | 1220 | goto restore_opts; |
1188 | } | 1221 | } |
@@ -1191,8 +1224,8 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1191 | if (((sbi->s_mount_opt & EXT2_MOUNT_XIP) != | 1224 | if (((sbi->s_mount_opt & EXT2_MOUNT_XIP) != |
1192 | (old_mount_opt & EXT2_MOUNT_XIP)) && | 1225 | (old_mount_opt & EXT2_MOUNT_XIP)) && |
1193 | invalidate_inodes(sb)) { | 1226 | invalidate_inodes(sb)) { |
1194 | ext2_warning(sb, __func__, "refusing change of xip flag " | 1227 | ext2_msg(sb, KERN_WARNING, "warning: refusing change of " |
1195 | "with busy inodes while remounting"); | 1228 | "xip flag with busy inodes while remounting"); |
1196 | sbi->s_mount_opt &= ~EXT2_MOUNT_XIP; | 1229 | sbi->s_mount_opt &= ~EXT2_MOUNT_XIP; |
1197 | sbi->s_mount_opt |= old_mount_opt & EXT2_MOUNT_XIP; | 1230 | sbi->s_mount_opt |= old_mount_opt & EXT2_MOUNT_XIP; |
1198 | } | 1231 | } |
@@ -1216,9 +1249,10 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1216 | __le32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, | 1249 | __le32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, |
1217 | ~EXT2_FEATURE_RO_COMPAT_SUPP); | 1250 | ~EXT2_FEATURE_RO_COMPAT_SUPP); |
1218 | if (ret) { | 1251 | if (ret) { |
1219 | printk("EXT2-fs: %s: couldn't remount RDWR because of " | 1252 | ext2_msg(sb, KERN_WARNING, |
1220 | "unsupported optional features (%x).\n", | 1253 | "warning: couldn't remount RDWR because of " |
1221 | sb->s_id, le32_to_cpu(ret)); | 1254 | "unsupported optional features (%x).", |
1255 | le32_to_cpu(ret)); | ||
1222 | err = -EROFS; | 1256 | err = -EROFS; |
1223 | goto restore_opts; | 1257 | goto restore_opts; |
1224 | } | 1258 | } |
diff --git a/fs/ext2/xip.c b/fs/ext2/xip.c index c18fbf3e4068..322a56b2dfb1 100644 --- a/fs/ext2/xip.c +++ b/fs/ext2/xip.c | |||
@@ -69,8 +69,9 @@ void ext2_xip_verify_sb(struct super_block *sb) | |||
69 | if ((sbi->s_mount_opt & EXT2_MOUNT_XIP) && | 69 | if ((sbi->s_mount_opt & EXT2_MOUNT_XIP) && |
70 | !sb->s_bdev->bd_disk->fops->direct_access) { | 70 | !sb->s_bdev->bd_disk->fops->direct_access) { |
71 | sbi->s_mount_opt &= (~EXT2_MOUNT_XIP); | 71 | sbi->s_mount_opt &= (~EXT2_MOUNT_XIP); |
72 | ext2_warning(sb, __func__, | 72 | ext2_msg(sb, KERN_WARNING, |
73 | "ignoring xip option - not supported by bdev"); | 73 | "warning: ignoring xip option - " |
74 | "not supported by bdev"); | ||
74 | } | 75 | } |
75 | } | 76 | } |
76 | 77 | ||