summaryrefslogtreecommitdiff
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r--fs/f2fs/super.c90
1 files changed, 49 insertions, 41 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index fddd33b1118c..4f0cd790a24e 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -325,11 +325,19 @@ void f2fs_printk(struct f2fs_sb_info *sbi, bool limit_rate,
vaf.fmt = printk_skip_level(fmt);
vaf.va = &args;
if (limit_rate)
- printk_ratelimited("%c%cF2FS-fs (%s): %pV\n",
- KERN_SOH_ASCII, level, sbi->sb->s_id, &vaf);
+ if (sbi)
+ printk_ratelimited("%c%cF2FS-fs (%s): %pV\n",
+ KERN_SOH_ASCII, level, sbi->sb->s_id, &vaf);
+ else
+ printk_ratelimited("%c%cF2FS-fs: %pV\n",
+ KERN_SOH_ASCII, level, &vaf);
else
- printk("%c%cF2FS-fs (%s): %pV\n",
- KERN_SOH_ASCII, level, sbi->sb->s_id, &vaf);
+ if (sbi)
+ printk("%c%cF2FS-fs (%s): %pV\n",
+ KERN_SOH_ASCII, level, sbi->sb->s_id, &vaf);
+ else
+ printk("%c%cF2FS-fs: %pV\n",
+ KERN_SOH_ASCII, level, &vaf);
va_end(args);
}
@@ -739,13 +747,13 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
case Opt_discard:
if (result.negated) {
if (f2fs_hw_should_discard(sbi)) {
- f2fs_warn(sbi, "discard is required for zoned block devices");
+ f2fs_warn(NULL, "discard is required for zoned block devices");
return -EINVAL;
}
clear_opt(sbi, DISCARD);
} else {
if (!f2fs_hw_support_discard(sbi)) {
- f2fs_warn(sbi, "device does not support discard");
+ f2fs_warn(NULL, "device does not support discard");
break;
}
set_opt(sbi, DISCARD);
@@ -753,7 +761,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
break;
case Opt_noheap:
case Opt_heap:
- f2fs_warn(sbi, "heap/no_heap options were deprecated");
+ f2fs_warn(NULL, "heap/no_heap options were deprecated");
break;
#ifdef CONFIG_F2FS_FS_XATTR
case Opt_user_xattr:
@@ -776,7 +784,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
case Opt_user_xattr:
case Opt_inline_xattr:
case Opt_inline_xattr_size:
- f2fs_info(sbi, "%s options not supported", param->key);
+ f2fs_info(NULL, "%s options not supported", param->key);
break;
#endif
#ifdef CONFIG_F2FS_FS_POSIX_ACL
@@ -788,7 +796,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
break;
#else
case Opt_acl:
- f2fs_info(sbi, "%s options not supported", param->key);
+ f2fs_info(NULL, "%s options not supported", param->key);
break;
#endif
case Opt_active_logs:
@@ -842,7 +850,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
break;
case Opt_reserve_root:
if (test_opt(sbi, RESERVE_ROOT)) {
- f2fs_info(sbi, "Preserve previous reserve_root=%u",
+ f2fs_info(NULL, "Preserve previous reserve_root=%u",
F2FS_OPTION(sbi).root_reserved_blocks);
} else {
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)
#else
case Opt_fault_injection:
case Opt_fault_type:
- f2fs_info(sbi, "%s options not supported", param->key);
+ f2fs_info(NULL, "%s options not supported", param->key);
break;
#endif
case Opt_lazytime:
@@ -936,7 +944,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
case Opt_usrjquota:
case Opt_grpjquota:
case Opt_prjjquota:
- f2fs_info(sbi, "quota operations not supported");
+ f2fs_info(NULL, "quota operations not supported");
break;
#endif
case Opt_alloc:
@@ -954,7 +962,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
#ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT
set_opt(sbi, INLINECRYPT);
#else
- f2fs_info(sbi, "inline encryption not supported");
+ f2fs_info(NULL, "inline encryption not supported");
#endif
break;
case Opt_checkpoint:
@@ -1001,7 +1009,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
#ifdef CONFIG_F2FS_FS_COMPRESSION
case Opt_compress_algorithm:
if (!f2fs_sb_has_compression(sbi)) {
- f2fs_info(sbi, "Image doesn't support compression");
+ f2fs_info(NULL, "Image doesn't support compression");
break;
}
name = param->string;
@@ -1010,7 +1018,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
F2FS_OPTION(sbi).compress_level = 0;
F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZO;
#else
- f2fs_info(sbi, "kernel doesn't support lzo compression");
+ f2fs_info(NULL, "kernel doesn't support lzo compression");
#endif
} else if (!strncmp(name, "lz4", 3)) {
#ifdef CONFIG_F2FS_FS_LZ4
@@ -1019,7 +1027,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
return -EINVAL;
F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZ4;
#else
- f2fs_info(sbi, "kernel doesn't support lz4 compression");
+ f2fs_info(NULL, "kernel doesn't support lz4 compression");
#endif
} else if (!strncmp(name, "zstd", 4)) {
#ifdef CONFIG_F2FS_FS_ZSTD
@@ -1028,26 +1036,26 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
return -EINVAL;
F2FS_OPTION(sbi).compress_algorithm = COMPRESS_ZSTD;
#else
- f2fs_info(sbi, "kernel doesn't support zstd compression");
+ f2fs_info(NULL, "kernel doesn't support zstd compression");
#endif
} else if (!strcmp(name, "lzo-rle")) {
#ifdef CONFIG_F2FS_FS_LZORLE
F2FS_OPTION(sbi).compress_level = 0;
F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZORLE;
#else
- f2fs_info(sbi, "kernel doesn't support lzorle compression");
+ f2fs_info(NULL, "kernel doesn't support lzorle compression");
#endif
} else
return -EINVAL;
break;
case Opt_compress_log_size:
if (!f2fs_sb_has_compression(sbi)) {
- f2fs_info(sbi, "Image doesn't support compression");
+ f2fs_info(NULL, "Image doesn't support compression");
break;
}
if (result.uint_32 < MIN_COMPRESS_LOG_SIZE ||
result.uint_32 > MAX_COMPRESS_LOG_SIZE) {
- f2fs_err(sbi,
+ f2fs_err(NULL,
"Compress cluster log size is out of range");
return -EINVAL;
}
@@ -1055,7 +1063,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
break;
case Opt_compress_extension:
if (!f2fs_sb_has_compression(sbi)) {
- f2fs_info(sbi, "Image doesn't support compression");
+ f2fs_info(NULL, "Image doesn't support compression");
break;
}
name = param->string;
@@ -1064,7 +1072,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
if (strlen(name) >= F2FS_EXTENSION_LEN ||
ext_cnt >= COMPRESS_EXT_NUM) {
- f2fs_err(sbi, "invalid extension length/number");
+ f2fs_err(NULL, "invalid extension length/number");
return -EINVAL;
}
@@ -1078,7 +1086,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
break;
case Opt_nocompress_extension:
if (!f2fs_sb_has_compression(sbi)) {
- f2fs_info(sbi, "Image doesn't support compression");
+ f2fs_info(NULL, "Image doesn't support compression");
break;
}
name = param->string;
@@ -1087,7 +1095,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
if (strlen(name) >= F2FS_EXTENSION_LEN ||
noext_cnt >= COMPRESS_EXT_NUM) {
- f2fs_err(sbi, "invalid extension length/number");
+ f2fs_err(NULL, "invalid extension length/number");
return -EINVAL;
}
@@ -1101,21 +1109,21 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
break;
case Opt_compress_chksum:
if (!f2fs_sb_has_compression(sbi)) {
- f2fs_info(sbi, "Image doesn't support compression");
+ f2fs_info(NULL, "Image doesn't support compression");
break;
}
F2FS_OPTION(sbi).compress_chksum = true;
break;
case Opt_compress_mode:
if (!f2fs_sb_has_compression(sbi)) {
- f2fs_info(sbi, "Image doesn't support compression");
+ f2fs_info(NULL, "Image doesn't support compression");
break;
}
F2FS_OPTION(sbi).compress_mode = result.uint_32;
break;
case Opt_compress_cache:
if (!f2fs_sb_has_compression(sbi)) {
- f2fs_info(sbi, "Image doesn't support compression");
+ f2fs_info(NULL, "Image doesn't support compression");
break;
}
set_opt(sbi, COMPRESS_CACHE);
@@ -1128,7 +1136,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
case Opt_compress_chksum:
case Opt_compress_mode:
case Opt_compress_cache:
- f2fs_info(sbi, "compression options not supported");
+ f2fs_info(NULL, "compression options not supported");
break;
#endif
case Opt_atgc:
@@ -1213,17 +1221,17 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
return -EINVAL;
#else
if (f2fs_sb_has_quota_ino(sbi) && !f2fs_readonly(sbi->sb)) {
- f2fs_info(sbi, "Filesystem with quota feature cannot be mounted RDWR without CONFIG_QUOTA");
+ f2fs_info(NULL, "Filesystem with quota feature cannot be mounted RDWR without CONFIG_QUOTA");
return -EINVAL;
}
if (f2fs_sb_has_project_quota(sbi) && !f2fs_readonly(sbi->sb)) {
- f2fs_err(sbi, "Filesystem with project quota feature cannot be mounted RDWR without CONFIG_QUOTA");
+ f2fs_err(NULL, "Filesystem with project quota feature cannot be mounted RDWR without CONFIG_QUOTA");
return -EINVAL;
}
#endif
if (!IS_ENABLED(CONFIG_UNICODE) && f2fs_sb_has_casefold(sbi)) {
- f2fs_err(sbi,
+ f2fs_err(NULL,
"Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE");
return -EINVAL;
}
@@ -1237,24 +1245,24 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
#ifdef CONFIG_BLK_DEV_ZONED
if (F2FS_OPTION(sbi).discard_unit !=
DISCARD_UNIT_SECTION) {
- f2fs_info(sbi, "Zoned block device doesn't need small discard, set discard_unit=section by default");
+ f2fs_info(NULL, "Zoned block device doesn't need small discard, set discard_unit=section by default");
F2FS_OPTION(sbi).discard_unit =
DISCARD_UNIT_SECTION;
}
if (F2FS_OPTION(sbi).fs_mode != FS_MODE_LFS) {
- f2fs_info(sbi, "Only lfs mode is allowed with zoned block device feature");
+ f2fs_info(NULL, "Only lfs mode is allowed with zoned block device feature");
return -EINVAL;
}
#else
- f2fs_err(sbi, "Zoned block device support is not enabled");
+ f2fs_err(NULL, "Zoned block device support is not enabled");
return -EINVAL;
#endif
}
#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_test_compress_extension(sbi)) {
- f2fs_err(sbi, "invalid compress or nocompress extension");
+ f2fs_err(NULL, "invalid compress or nocompress extension");
return -EINVAL;
}
#endif
@@ -1264,11 +1272,11 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
if (!f2fs_sb_has_extra_attr(sbi) ||
!f2fs_sb_has_flexible_inline_xattr(sbi)) {
- f2fs_err(sbi, "extra_attr or flexible_inline_xattr feature is off");
+ f2fs_err(NULL, "extra_attr or flexible_inline_xattr feature is off");
return -EINVAL;
}
if (!test_opt(sbi, INLINE_XATTR)) {
- f2fs_err(sbi, "inline_xattr_size option should be set with inline_xattr option");
+ f2fs_err(NULL, "inline_xattr_size option should be set with inline_xattr option");
return -EINVAL;
}
@@ -1277,24 +1285,24 @@ static int f2fs_validate_options(struct f2fs_sb_info *sbi)
if (F2FS_OPTION(sbi).inline_xattr_size < min_size ||
F2FS_OPTION(sbi).inline_xattr_size > max_size) {
- f2fs_err(sbi, "inline xattr size is out of range: %d ~ %d",
+ f2fs_err(NULL, "inline xattr size is out of range: %d ~ %d",
min_size, max_size);
return -EINVAL;
}
}
if (test_opt(sbi, ATGC) && f2fs_lfs_mode(sbi)) {
- f2fs_err(sbi, "LFS is not compatible with ATGC");
+ f2fs_err(NULL, "LFS is not compatible with ATGC");
return -EINVAL;
}
if (f2fs_is_readonly(sbi) && test_opt(sbi, FLUSH_MERGE)) {
- f2fs_err(sbi, "FLUSH_MERGE not compatible with readonly mode");
+ f2fs_err(NULL, "FLUSH_MERGE not compatible with readonly mode");
return -EINVAL;
}
if (f2fs_sb_has_readonly(sbi) && !f2fs_readonly(sbi->sb)) {
- f2fs_err(sbi, "Allow to mount readonly mode only");
+ f2fs_err(NULL, "Allow to mount readonly mode only");
return -EROFS;
}