diff options
| author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-04-22 06:03:33 -0400 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-05-21 20:14:31 -0400 |
| commit | dbc18c97f1f0d336e3c4f6bb50f34c5255216995 (patch) | |
| tree | 60d772c1d16e99fd0f8b4bfe1e894d08239ad9c6 /fs/bcachefs/util.c | |
| parent | bcachefs: Make various async objs visible in debugfs (diff) | |
| download | linux-dbc18c97f1f0d336e3c4f6bb50f34c5255216995.tar.gz linux-dbc18c97f1f0d336e3c4f6bb50f34c5255216995.zip | |
bcachefs: print_string_as_lines: avoid printing empty line
If the final line in in the message to be printed is blang, don't print
it.
This happens with indented printbufs - after a newline we emit spaces up
to the indent level.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/util.c')
| -rw-r--r-- | fs/bcachefs/util.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c index 7e6ebe8cd9ea..1cff407c8c9d 100644 --- a/fs/bcachefs/util.c +++ b/fs/bcachefs/util.c @@ -252,6 +252,16 @@ void bch2_prt_u64_base2(struct printbuf *out, u64 v) bch2_prt_u64_base2_nbits(out, v, fls64(v) ?: 1); } +static bool string_is_spaces(const char *str) +{ + while (*str) { + if (*str != ' ') + return false; + str++; + } + return true; +} + void bch2_print_string_as_lines(const char *prefix, const char *lines, bool nonblocking) { @@ -272,6 +282,9 @@ void bch2_print_string_as_lines(const char *prefix, const char *lines, while (*lines) { p = strchrnul(lines, '\n'); + if (!*p && string_is_spaces(lines)) + break; + printk("%s%.*s\n", prefix, (int) (p - lines), lines); if (!*p) break; |
