diff options
Diffstat (limited to 'fs/nilfs2/super.c')
-rw-r--r-- | fs/nilfs2/super.c | 100 |
1 files changed, 47 insertions, 53 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 2d4d0bec711e..90c62b489857 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -214,8 +214,8 @@ static int nilfs_sync_super(struct super_block *sb, int flag) | |||
214 | } | 214 | } |
215 | 215 | ||
216 | if (unlikely(err)) { | 216 | if (unlikely(err)) { |
217 | printk(KERN_ERR | 217 | nilfs_msg(sb, KERN_ERR, "unable to write superblock: err=%d", |
218 | "NILFS: unable to write superblock (err=%d)\n", err); | 218 | err); |
219 | if (err == -EIO && nilfs->ns_sbh[1]) { | 219 | if (err == -EIO && nilfs->ns_sbh[1]) { |
220 | /* | 220 | /* |
221 | * sbp[0] points to newer log than sbp[1], | 221 | * sbp[0] points to newer log than sbp[1], |
@@ -285,8 +285,7 @@ struct nilfs_super_block **nilfs_prepare_super(struct super_block *sb, | |||
285 | sbp[1]->s_magic == cpu_to_le16(NILFS_SUPER_MAGIC)) { | 285 | sbp[1]->s_magic == cpu_to_le16(NILFS_SUPER_MAGIC)) { |
286 | memcpy(sbp[0], sbp[1], nilfs->ns_sbsize); | 286 | memcpy(sbp[0], sbp[1], nilfs->ns_sbsize); |
287 | } else { | 287 | } else { |
288 | printk(KERN_CRIT "NILFS: superblock broke on dev %s\n", | 288 | nilfs_msg(sb, KERN_CRIT, "superblock broke"); |
289 | sb->s_id); | ||
290 | return NULL; | 289 | return NULL; |
291 | } | 290 | } |
292 | } else if (sbp[1] && | 291 | } else if (sbp[1] && |
@@ -396,9 +395,9 @@ static int nilfs_move_2nd_super(struct super_block *sb, loff_t sb2off) | |||
396 | offset = sb2off & (nilfs->ns_blocksize - 1); | 395 | offset = sb2off & (nilfs->ns_blocksize - 1); |
397 | nsbh = sb_getblk(sb, newblocknr); | 396 | nsbh = sb_getblk(sb, newblocknr); |
398 | if (!nsbh) { | 397 | if (!nsbh) { |
399 | printk(KERN_WARNING | 398 | nilfs_msg(sb, KERN_WARNING, |
400 | "NILFS warning: unable to move secondary superblock " | 399 | "unable to move secondary superblock to block %llu", |
401 | "to block %llu\n", (unsigned long long)newblocknr); | 400 | (unsigned long long)newblocknr); |
402 | ret = -EIO; | 401 | ret = -EIO; |
403 | goto out; | 402 | goto out; |
404 | } | 403 | } |
@@ -561,10 +560,9 @@ int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt, | |||
561 | up_read(&nilfs->ns_segctor_sem); | 560 | up_read(&nilfs->ns_segctor_sem); |
562 | if (unlikely(err)) { | 561 | if (unlikely(err)) { |
563 | if (err == -ENOENT || err == -EINVAL) { | 562 | if (err == -ENOENT || err == -EINVAL) { |
564 | printk(KERN_ERR | 563 | nilfs_msg(sb, KERN_ERR, |
565 | "NILFS: Invalid checkpoint " | 564 | "Invalid checkpoint (checkpoint number=%llu)", |
566 | "(checkpoint number=%llu)\n", | 565 | (unsigned long long)cno); |
567 | (unsigned long long)cno); | ||
568 | err = -EINVAL; | 566 | err = -EINVAL; |
569 | } | 567 | } |
570 | goto failed; | 568 | goto failed; |
@@ -660,9 +658,8 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
660 | err = nilfs_ifile_count_free_inodes(root->ifile, | 658 | err = nilfs_ifile_count_free_inodes(root->ifile, |
661 | &nmaxinodes, &nfreeinodes); | 659 | &nmaxinodes, &nfreeinodes); |
662 | if (unlikely(err)) { | 660 | if (unlikely(err)) { |
663 | printk(KERN_WARNING | 661 | nilfs_msg(sb, KERN_WARNING, |
664 | "NILFS warning: fail to count free inodes: err %d.\n", | 662 | "failed to count free inodes: err=%d", err); |
665 | err); | ||
666 | if (err == -ERANGE) { | 663 | if (err == -ERANGE) { |
667 | /* | 664 | /* |
668 | * If nilfs_palloc_count_max_entries() returns | 665 | * If nilfs_palloc_count_max_entries() returns |
@@ -794,9 +791,9 @@ static int parse_options(char *options, struct super_block *sb, int is_remount) | |||
794 | break; | 791 | break; |
795 | case Opt_snapshot: | 792 | case Opt_snapshot: |
796 | if (is_remount) { | 793 | if (is_remount) { |
797 | printk(KERN_ERR | 794 | nilfs_msg(sb, KERN_ERR, |
798 | "NILFS: \"%s\" option is invalid " | 795 | "\"%s\" option is invalid for remount", |
799 | "for remount.\n", p); | 796 | p); |
800 | return 0; | 797 | return 0; |
801 | } | 798 | } |
802 | break; | 799 | break; |
@@ -810,8 +807,8 @@ static int parse_options(char *options, struct super_block *sb, int is_remount) | |||
810 | nilfs_clear_opt(nilfs, DISCARD); | 807 | nilfs_clear_opt(nilfs, DISCARD); |
811 | break; | 808 | break; |
812 | default: | 809 | default: |
813 | printk(KERN_ERR | 810 | nilfs_msg(sb, KERN_ERR, |
814 | "NILFS: Unrecognized mount option \"%s\"\n", p); | 811 | "unrecognized mount option \"%s\"", p); |
815 | return 0; | 812 | return 0; |
816 | } | 813 | } |
817 | } | 814 | } |
@@ -847,12 +844,10 @@ static int nilfs_setup_super(struct super_block *sb, int is_mount) | |||
847 | mnt_count = le16_to_cpu(sbp[0]->s_mnt_count); | 844 | mnt_count = le16_to_cpu(sbp[0]->s_mnt_count); |
848 | 845 | ||
849 | if (nilfs->ns_mount_state & NILFS_ERROR_FS) { | 846 | if (nilfs->ns_mount_state & NILFS_ERROR_FS) { |
850 | printk(KERN_WARNING | 847 | nilfs_msg(sb, KERN_WARNING, "mounting fs with errors"); |
851 | "NILFS warning: mounting fs with errors\n"); | ||
852 | #if 0 | 848 | #if 0 |
853 | } else if (max_mnt_count >= 0 && mnt_count >= max_mnt_count) { | 849 | } else if (max_mnt_count >= 0 && mnt_count >= max_mnt_count) { |
854 | printk(KERN_WARNING | 850 | nilfs_msg(sb, KERN_WARNING, "maximal mount count reached"); |
855 | "NILFS warning: maximal mount count reached\n"); | ||
856 | #endif | 851 | #endif |
857 | } | 852 | } |
858 | if (!max_mnt_count) | 853 | if (!max_mnt_count) |
@@ -915,17 +910,17 @@ int nilfs_check_feature_compatibility(struct super_block *sb, | |||
915 | features = le64_to_cpu(sbp->s_feature_incompat) & | 910 | features = le64_to_cpu(sbp->s_feature_incompat) & |
916 | ~NILFS_FEATURE_INCOMPAT_SUPP; | 911 | ~NILFS_FEATURE_INCOMPAT_SUPP; |
917 | if (features) { | 912 | if (features) { |
918 | printk(KERN_ERR "NILFS: couldn't mount because of unsupported " | 913 | nilfs_msg(sb, KERN_ERR, |
919 | "optional features (%llx)\n", | 914 | "couldn't mount because of unsupported optional features (%llx)", |
920 | (unsigned long long)features); | 915 | (unsigned long long)features); |
921 | return -EINVAL; | 916 | return -EINVAL; |
922 | } | 917 | } |
923 | features = le64_to_cpu(sbp->s_feature_compat_ro) & | 918 | features = le64_to_cpu(sbp->s_feature_compat_ro) & |
924 | ~NILFS_FEATURE_COMPAT_RO_SUPP; | 919 | ~NILFS_FEATURE_COMPAT_RO_SUPP; |
925 | if (!(sb->s_flags & MS_RDONLY) && features) { | 920 | if (!(sb->s_flags & MS_RDONLY) && features) { |
926 | printk(KERN_ERR "NILFS: couldn't mount RDWR because of " | 921 | nilfs_msg(sb, KERN_ERR, |
927 | "unsupported optional features (%llx)\n", | 922 | "couldn't mount RDWR because of unsupported optional features (%llx)", |
928 | (unsigned long long)features); | 923 | (unsigned long long)features); |
929 | return -EINVAL; | 924 | return -EINVAL; |
930 | } | 925 | } |
931 | return 0; | 926 | return 0; |
@@ -941,13 +936,13 @@ static int nilfs_get_root_dentry(struct super_block *sb, | |||
941 | 936 | ||
942 | inode = nilfs_iget(sb, root, NILFS_ROOT_INO); | 937 | inode = nilfs_iget(sb, root, NILFS_ROOT_INO); |
943 | if (IS_ERR(inode)) { | 938 | if (IS_ERR(inode)) { |
944 | printk(KERN_ERR "NILFS: get root inode failed\n"); | ||
945 | ret = PTR_ERR(inode); | 939 | ret = PTR_ERR(inode); |
940 | nilfs_msg(sb, KERN_ERR, "error %d getting root inode", ret); | ||
946 | goto out; | 941 | goto out; |
947 | } | 942 | } |
948 | if (!S_ISDIR(inode->i_mode) || !inode->i_blocks || !inode->i_size) { | 943 | if (!S_ISDIR(inode->i_mode) || !inode->i_blocks || !inode->i_size) { |
949 | iput(inode); | 944 | iput(inode); |
950 | printk(KERN_ERR "NILFS: corrupt root inode.\n"); | 945 | nilfs_msg(sb, KERN_ERR, "corrupt root inode"); |
951 | ret = -EINVAL; | 946 | ret = -EINVAL; |
952 | goto out; | 947 | goto out; |
953 | } | 948 | } |
@@ -975,7 +970,7 @@ static int nilfs_get_root_dentry(struct super_block *sb, | |||
975 | return ret; | 970 | return ret; |
976 | 971 | ||
977 | failed_dentry: | 972 | failed_dentry: |
978 | printk(KERN_ERR "NILFS: get root dentry failed\n"); | 973 | nilfs_msg(sb, KERN_ERR, "error %d getting root dentry", ret); |
979 | goto out; | 974 | goto out; |
980 | } | 975 | } |
981 | 976 | ||
@@ -995,18 +990,18 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno, | |||
995 | ret = (ret == -ENOENT) ? -EINVAL : ret; | 990 | ret = (ret == -ENOENT) ? -EINVAL : ret; |
996 | goto out; | 991 | goto out; |
997 | } else if (!ret) { | 992 | } else if (!ret) { |
998 | printk(KERN_ERR "NILFS: The specified checkpoint is " | 993 | nilfs_msg(s, KERN_ERR, |
999 | "not a snapshot (checkpoint number=%llu).\n", | 994 | "The specified checkpoint is not a snapshot (checkpoint number=%llu)", |
1000 | (unsigned long long)cno); | 995 | (unsigned long long)cno); |
1001 | ret = -EINVAL; | 996 | ret = -EINVAL; |
1002 | goto out; | 997 | goto out; |
1003 | } | 998 | } |
1004 | 999 | ||
1005 | ret = nilfs_attach_checkpoint(s, cno, false, &root); | 1000 | ret = nilfs_attach_checkpoint(s, cno, false, &root); |
1006 | if (ret) { | 1001 | if (ret) { |
1007 | printk(KERN_ERR "NILFS: error loading snapshot " | 1002 | nilfs_msg(s, KERN_ERR, |
1008 | "(checkpoint number=%llu).\n", | 1003 | "error %d while loading snapshot (checkpoint number=%llu)", |
1009 | (unsigned long long)cno); | 1004 | ret, (unsigned long long)cno); |
1010 | goto out; | 1005 | goto out; |
1011 | } | 1006 | } |
1012 | ret = nilfs_get_root_dentry(s, root, root_dentry); | 1007 | ret = nilfs_get_root_dentry(s, root, root_dentry); |
@@ -1101,8 +1096,9 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent) | |||
1101 | cno = nilfs_last_cno(nilfs); | 1096 | cno = nilfs_last_cno(nilfs); |
1102 | err = nilfs_attach_checkpoint(sb, cno, true, &fsroot); | 1097 | err = nilfs_attach_checkpoint(sb, cno, true, &fsroot); |
1103 | if (err) { | 1098 | if (err) { |
1104 | printk(KERN_ERR "NILFS: error loading last checkpoint " | 1099 | nilfs_msg(sb, KERN_ERR, |
1105 | "(checkpoint number=%llu).\n", (unsigned long long)cno); | 1100 | "error %d while loading last checkpoint (checkpoint number=%llu)", |
1101 | err, (unsigned long long)cno); | ||
1106 | goto failed_unload; | 1102 | goto failed_unload; |
1107 | } | 1103 | } |
1108 | 1104 | ||
@@ -1162,9 +1158,8 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data) | |||
1162 | err = -EINVAL; | 1158 | err = -EINVAL; |
1163 | 1159 | ||
1164 | if (!nilfs_valid_fs(nilfs)) { | 1160 | if (!nilfs_valid_fs(nilfs)) { |
1165 | printk(KERN_WARNING "NILFS (device %s): couldn't " | 1161 | nilfs_msg(sb, KERN_WARNING, |
1166 | "remount because the filesystem is in an " | 1162 | "couldn't remount because the filesystem is in an incomplete recovery state"); |
1167 | "incomplete recovery state.\n", sb->s_id); | ||
1168 | goto restore_opts; | 1163 | goto restore_opts; |
1169 | } | 1164 | } |
1170 | 1165 | ||
@@ -1196,10 +1191,9 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data) | |||
1196 | ~NILFS_FEATURE_COMPAT_RO_SUPP; | 1191 | ~NILFS_FEATURE_COMPAT_RO_SUPP; |
1197 | up_read(&nilfs->ns_sem); | 1192 | up_read(&nilfs->ns_sem); |
1198 | if (features) { | 1193 | if (features) { |
1199 | printk(KERN_WARNING "NILFS (device %s): couldn't " | 1194 | nilfs_msg(sb, KERN_WARNING, |
1200 | "remount RDWR because of unsupported optional " | 1195 | "couldn't remount RDWR because of unsupported optional features (%llx)", |
1201 | "features (%llx)\n", | 1196 | (unsigned long long)features); |
1202 | sb->s_id, (unsigned long long)features); | ||
1203 | err = -EROFS; | 1197 | err = -EROFS; |
1204 | goto restore_opts; | 1198 | goto restore_opts; |
1205 | } | 1199 | } |
@@ -1262,8 +1256,8 @@ static int nilfs_identify(char *data, struct nilfs_super_data *sd) | |||
1262 | } | 1256 | } |
1263 | } | 1257 | } |
1264 | if (ret) | 1258 | if (ret) |
1265 | printk(KERN_ERR | 1259 | nilfs_msg(NULL, KERN_ERR, |
1266 | "NILFS: invalid mount option: %s\n", p); | 1260 | "invalid mount option: %s", p); |
1267 | } | 1261 | } |
1268 | if (!options) | 1262 | if (!options) |
1269 | break; | 1263 | break; |
@@ -1344,10 +1338,10 @@ nilfs_mount(struct file_system_type *fs_type, int flags, | |||
1344 | } else if (!sd.cno) { | 1338 | } else if (!sd.cno) { |
1345 | if (nilfs_tree_is_busy(s->s_root)) { | 1339 | if (nilfs_tree_is_busy(s->s_root)) { |
1346 | if ((flags ^ s->s_flags) & MS_RDONLY) { | 1340 | if ((flags ^ s->s_flags) & MS_RDONLY) { |
1347 | printk(KERN_ERR "NILFS: the device already " | 1341 | nilfs_msg(s, KERN_ERR, |
1348 | "has a %s mount.\n", | 1342 | "the device already has a %s mount.", |
1349 | (s->s_flags & MS_RDONLY) ? | 1343 | (s->s_flags & MS_RDONLY) ? |
1350 | "read-only" : "read/write"); | 1344 | "read-only" : "read/write"); |
1351 | err = -EBUSY; | 1345 | err = -EBUSY; |
1352 | goto failed_super; | 1346 | goto failed_super; |
1353 | } | 1347 | } |