@@ -325,11 +325,19 @@ void f2fs_printk(struct f2fs_sb_info *sbi, bool limit_rate,
325325 vaf .fmt = printk_skip_level (fmt );
326326 vaf .va = & args ;
327327 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 );
330334 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 );
333341
334342 va_end (args );
335343}
@@ -739,21 +747,21 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
739747 case Opt_discard :
740748 if (result .negated ) {
741749 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" );
743751 return - EINVAL ;
744752 }
745753 clear_opt (sbi , DISCARD );
746754 } else {
747755 if (!f2fs_hw_support_discard (sbi )) {
748- f2fs_warn (sbi , "device does not support discard" );
756+ f2fs_warn (NULL , "device does not support discard" );
749757 break ;
750758 }
751759 set_opt (sbi , DISCARD );
752760 }
753761 break ;
754762 case Opt_noheap :
755763 case Opt_heap :
756- f2fs_warn (sbi , "heap/no_heap options were deprecated" );
764+ f2fs_warn (NULL , "heap/no_heap options were deprecated" );
757765 break ;
758766#ifdef CONFIG_F2FS_FS_XATTR
759767 case Opt_user_xattr :
@@ -776,7 +784,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
776784 case Opt_user_xattr :
777785 case Opt_inline_xattr :
778786 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 );
780788 break ;
781789#endif
782790#ifdef CONFIG_F2FS_FS_POSIX_ACL
@@ -788,7 +796,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
788796 break ;
789797#else
790798 case Opt_acl :
791- f2fs_info (sbi , "%s options not supported" , param -> key );
799+ f2fs_info (NULL , "%s options not supported" , param -> key );
792800 break ;
793801#endif
794802 case Opt_active_logs :
@@ -842,7 +850,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
842850 break ;
843851 case Opt_reserve_root :
844852 if (test_opt (sbi , RESERVE_ROOT )) {
845- f2fs_info (sbi , "Preserve previous reserve_root=%u" ,
853+ f2fs_info (NULL , "Preserve previous reserve_root=%u" ,
846854 F2FS_OPTION (sbi ).root_reserved_blocks );
847855 } else {
848856 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)
873881#else
874882 case Opt_fault_injection :
875883 case Opt_fault_type :
876- f2fs_info (sbi , "%s options not supported" , param -> key );
884+ f2fs_info (NULL , "%s options not supported" , param -> key );
877885 break ;
878886#endif
879887 case Opt_lazytime :
@@ -936,7 +944,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
936944 case Opt_usrjquota :
937945 case Opt_grpjquota :
938946 case Opt_prjjquota :
939- f2fs_info (sbi , "quota operations not supported" );
947+ f2fs_info (NULL , "quota operations not supported" );
940948 break ;
941949#endif
942950 case Opt_alloc :
@@ -954,7 +962,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
954962#ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT
955963 set_opt (sbi , INLINECRYPT );
956964#else
957- f2fs_info (sbi , "inline encryption not supported" );
965+ f2fs_info (NULL , "inline encryption not supported" );
958966#endif
959967 break ;
960968 case Opt_checkpoint :
@@ -1001,7 +1009,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
10011009#ifdef CONFIG_F2FS_FS_COMPRESSION
10021010 case Opt_compress_algorithm :
10031011 if (!f2fs_sb_has_compression (sbi )) {
1004- f2fs_info (sbi , "Image doesn't support compression" );
1012+ f2fs_info (NULL , "Image doesn't support compression" );
10051013 break ;
10061014 }
10071015 name = param -> string ;
@@ -1010,7 +1018,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
10101018 F2FS_OPTION (sbi ).compress_level = 0 ;
10111019 F2FS_OPTION (sbi ).compress_algorithm = COMPRESS_LZO ;
10121020#else
1013- f2fs_info (sbi , "kernel doesn't support lzo compression" );
1021+ f2fs_info (NULL , "kernel doesn't support lzo compression" );
10141022#endif
10151023 } else if (!strncmp (name , "lz4" , 3 )) {
10161024#ifdef CONFIG_F2FS_FS_LZ4
@@ -1019,7 +1027,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
10191027 return - EINVAL ;
10201028 F2FS_OPTION (sbi ).compress_algorithm = COMPRESS_LZ4 ;
10211029#else
1022- f2fs_info (sbi , "kernel doesn't support lz4 compression" );
1030+ f2fs_info (NULL , "kernel doesn't support lz4 compression" );
10231031#endif
10241032 } else if (!strncmp (name , "zstd" , 4 )) {
10251033#ifdef CONFIG_F2FS_FS_ZSTD
@@ -1028,34 +1036,34 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
10281036 return - EINVAL ;
10291037 F2FS_OPTION (sbi ).compress_algorithm = COMPRESS_ZSTD ;
10301038#else
1031- f2fs_info (sbi , "kernel doesn't support zstd compression" );
1039+ f2fs_info (NULL , "kernel doesn't support zstd compression" );
10321040#endif
10331041 } else if (!strcmp (name , "lzo-rle" )) {
10341042#ifdef CONFIG_F2FS_FS_LZORLE
10351043 F2FS_OPTION (sbi ).compress_level = 0 ;
10361044 F2FS_OPTION (sbi ).compress_algorithm = COMPRESS_LZORLE ;
10371045#else
1038- f2fs_info (sbi , "kernel doesn't support lzorle compression" );
1046+ f2fs_info (NULL , "kernel doesn't support lzorle compression" );
10391047#endif
10401048 } else
10411049 return - EINVAL ;
10421050 break ;
10431051 case Opt_compress_log_size :
10441052 if (!f2fs_sb_has_compression (sbi )) {
1045- f2fs_info (sbi , "Image doesn't support compression" );
1053+ f2fs_info (NULL , "Image doesn't support compression" );
10461054 break ;
10471055 }
10481056 if (result .uint_32 < MIN_COMPRESS_LOG_SIZE ||
10491057 result .uint_32 > MAX_COMPRESS_LOG_SIZE ) {
1050- f2fs_err (sbi ,
1058+ f2fs_err (NULL ,
10511059 "Compress cluster log size is out of range" );
10521060 return - EINVAL ;
10531061 }
10541062 F2FS_OPTION (sbi ).compress_log_size = result .uint_32 ;
10551063 break ;
10561064 case Opt_compress_extension :
10571065 if (!f2fs_sb_has_compression (sbi )) {
1058- f2fs_info (sbi , "Image doesn't support compression" );
1066+ f2fs_info (NULL , "Image doesn't support compression" );
10591067 break ;
10601068 }
10611069 name = param -> string ;
@@ -1064,7 +1072,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
10641072
10651073 if (strlen (name ) >= F2FS_EXTENSION_LEN ||
10661074 ext_cnt >= COMPRESS_EXT_NUM ) {
1067- f2fs_err (sbi , "invalid extension length/number" );
1075+ f2fs_err (NULL , "invalid extension length/number" );
10681076 return - EINVAL ;
10691077 }
10701078
@@ -1078,7 +1086,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
10781086 break ;
10791087 case Opt_nocompress_extension :
10801088 if (!f2fs_sb_has_compression (sbi )) {
1081- f2fs_info (sbi , "Image doesn't support compression" );
1089+ f2fs_info (NULL , "Image doesn't support compression" );
10821090 break ;
10831091 }
10841092 name = param -> string ;
@@ -1087,7 +1095,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
10871095
10881096 if (strlen (name ) >= F2FS_EXTENSION_LEN ||
10891097 noext_cnt >= COMPRESS_EXT_NUM ) {
1090- f2fs_err (sbi , "invalid extension length/number" );
1098+ f2fs_err (NULL , "invalid extension length/number" );
10911099 return - EINVAL ;
10921100 }
10931101
@@ -1101,21 +1109,21 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
11011109 break ;
11021110 case Opt_compress_chksum :
11031111 if (!f2fs_sb_has_compression (sbi )) {
1104- f2fs_info (sbi , "Image doesn't support compression" );
1112+ f2fs_info (NULL , "Image doesn't support compression" );
11051113 break ;
11061114 }
11071115 F2FS_OPTION (sbi ).compress_chksum = true;
11081116 break ;
11091117 case Opt_compress_mode :
11101118 if (!f2fs_sb_has_compression (sbi )) {
1111- f2fs_info (sbi , "Image doesn't support compression" );
1119+ f2fs_info (NULL , "Image doesn't support compression" );
11121120 break ;
11131121 }
11141122 F2FS_OPTION (sbi ).compress_mode = result .uint_32 ;
11151123 break ;
11161124 case Opt_compress_cache :
11171125 if (!f2fs_sb_has_compression (sbi )) {
1118- f2fs_info (sbi , "Image doesn't support compression" );
1126+ f2fs_info (NULL , "Image doesn't support compression" );
11191127 break ;
11201128 }
11211129 set_opt (sbi , COMPRESS_CACHE );
@@ -1128,7 +1136,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
11281136 case Opt_compress_chksum :
11291137 case Opt_compress_mode :
11301138 case Opt_compress_cache :
1131- f2fs_info (sbi , "compression options not supported" );
1139+ f2fs_info (NULL , "compression options not supported" );
11321140 break ;
11331141#endif
11341142 case Opt_atgc :
@@ -1213,17 +1221,17 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
12131221 return - EINVAL ;
12141222#else
12151223 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" );
12171225 return - EINVAL ;
12181226 }
12191227 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" );
12211229 return - EINVAL ;
12221230 }
12231231#endif
12241232
12251233 if (!IS_ENABLED (CONFIG_UNICODE ) && f2fs_sb_has_casefold (sbi )) {
1226- f2fs_err (sbi ,
1234+ f2fs_err (NULL ,
12271235 "Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE" );
12281236 return - EINVAL ;
12291237 }
@@ -1237,24 +1245,24 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
12371245#ifdef CONFIG_BLK_DEV_ZONED
12381246 if (F2FS_OPTION (sbi ).discard_unit !=
12391247 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" );
12411249 F2FS_OPTION (sbi ).discard_unit =
12421250 DISCARD_UNIT_SECTION ;
12431251 }
12441252
12451253 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" );
12471255 return - EINVAL ;
12481256 }
12491257#else
1250- f2fs_err (sbi , "Zoned block device support is not enabled" );
1258+ f2fs_err (NULL , "Zoned block device support is not enabled" );
12511259 return - EINVAL ;
12521260#endif
12531261 }
12541262
12551263#ifdef CONFIG_F2FS_FS_COMPRESSION
12561264 if (f2fs_test_compress_extension (sbi )) {
1257- f2fs_err (sbi , "invalid compress or nocompress extension" );
1265+ f2fs_err (NULL , "invalid compress or nocompress extension" );
12581266 return - EINVAL ;
12591267 }
12601268#endif
@@ -1264,11 +1272,11 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
12641272
12651273 if (!f2fs_sb_has_extra_attr (sbi ) ||
12661274 !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" );
12681276 return - EINVAL ;
12691277 }
12701278 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" );
12721280 return - EINVAL ;
12731281 }
12741282
@@ -1277,24 +1285,24 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
12771285
12781286 if (F2FS_OPTION (sbi ).inline_xattr_size < min_size ||
12791287 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" ,
12811289 min_size , max_size );
12821290 return - EINVAL ;
12831291 }
12841292 }
12851293
12861294 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" );
12881296 return - EINVAL ;
12891297 }
12901298
12911299 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" );
12931301 return - EINVAL ;
12941302 }
12951303
12961304 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" );
12981306 return - EROFS ;
12991307 }
13001308
0 commit comments