@@ -325,11 +325,19 @@ void f2fs_printk(struct f2fs_sb_info *sbi, bool limit_rate,
325
325
vaf .fmt = printk_skip_level (fmt );
326
326
vaf .va = & args ;
327
327
if (limit_rate )
328
- printk_ratelimited ("%c%cF2FS-fs (%s): %pV\n" ,
329
- KERN_SOH_ASCII , level , sbi -> sb -> s_id , & vaf );
328
+ if (sbi )
329
+ printk_ratelimited ("%c%cF2FS-fs (%s): %pV\n" ,
330
+ KERN_SOH_ASCII , level , sbi -> sb -> s_id , & vaf );
331
+ else
332
+ printk_ratelimited ("%c%cF2FS-fs: %pV\n" ,
333
+ KERN_SOH_ASCII , level , & vaf );
330
334
else
331
- printk ("%c%cF2FS-fs (%s): %pV\n" ,
332
- KERN_SOH_ASCII , level , sbi -> sb -> s_id , & vaf );
335
+ if (sbi )
336
+ printk ("%c%cF2FS-fs (%s): %pV\n" ,
337
+ KERN_SOH_ASCII , level , sbi -> sb -> s_id , & vaf );
338
+ else
339
+ printk ("%c%cF2FS-fs: %pV\n" ,
340
+ KERN_SOH_ASCII , level , & vaf );
333
341
334
342
va_end (args );
335
343
}
@@ -739,21 +747,21 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
739
747
case Opt_discard :
740
748
if (result .negated ) {
741
749
if (f2fs_hw_should_discard (sbi )) {
742
- f2fs_warn (sbi , "discard is required for zoned block devices" );
750
+ f2fs_warn (NULL , "discard is required for zoned block devices" );
743
751
return - EINVAL ;
744
752
}
745
753
clear_opt (sbi , DISCARD );
746
754
} else {
747
755
if (!f2fs_hw_support_discard (sbi )) {
748
- f2fs_warn (sbi , "device does not support discard" );
756
+ f2fs_warn (NULL , "device does not support discard" );
749
757
break ;
750
758
}
751
759
set_opt (sbi , DISCARD );
752
760
}
753
761
break ;
754
762
case Opt_noheap :
755
763
case Opt_heap :
756
- f2fs_warn (sbi , "heap/no_heap options were deprecated" );
764
+ f2fs_warn (NULL , "heap/no_heap options were deprecated" );
757
765
break ;
758
766
#ifdef CONFIG_F2FS_FS_XATTR
759
767
case Opt_user_xattr :
@@ -776,7 +784,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
776
784
case Opt_user_xattr :
777
785
case Opt_inline_xattr :
778
786
case Opt_inline_xattr_size :
779
- f2fs_info (sbi , "%s options not supported" , param -> key );
787
+ f2fs_info (NULL , "%s options not supported" , param -> key );
780
788
break ;
781
789
#endif
782
790
#ifdef CONFIG_F2FS_FS_POSIX_ACL
@@ -788,7 +796,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
788
796
break ;
789
797
#else
790
798
case Opt_acl :
791
- f2fs_info (sbi , "%s options not supported" , param -> key );
799
+ f2fs_info (NULL , "%s options not supported" , param -> key );
792
800
break ;
793
801
#endif
794
802
case Opt_active_logs :
@@ -842,7 +850,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
842
850
break ;
843
851
case Opt_reserve_root :
844
852
if (test_opt (sbi , RESERVE_ROOT )) {
845
- f2fs_info (sbi , "Preserve previous reserve_root=%u" ,
853
+ f2fs_info (NULL , "Preserve previous reserve_root=%u" ,
846
854
F2FS_OPTION (sbi ).root_reserved_blocks );
847
855
} else {
848
856
F2FS_OPTION (sbi ).root_reserved_blocks = result .int_32 ;
@@ -873,7 +881,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
873
881
#else
874
882
case Opt_fault_injection :
875
883
case Opt_fault_type :
876
- f2fs_info (sbi , "%s options not supported" , param -> key );
884
+ f2fs_info (NULL , "%s options not supported" , param -> key );
877
885
break ;
878
886
#endif
879
887
case Opt_lazytime :
@@ -936,7 +944,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
936
944
case Opt_usrjquota :
937
945
case Opt_grpjquota :
938
946
case Opt_prjjquota :
939
- f2fs_info (sbi , "quota operations not supported" );
947
+ f2fs_info (NULL , "quota operations not supported" );
940
948
break ;
941
949
#endif
942
950
case Opt_alloc :
@@ -954,7 +962,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
954
962
#ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT
955
963
set_opt (sbi , INLINECRYPT );
956
964
#else
957
- f2fs_info (sbi , "inline encryption not supported" );
965
+ f2fs_info (NULL , "inline encryption not supported" );
958
966
#endif
959
967
break ;
960
968
case Opt_checkpoint :
@@ -1001,7 +1009,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
1001
1009
#ifdef CONFIG_F2FS_FS_COMPRESSION
1002
1010
case Opt_compress_algorithm :
1003
1011
if (!f2fs_sb_has_compression (sbi )) {
1004
- f2fs_info (sbi , "Image doesn't support compression" );
1012
+ f2fs_info (NULL , "Image doesn't support compression" );
1005
1013
break ;
1006
1014
}
1007
1015
name = param -> string ;
@@ -1010,7 +1018,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
1010
1018
F2FS_OPTION (sbi ).compress_level = 0 ;
1011
1019
F2FS_OPTION (sbi ).compress_algorithm = COMPRESS_LZO ;
1012
1020
#else
1013
- f2fs_info (sbi , "kernel doesn't support lzo compression" );
1021
+ f2fs_info (NULL , "kernel doesn't support lzo compression" );
1014
1022
#endif
1015
1023
} else if (!strncmp (name , "lz4" , 3 )) {
1016
1024
#ifdef CONFIG_F2FS_FS_LZ4
@@ -1019,7 +1027,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
1019
1027
return - EINVAL ;
1020
1028
F2FS_OPTION (sbi ).compress_algorithm = COMPRESS_LZ4 ;
1021
1029
#else
1022
- f2fs_info (sbi , "kernel doesn't support lz4 compression" );
1030
+ f2fs_info (NULL , "kernel doesn't support lz4 compression" );
1023
1031
#endif
1024
1032
} else if (!strncmp (name , "zstd" , 4 )) {
1025
1033
#ifdef CONFIG_F2FS_FS_ZSTD
@@ -1028,34 +1036,34 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
1028
1036
return - EINVAL ;
1029
1037
F2FS_OPTION (sbi ).compress_algorithm = COMPRESS_ZSTD ;
1030
1038
#else
1031
- f2fs_info (sbi , "kernel doesn't support zstd compression" );
1039
+ f2fs_info (NULL , "kernel doesn't support zstd compression" );
1032
1040
#endif
1033
1041
} else if (!strcmp (name , "lzo-rle" )) {
1034
1042
#ifdef CONFIG_F2FS_FS_LZORLE
1035
1043
F2FS_OPTION (sbi ).compress_level = 0 ;
1036
1044
F2FS_OPTION (sbi ).compress_algorithm = COMPRESS_LZORLE ;
1037
1045
#else
1038
- f2fs_info (sbi , "kernel doesn't support lzorle compression" );
1046
+ f2fs_info (NULL , "kernel doesn't support lzorle compression" );
1039
1047
#endif
1040
1048
} else
1041
1049
return - EINVAL ;
1042
1050
break ;
1043
1051
case Opt_compress_log_size :
1044
1052
if (!f2fs_sb_has_compression (sbi )) {
1045
- f2fs_info (sbi , "Image doesn't support compression" );
1053
+ f2fs_info (NULL , "Image doesn't support compression" );
1046
1054
break ;
1047
1055
}
1048
1056
if (result .uint_32 < MIN_COMPRESS_LOG_SIZE ||
1049
1057
result .uint_32 > MAX_COMPRESS_LOG_SIZE ) {
1050
- f2fs_err (sbi ,
1058
+ f2fs_err (NULL ,
1051
1059
"Compress cluster log size is out of range" );
1052
1060
return - EINVAL ;
1053
1061
}
1054
1062
F2FS_OPTION (sbi ).compress_log_size = result .uint_32 ;
1055
1063
break ;
1056
1064
case Opt_compress_extension :
1057
1065
if (!f2fs_sb_has_compression (sbi )) {
1058
- f2fs_info (sbi , "Image doesn't support compression" );
1066
+ f2fs_info (NULL , "Image doesn't support compression" );
1059
1067
break ;
1060
1068
}
1061
1069
name = param -> string ;
@@ -1064,7 +1072,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
1064
1072
1065
1073
if (strlen (name ) >= F2FS_EXTENSION_LEN ||
1066
1074
ext_cnt >= COMPRESS_EXT_NUM ) {
1067
- f2fs_err (sbi , "invalid extension length/number" );
1075
+ f2fs_err (NULL , "invalid extension length/number" );
1068
1076
return - EINVAL ;
1069
1077
}
1070
1078
@@ -1078,7 +1086,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
1078
1086
break ;
1079
1087
case Opt_nocompress_extension :
1080
1088
if (!f2fs_sb_has_compression (sbi )) {
1081
- f2fs_info (sbi , "Image doesn't support compression" );
1089
+ f2fs_info (NULL , "Image doesn't support compression" );
1082
1090
break ;
1083
1091
}
1084
1092
name = param -> string ;
@@ -1087,7 +1095,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
1087
1095
1088
1096
if (strlen (name ) >= F2FS_EXTENSION_LEN ||
1089
1097
noext_cnt >= COMPRESS_EXT_NUM ) {
1090
- f2fs_err (sbi , "invalid extension length/number" );
1098
+ f2fs_err (NULL , "invalid extension length/number" );
1091
1099
return - EINVAL ;
1092
1100
}
1093
1101
@@ -1101,21 +1109,21 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
1101
1109
break ;
1102
1110
case Opt_compress_chksum :
1103
1111
if (!f2fs_sb_has_compression (sbi )) {
1104
- f2fs_info (sbi , "Image doesn't support compression" );
1112
+ f2fs_info (NULL , "Image doesn't support compression" );
1105
1113
break ;
1106
1114
}
1107
1115
F2FS_OPTION (sbi ).compress_chksum = true;
1108
1116
break ;
1109
1117
case Opt_compress_mode :
1110
1118
if (!f2fs_sb_has_compression (sbi )) {
1111
- f2fs_info (sbi , "Image doesn't support compression" );
1119
+ f2fs_info (NULL , "Image doesn't support compression" );
1112
1120
break ;
1113
1121
}
1114
1122
F2FS_OPTION (sbi ).compress_mode = result .uint_32 ;
1115
1123
break ;
1116
1124
case Opt_compress_cache :
1117
1125
if (!f2fs_sb_has_compression (sbi )) {
1118
- f2fs_info (sbi , "Image doesn't support compression" );
1126
+ f2fs_info (NULL , "Image doesn't support compression" );
1119
1127
break ;
1120
1128
}
1121
1129
set_opt (sbi , COMPRESS_CACHE );
@@ -1128,7 +1136,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
1128
1136
case Opt_compress_chksum :
1129
1137
case Opt_compress_mode :
1130
1138
case Opt_compress_cache :
1131
- f2fs_info (sbi , "compression options not supported" );
1139
+ f2fs_info (NULL , "compression options not supported" );
1132
1140
break ;
1133
1141
#endif
1134
1142
case Opt_atgc :
@@ -1213,17 +1221,17 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
1213
1221
return - EINVAL ;
1214
1222
#else
1215
1223
if (f2fs_sb_has_quota_ino (sbi ) && !f2fs_readonly (sbi -> sb )) {
1216
- f2fs_info (sbi , "Filesystem with quota feature cannot be mounted RDWR without CONFIG_QUOTA" );
1224
+ f2fs_info (NULL , "Filesystem with quota feature cannot be mounted RDWR without CONFIG_QUOTA" );
1217
1225
return - EINVAL ;
1218
1226
}
1219
1227
if (f2fs_sb_has_project_quota (sbi ) && !f2fs_readonly (sbi -> sb )) {
1220
- f2fs_err (sbi , "Filesystem with project quota feature cannot be mounted RDWR without CONFIG_QUOTA" );
1228
+ f2fs_err (NULL , "Filesystem with project quota feature cannot be mounted RDWR without CONFIG_QUOTA" );
1221
1229
return - EINVAL ;
1222
1230
}
1223
1231
#endif
1224
1232
1225
1233
if (!IS_ENABLED (CONFIG_UNICODE ) && f2fs_sb_has_casefold (sbi )) {
1226
- f2fs_err (sbi ,
1234
+ f2fs_err (NULL ,
1227
1235
"Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE" );
1228
1236
return - EINVAL ;
1229
1237
}
@@ -1237,24 +1245,24 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
1237
1245
#ifdef CONFIG_BLK_DEV_ZONED
1238
1246
if (F2FS_OPTION (sbi ).discard_unit !=
1239
1247
DISCARD_UNIT_SECTION ) {
1240
- f2fs_info (sbi , "Zoned block device doesn't need small discard, set discard_unit=section by default" );
1248
+ f2fs_info (NULL , "Zoned block device doesn't need small discard, set discard_unit=section by default" );
1241
1249
F2FS_OPTION (sbi ).discard_unit =
1242
1250
DISCARD_UNIT_SECTION ;
1243
1251
}
1244
1252
1245
1253
if (F2FS_OPTION (sbi ).fs_mode != FS_MODE_LFS ) {
1246
- f2fs_info (sbi , "Only lfs mode is allowed with zoned block device feature" );
1254
+ f2fs_info (NULL , "Only lfs mode is allowed with zoned block device feature" );
1247
1255
return - EINVAL ;
1248
1256
}
1249
1257
#else
1250
- f2fs_err (sbi , "Zoned block device support is not enabled" );
1258
+ f2fs_err (NULL , "Zoned block device support is not enabled" );
1251
1259
return - EINVAL ;
1252
1260
#endif
1253
1261
}
1254
1262
1255
1263
#ifdef CONFIG_F2FS_FS_COMPRESSION
1256
1264
if (f2fs_test_compress_extension (sbi )) {
1257
- f2fs_err (sbi , "invalid compress or nocompress extension" );
1265
+ f2fs_err (NULL , "invalid compress or nocompress extension" );
1258
1266
return - EINVAL ;
1259
1267
}
1260
1268
#endif
@@ -1264,11 +1272,11 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
1264
1272
1265
1273
if (!f2fs_sb_has_extra_attr (sbi ) ||
1266
1274
!f2fs_sb_has_flexible_inline_xattr (sbi )) {
1267
- f2fs_err (sbi , "extra_attr or flexible_inline_xattr feature is off" );
1275
+ f2fs_err (NULL , "extra_attr or flexible_inline_xattr feature is off" );
1268
1276
return - EINVAL ;
1269
1277
}
1270
1278
if (!test_opt (sbi , INLINE_XATTR )) {
1271
- f2fs_err (sbi , "inline_xattr_size option should be set with inline_xattr option" );
1279
+ f2fs_err (NULL , "inline_xattr_size option should be set with inline_xattr option" );
1272
1280
return - EINVAL ;
1273
1281
}
1274
1282
@@ -1277,24 +1285,24 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
1277
1285
1278
1286
if (F2FS_OPTION (sbi ).inline_xattr_size < min_size ||
1279
1287
F2FS_OPTION (sbi ).inline_xattr_size > max_size ) {
1280
- f2fs_err (sbi , "inline xattr size is out of range: %d ~ %d" ,
1288
+ f2fs_err (NULL , "inline xattr size is out of range: %d ~ %d" ,
1281
1289
min_size , max_size );
1282
1290
return - EINVAL ;
1283
1291
}
1284
1292
}
1285
1293
1286
1294
if (test_opt (sbi , ATGC ) && f2fs_lfs_mode (sbi )) {
1287
- f2fs_err (sbi , "LFS is not compatible with ATGC" );
1295
+ f2fs_err (NULL , "LFS is not compatible with ATGC" );
1288
1296
return - EINVAL ;
1289
1297
}
1290
1298
1291
1299
if (f2fs_is_readonly (sbi ) && test_opt (sbi , FLUSH_MERGE )) {
1292
- f2fs_err (sbi , "FLUSH_MERGE not compatible with readonly mode" );
1300
+ f2fs_err (NULL , "FLUSH_MERGE not compatible with readonly mode" );
1293
1301
return - EINVAL ;
1294
1302
}
1295
1303
1296
1304
if (f2fs_sb_has_readonly (sbi ) && !f2fs_readonly (sbi -> sb )) {
1297
- f2fs_err (sbi , "Allow to mount readonly mode only" );
1305
+ f2fs_err (NULL , "Allow to mount readonly mode only" );
1298
1306
return - EROFS ;
1299
1307
}
1300
1308
0 commit comments