diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 102 |
1 files changed, 50 insertions, 52 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index aeb090583b78..123fab55b5a4 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2713,7 +2713,7 @@ int open_ctree(struct super_block *sb, | |||
2713 | * Pass the whole disk block of size BTRFS_SUPER_INFO_SIZE (4k). | 2713 | * Pass the whole disk block of size BTRFS_SUPER_INFO_SIZE (4k). |
2714 | */ | 2714 | */ |
2715 | if (btrfs_check_super_csum(bh->b_data)) { | 2715 | if (btrfs_check_super_csum(bh->b_data)) { |
2716 | printk(KERN_ERR "BTRFS: superblock checksum mismatch\n"); | 2716 | btrfs_err(fs_info, "superblock checksum mismatch"); |
2717 | err = -EINVAL; | 2717 | err = -EINVAL; |
2718 | brelse(bh); | 2718 | brelse(bh); |
2719 | goto fail_alloc; | 2719 | goto fail_alloc; |
@@ -2733,7 +2733,7 @@ int open_ctree(struct super_block *sb, | |||
2733 | 2733 | ||
2734 | ret = btrfs_check_super_valid(fs_info, sb->s_flags & MS_RDONLY); | 2734 | ret = btrfs_check_super_valid(fs_info, sb->s_flags & MS_RDONLY); |
2735 | if (ret) { | 2735 | if (ret) { |
2736 | printk(KERN_ERR "BTRFS: superblock contains fatal errors\n"); | 2736 | btrfs_err(fs_info, "superblock contains fatal errors"); |
2737 | err = -EINVAL; | 2737 | err = -EINVAL; |
2738 | goto fail_alloc; | 2738 | goto fail_alloc; |
2739 | } | 2739 | } |
@@ -2768,9 +2768,9 @@ int open_ctree(struct super_block *sb, | |||
2768 | features = btrfs_super_incompat_flags(disk_super) & | 2768 | features = btrfs_super_incompat_flags(disk_super) & |
2769 | ~BTRFS_FEATURE_INCOMPAT_SUPP; | 2769 | ~BTRFS_FEATURE_INCOMPAT_SUPP; |
2770 | if (features) { | 2770 | if (features) { |
2771 | printk(KERN_ERR "BTRFS: couldn't mount because of " | 2771 | btrfs_err(fs_info, |
2772 | "unsupported optional features (%Lx).\n", | 2772 | "cannot mount because of unsupported optional features (%llx)", |
2773 | features); | 2773 | features); |
2774 | err = -EINVAL; | 2774 | err = -EINVAL; |
2775 | goto fail_alloc; | 2775 | goto fail_alloc; |
2776 | } | 2776 | } |
@@ -2781,7 +2781,7 @@ int open_ctree(struct super_block *sb, | |||
2781 | features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO; | 2781 | features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO; |
2782 | 2782 | ||
2783 | if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) | 2783 | if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) |
2784 | printk(KERN_INFO "BTRFS: has skinny extents\n"); | 2784 | btrfs_info(fs_info, "has skinny extents"); |
2785 | 2785 | ||
2786 | /* | 2786 | /* |
2787 | * flag our filesystem as having big metadata blocks if | 2787 | * flag our filesystem as having big metadata blocks if |
@@ -2789,7 +2789,8 @@ int open_ctree(struct super_block *sb, | |||
2789 | */ | 2789 | */ |
2790 | if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { | 2790 | if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { |
2791 | if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) | 2791 | if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) |
2792 | printk(KERN_INFO "BTRFS: flagging fs with big metadata feature\n"); | 2792 | btrfs_info(fs_info, |
2793 | "flagging fs with big metadata feature"); | ||
2793 | features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; | 2794 | features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; |
2794 | } | 2795 | } |
2795 | 2796 | ||
@@ -2805,9 +2806,9 @@ int open_ctree(struct super_block *sb, | |||
2805 | */ | 2806 | */ |
2806 | if ((features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) && | 2807 | if ((features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) && |
2807 | (sectorsize != nodesize)) { | 2808 | (sectorsize != nodesize)) { |
2808 | printk(KERN_ERR "BTRFS: unequal leaf/node/sector sizes " | 2809 | btrfs_err(fs_info, |
2809 | "are not allowed for mixed block groups on %s\n", | 2810 | "unequal nodesize/sectorsize (%u != %u) are not allowed for mixed block groups", |
2810 | sb->s_id); | 2811 | nodesize, sectorsize); |
2811 | goto fail_alloc; | 2812 | goto fail_alloc; |
2812 | } | 2813 | } |
2813 | 2814 | ||
@@ -2820,8 +2821,8 @@ int open_ctree(struct super_block *sb, | |||
2820 | features = btrfs_super_compat_ro_flags(disk_super) & | 2821 | features = btrfs_super_compat_ro_flags(disk_super) & |
2821 | ~BTRFS_FEATURE_COMPAT_RO_SUPP; | 2822 | ~BTRFS_FEATURE_COMPAT_RO_SUPP; |
2822 | if (!(sb->s_flags & MS_RDONLY) && features) { | 2823 | if (!(sb->s_flags & MS_RDONLY) && features) { |
2823 | printk(KERN_ERR "BTRFS: couldn't mount RDWR because of " | 2824 | btrfs_err(fs_info, |
2824 | "unsupported option features (%Lx).\n", | 2825 | "cannot mount read-write because of unsupported optional features (%llx)", |
2825 | features); | 2826 | features); |
2826 | err = -EINVAL; | 2827 | err = -EINVAL; |
2827 | goto fail_alloc; | 2828 | goto fail_alloc; |
@@ -2850,8 +2851,7 @@ int open_ctree(struct super_block *sb, | |||
2850 | ret = btrfs_read_sys_array(tree_root); | 2851 | ret = btrfs_read_sys_array(tree_root); |
2851 | mutex_unlock(&fs_info->chunk_mutex); | 2852 | mutex_unlock(&fs_info->chunk_mutex); |
2852 | if (ret) { | 2853 | if (ret) { |
2853 | printk(KERN_ERR "BTRFS: failed to read the system " | 2854 | btrfs_err(fs_info, "failed to read the system array: %d", ret); |
2854 | "array on %s\n", sb->s_id); | ||
2855 | goto fail_sb_buffer; | 2855 | goto fail_sb_buffer; |
2856 | } | 2856 | } |
2857 | 2857 | ||
@@ -2865,8 +2865,7 @@ int open_ctree(struct super_block *sb, | |||
2865 | generation); | 2865 | generation); |
2866 | if (IS_ERR(chunk_root->node) || | 2866 | if (IS_ERR(chunk_root->node) || |
2867 | !extent_buffer_uptodate(chunk_root->node)) { | 2867 | !extent_buffer_uptodate(chunk_root->node)) { |
2868 | printk(KERN_ERR "BTRFS: failed to read chunk root on %s\n", | 2868 | btrfs_err(fs_info, "failed to read chunk root"); |
2869 | sb->s_id); | ||
2870 | if (!IS_ERR(chunk_root->node)) | 2869 | if (!IS_ERR(chunk_root->node)) |
2871 | free_extent_buffer(chunk_root->node); | 2870 | free_extent_buffer(chunk_root->node); |
2872 | chunk_root->node = NULL; | 2871 | chunk_root->node = NULL; |
@@ -2880,8 +2879,7 @@ int open_ctree(struct super_block *sb, | |||
2880 | 2879 | ||
2881 | ret = btrfs_read_chunk_tree(chunk_root); | 2880 | ret = btrfs_read_chunk_tree(chunk_root); |
2882 | if (ret) { | 2881 | if (ret) { |
2883 | printk(KERN_ERR "BTRFS: failed to read chunk tree on %s\n", | 2882 | btrfs_err(fs_info, "failed to read chunk tree: %d", ret); |
2884 | sb->s_id); | ||
2885 | goto fail_tree_roots; | 2883 | goto fail_tree_roots; |
2886 | } | 2884 | } |
2887 | 2885 | ||
@@ -2892,8 +2890,7 @@ int open_ctree(struct super_block *sb, | |||
2892 | btrfs_close_extra_devices(fs_devices, 0); | 2890 | btrfs_close_extra_devices(fs_devices, 0); |
2893 | 2891 | ||
2894 | if (!fs_devices->latest_bdev) { | 2892 | if (!fs_devices->latest_bdev) { |
2895 | printk(KERN_ERR "BTRFS: failed to read devices on %s\n", | 2893 | btrfs_err(fs_info, "failed to read devices"); |
2896 | sb->s_id); | ||
2897 | goto fail_tree_roots; | 2894 | goto fail_tree_roots; |
2898 | } | 2895 | } |
2899 | 2896 | ||
@@ -2905,8 +2902,7 @@ retry_root_backup: | |||
2905 | generation); | 2902 | generation); |
2906 | if (IS_ERR(tree_root->node) || | 2903 | if (IS_ERR(tree_root->node) || |
2907 | !extent_buffer_uptodate(tree_root->node)) { | 2904 | !extent_buffer_uptodate(tree_root->node)) { |
2908 | printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n", | 2905 | btrfs_warn(fs_info, "failed to read tree root"); |
2909 | sb->s_id); | ||
2910 | if (!IS_ERR(tree_root->node)) | 2906 | if (!IS_ERR(tree_root->node)) |
2911 | free_extent_buffer(tree_root->node); | 2907 | free_extent_buffer(tree_root->node); |
2912 | tree_root->node = NULL; | 2908 | tree_root->node = NULL; |
@@ -2938,20 +2934,19 @@ retry_root_backup: | |||
2938 | 2934 | ||
2939 | ret = btrfs_recover_balance(fs_info); | 2935 | ret = btrfs_recover_balance(fs_info); |
2940 | if (ret) { | 2936 | if (ret) { |
2941 | printk(KERN_ERR "BTRFS: failed to recover balance\n"); | 2937 | btrfs_err(fs_info, "failed to recover balance: %d", ret); |
2942 | goto fail_block_groups; | 2938 | goto fail_block_groups; |
2943 | } | 2939 | } |
2944 | 2940 | ||
2945 | ret = btrfs_init_dev_stats(fs_info); | 2941 | ret = btrfs_init_dev_stats(fs_info); |
2946 | if (ret) { | 2942 | if (ret) { |
2947 | printk(KERN_ERR "BTRFS: failed to init dev_stats: %d\n", | 2943 | btrfs_err(fs_info, "failed to init dev_stats: %d", ret); |
2948 | ret); | ||
2949 | goto fail_block_groups; | 2944 | goto fail_block_groups; |
2950 | } | 2945 | } |
2951 | 2946 | ||
2952 | ret = btrfs_init_dev_replace(fs_info); | 2947 | ret = btrfs_init_dev_replace(fs_info); |
2953 | if (ret) { | 2948 | if (ret) { |
2954 | pr_err("BTRFS: failed to init dev_replace: %d\n", ret); | 2949 | btrfs_err(fs_info, "failed to init dev_replace: %d", ret); |
2955 | goto fail_block_groups; | 2950 | goto fail_block_groups; |
2956 | } | 2951 | } |
2957 | 2952 | ||
@@ -2959,31 +2954,33 @@ retry_root_backup: | |||
2959 | 2954 | ||
2960 | ret = btrfs_sysfs_add_fsid(fs_devices, NULL); | 2955 | ret = btrfs_sysfs_add_fsid(fs_devices, NULL); |
2961 | if (ret) { | 2956 | if (ret) { |
2962 | pr_err("BTRFS: failed to init sysfs fsid interface: %d\n", ret); | 2957 | btrfs_err(fs_info, "failed to init sysfs fsid interface: %d", |
2958 | ret); | ||
2963 | goto fail_block_groups; | 2959 | goto fail_block_groups; |
2964 | } | 2960 | } |
2965 | 2961 | ||
2966 | ret = btrfs_sysfs_add_device(fs_devices); | 2962 | ret = btrfs_sysfs_add_device(fs_devices); |
2967 | if (ret) { | 2963 | if (ret) { |
2968 | pr_err("BTRFS: failed to init sysfs device interface: %d\n", ret); | 2964 | btrfs_err(fs_info, "failed to init sysfs device interface: %d", |
2965 | ret); | ||
2969 | goto fail_fsdev_sysfs; | 2966 | goto fail_fsdev_sysfs; |
2970 | } | 2967 | } |
2971 | 2968 | ||
2972 | ret = btrfs_sysfs_add_mounted(fs_info); | 2969 | ret = btrfs_sysfs_add_mounted(fs_info); |
2973 | if (ret) { | 2970 | if (ret) { |
2974 | pr_err("BTRFS: failed to init sysfs interface: %d\n", ret); | 2971 | btrfs_err(fs_info, "failed to init sysfs interface: %d", ret); |
2975 | goto fail_fsdev_sysfs; | 2972 | goto fail_fsdev_sysfs; |
2976 | } | 2973 | } |
2977 | 2974 | ||
2978 | ret = btrfs_init_space_info(fs_info); | 2975 | ret = btrfs_init_space_info(fs_info); |
2979 | if (ret) { | 2976 | if (ret) { |
2980 | printk(KERN_ERR "BTRFS: Failed to initial space info: %d\n", ret); | 2977 | btrfs_err(fs_info, "failed to initialize space info: %d", ret); |
2981 | goto fail_sysfs; | 2978 | goto fail_sysfs; |
2982 | } | 2979 | } |
2983 | 2980 | ||
2984 | ret = btrfs_read_block_groups(fs_info->extent_root); | 2981 | ret = btrfs_read_block_groups(fs_info->extent_root); |
2985 | if (ret) { | 2982 | if (ret) { |
2986 | printk(KERN_ERR "BTRFS: Failed to read block groups: %d\n", ret); | 2983 | btrfs_err(fs_info, "failed to read block groups: %d", ret); |
2987 | goto fail_sysfs; | 2984 | goto fail_sysfs; |
2988 | } | 2985 | } |
2989 | fs_info->num_tolerated_disk_barrier_failures = | 2986 | fs_info->num_tolerated_disk_barrier_failures = |
@@ -2991,7 +2988,8 @@ retry_root_backup: | |||
2991 | if (fs_info->fs_devices->missing_devices > | 2988 | if (fs_info->fs_devices->missing_devices > |
2992 | fs_info->num_tolerated_disk_barrier_failures && | 2989 | fs_info->num_tolerated_disk_barrier_failures && |
2993 | !(sb->s_flags & MS_RDONLY)) { | 2990 | !(sb->s_flags & MS_RDONLY)) { |
2994 | pr_warn("BTRFS: missing devices(%llu) exceeds the limit(%d), writeable mount is not allowed\n", | 2991 | btrfs_warn(fs_info, |
2992 | "missing devices (%llu) exceeds the limit (%d), writeable mount is not allowed", | ||
2995 | fs_info->fs_devices->missing_devices, | 2993 | fs_info->fs_devices->missing_devices, |
2996 | fs_info->num_tolerated_disk_barrier_failures); | 2994 | fs_info->num_tolerated_disk_barrier_failures); |
2997 | goto fail_sysfs; | 2995 | goto fail_sysfs; |
@@ -3011,8 +3009,7 @@ retry_root_backup: | |||
3011 | if (!btrfs_test_opt(tree_root, SSD) && | 3009 | if (!btrfs_test_opt(tree_root, SSD) && |
3012 | !btrfs_test_opt(tree_root, NOSSD) && | 3010 | !btrfs_test_opt(tree_root, NOSSD) && |
3013 | !fs_info->fs_devices->rotating) { | 3011 | !fs_info->fs_devices->rotating) { |
3014 | printk(KERN_INFO "BTRFS: detected SSD devices, enabling SSD " | 3012 | btrfs_info(fs_info, "detected SSD devices, enabling SSD mode"); |
3015 | "mode\n"); | ||
3016 | btrfs_set_opt(fs_info->mount_opt, SSD); | 3013 | btrfs_set_opt(fs_info->mount_opt, SSD); |
3017 | } | 3014 | } |
3018 | 3015 | ||
@@ -3030,8 +3027,9 @@ retry_root_backup: | |||
3030 | 1 : 0, | 3027 | 1 : 0, |
3031 | fs_info->check_integrity_print_mask); | 3028 | fs_info->check_integrity_print_mask); |
3032 | if (ret) | 3029 | if (ret) |
3033 | printk(KERN_WARNING "BTRFS: failed to initialize" | 3030 | btrfs_warn(fs_info, |
3034 | " integrity check module %s\n", sb->s_id); | 3031 | "failed to initialize integrity check module: %d", |
3032 | ret); | ||
3035 | } | 3033 | } |
3036 | #endif | 3034 | #endif |
3037 | ret = btrfs_read_qgroup_config(fs_info); | 3035 | ret = btrfs_read_qgroup_config(fs_info); |
@@ -3061,8 +3059,8 @@ retry_root_backup: | |||
3061 | ret = btrfs_recover_relocation(tree_root); | 3059 | ret = btrfs_recover_relocation(tree_root); |
3062 | mutex_unlock(&fs_info->cleaner_mutex); | 3060 | mutex_unlock(&fs_info->cleaner_mutex); |
3063 | if (ret < 0) { | 3061 | if (ret < 0) { |
3064 | printk(KERN_WARNING | 3062 | btrfs_warn(fs_info, "failed to recover relocation: %d", |
3065 | "BTRFS: failed to recover relocation\n"); | 3063 | ret); |
3066 | err = -EINVAL; | 3064 | err = -EINVAL; |
3067 | goto fail_qgroup; | 3065 | goto fail_qgroup; |
3068 | } | 3066 | } |
@@ -3083,11 +3081,11 @@ retry_root_backup: | |||
3083 | 3081 | ||
3084 | if (btrfs_test_opt(tree_root, FREE_SPACE_TREE) && | 3082 | if (btrfs_test_opt(tree_root, FREE_SPACE_TREE) && |
3085 | !btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { | 3083 | !btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { |
3086 | pr_info("BTRFS: creating free space tree\n"); | 3084 | btrfs_info(fs_info, "creating free space tree"); |
3087 | ret = btrfs_create_free_space_tree(fs_info); | 3085 | ret = btrfs_create_free_space_tree(fs_info); |
3088 | if (ret) { | 3086 | if (ret) { |
3089 | pr_warn("BTRFS: failed to create free space tree %d\n", | 3087 | btrfs_warn(fs_info, |
3090 | ret); | 3088 | "failed to create free space tree: %d", ret); |
3091 | close_ctree(tree_root); | 3089 | close_ctree(tree_root); |
3092 | return ret; | 3090 | return ret; |
3093 | } | 3091 | } |
@@ -3104,14 +3102,14 @@ retry_root_backup: | |||
3104 | 3102 | ||
3105 | ret = btrfs_resume_balance_async(fs_info); | 3103 | ret = btrfs_resume_balance_async(fs_info); |
3106 | if (ret) { | 3104 | if (ret) { |
3107 | printk(KERN_WARNING "BTRFS: failed to resume balance\n"); | 3105 | btrfs_warn(fs_info, "failed to resume balance: %d", ret); |
3108 | close_ctree(tree_root); | 3106 | close_ctree(tree_root); |
3109 | return ret; | 3107 | return ret; |
3110 | } | 3108 | } |
3111 | 3109 | ||
3112 | ret = btrfs_resume_dev_replace_async(fs_info); | 3110 | ret = btrfs_resume_dev_replace_async(fs_info); |
3113 | if (ret) { | 3111 | if (ret) { |
3114 | pr_warn("BTRFS: failed to resume dev_replace\n"); | 3112 | btrfs_warn(fs_info, "failed to resume device replace: %d", ret); |
3115 | close_ctree(tree_root); | 3113 | close_ctree(tree_root); |
3116 | return ret; | 3114 | return ret; |
3117 | } | 3115 | } |
@@ -3120,33 +3118,33 @@ retry_root_backup: | |||
3120 | 3118 | ||
3121 | if (btrfs_test_opt(tree_root, CLEAR_CACHE) && | 3119 | if (btrfs_test_opt(tree_root, CLEAR_CACHE) && |
3122 | btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { | 3120 | btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { |
3123 | pr_info("BTRFS: clearing free space tree\n"); | 3121 | btrfs_info(fs_info, "clearing free space tree"); |
3124 | ret = btrfs_clear_free_space_tree(fs_info); | 3122 | ret = btrfs_clear_free_space_tree(fs_info); |
3125 | if (ret) { | 3123 | if (ret) { |
3126 | pr_warn("BTRFS: failed to clear free space tree %d\n", | 3124 | btrfs_warn(fs_info, |
3127 | ret); | 3125 | "failed to clear free space tree: %d", ret); |
3128 | close_ctree(tree_root); | 3126 | close_ctree(tree_root); |
3129 | return ret; | 3127 | return ret; |
3130 | } | 3128 | } |
3131 | } | 3129 | } |
3132 | 3130 | ||
3133 | if (!fs_info->uuid_root) { | 3131 | if (!fs_info->uuid_root) { |
3134 | pr_info("BTRFS: creating UUID tree\n"); | 3132 | btrfs_info(fs_info, "creating UUID tree"); |
3135 | ret = btrfs_create_uuid_tree(fs_info); | 3133 | ret = btrfs_create_uuid_tree(fs_info); |
3136 | if (ret) { | 3134 | if (ret) { |
3137 | pr_warn("BTRFS: failed to create the UUID tree %d\n", | 3135 | btrfs_warn(fs_info, |
3138 | ret); | 3136 | "failed to create the UUID tree: %d", ret); |
3139 | close_ctree(tree_root); | 3137 | close_ctree(tree_root); |
3140 | return ret; | 3138 | return ret; |
3141 | } | 3139 | } |
3142 | } else if (btrfs_test_opt(tree_root, RESCAN_UUID_TREE) || | 3140 | } else if (btrfs_test_opt(tree_root, RESCAN_UUID_TREE) || |
3143 | fs_info->generation != | 3141 | fs_info->generation != |
3144 | btrfs_super_uuid_tree_generation(disk_super)) { | 3142 | btrfs_super_uuid_tree_generation(disk_super)) { |
3145 | pr_info("BTRFS: checking UUID tree\n"); | 3143 | btrfs_info(fs_info, "checking UUID tree"); |
3146 | ret = btrfs_check_uuid_tree(fs_info); | 3144 | ret = btrfs_check_uuid_tree(fs_info); |
3147 | if (ret) { | 3145 | if (ret) { |
3148 | pr_warn("BTRFS: failed to check the UUID tree %d\n", | 3146 | btrfs_warn(fs_info, |
3149 | ret); | 3147 | "failed to check the UUID tree: %d", ret); |
3150 | close_ctree(tree_root); | 3148 | close_ctree(tree_root); |
3151 | return ret; | 3149 | return ret; |
3152 | } | 3150 | } |