summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-05-30 04:06:00 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2024-07-15 01:00:14 +0200
commit36008d5d01ad155e14fd9df876d4356433613088 (patch)
treec9a0d7d72c9f505158901e7a7f09d6b5d605f905 /fs/bcachefs/super.c
parentbcachefs: fsck_err() may now take a btree_trans (diff)
downloadlinux-36008d5d01ad155e14fd9df876d4356433613088.tar.xz
linux-36008d5d01ad155e14fd9df876d4356433613088.zip
bcachefs: Plumb more logging through stdio redirect
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r--fs/bcachefs/super.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index b9f851103297..c22a8ef2d2e1 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -89,6 +89,19 @@ const char * const bch2_fs_flag_strs[] = {
NULL
};
+void bch2_print_str(struct bch_fs *c, const char *str)
+{
+#ifdef __KERNEL__
+ struct stdio_redirect *stdio = bch2_fs_stdio_redirect(c);
+
+ if (unlikely(stdio)) {
+ bch2_stdio_redirect_printf(stdio, true, "%s", str);
+ return;
+ }
+#endif
+ bch2_print_string_as_lines(KERN_ERR, str);
+}
+
__printf(2, 0)
static void bch2_print_maybe_redirect(struct stdio_redirect *stdio, const char *fmt, va_list args)
{