summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2024-01-26 23:19:16 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2024-02-05 18:58:40 -0800
commitb1c9d3f833ba60a288db111d7fe38edfeb9b8fbb (patch)
tree10f911e0e072abaec2b6ef877c958cc3dbdf4c8f /fs/f2fs/super.c
parentc2034ef6192a65a986a45c2aa2ed05824fdc0e9f (diff)
downloadlinux-b1c9d3f833ba60a288db111d7fe38edfeb9b8fbb.tar.gz
linux-b1c9d3f833ba60a288db111d7fe38edfeb9b8fbb.tar.bz2
linux-b1c9d3f833ba60a288db111d7fe38edfeb9b8fbb.zip
f2fs: support printk_ratelimited() in f2fs_printk()
This patch supports using printk_ratelimited() in f2fs_printk(), and wrap ratelimited f2fs_printk() into f2fs_{err,warn,info}_ratelimited(), then, use these new helps to clean up codes. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r--fs/f2fs/super.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index e2c066fbc0fa..3e2a5e3b3e99 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -264,7 +264,8 @@ static match_table_t f2fs_tokens = {
{Opt_err, NULL},
};
-void f2fs_printk(struct f2fs_sb_info *sbi, const char *fmt, ...)
+void f2fs_printk(struct f2fs_sb_info *sbi, bool limit_rate,
+ const char *fmt, ...)
{
struct va_format vaf;
va_list args;
@@ -275,8 +276,12 @@ void f2fs_printk(struct f2fs_sb_info *sbi, const char *fmt, ...)
level = printk_get_level(fmt);
vaf.fmt = printk_skip_level(fmt);
vaf.va = &args;
- printk("%c%cF2FS-fs (%s): %pV\n",
- KERN_SOH_ASCII, level, sbi->sb->s_id, &vaf);
+ if (limit_rate)
+ printk_ratelimited("%c%cF2FS-fs (%s): %pV\n",
+ KERN_SOH_ASCII, level, sbi->sb->s_id, &vaf);
+ else
+ printk("%c%cF2FS-fs (%s): %pV\n",
+ KERN_SOH_ASCII, level, sbi->sb->s_id, &vaf);
va_end(args);
}