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