From: Integral <integral@archlinuxcn.org>
To: kent.overstreet@linux.dev
Cc: integral@archlinuxcn.org, linux-bcachefs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2] bcachefs: indent error messages of invalid compression
Date: Tue, 8 Apr 2025 18:31:29 +0800 [thread overview]
Message-ID: <20250408103129.61829-1-integral@archlinuxcn.org> (raw)
In-Reply-To: <sd4nbvk24h5aiooqkzczyqfc33t7triwlsrp4neyd6wovmodak@lwvvuurcehbu>
This patch uses printbuf_indent_add_nextline() to set a consistent
indentation level for error messages of invalid compression.
In my previous patch [1], the newline is added by using '\n' in
the argument of prt_str(). This patch replaces prt_str() with
prt_printf() to make indentation level work correctly.
[1] Link: https://lore.kernel.org/20250406152659.205997-2-integral@archlinuxcn.org
Signed-off-by: Integral <integral@archlinuxcn.org>
---
fs/bcachefs/compress.c | 4 ++--
fs/bcachefs/opts.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c
index d68c3c7896a3..1bca61d17092 100644
--- a/fs/bcachefs/compress.c
+++ b/fs/bcachefs/compress.c
@@ -714,7 +714,7 @@ int bch2_opt_compression_parse(struct bch_fs *c, const char *_val, u64 *res,
ret = match_string(bch2_compression_opts, -1, type_str);
if (ret < 0 && err)
- prt_str(err, "invalid compression type\n");
+ prt_printf(err, "invalid compression type\n");
if (ret < 0)
goto err;
@@ -729,7 +729,7 @@ int bch2_opt_compression_parse(struct bch_fs *c, const char *_val, u64 *res,
if (!ret && level > 15)
ret = -EINVAL;
if (ret < 0 && err)
- prt_str(err, "invalid compression level\n");
+ prt_printf(err, "invalid compression level\n");
if (ret < 0)
goto err;
diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c
index cd7b0cd293c7..f35fde896253 100644
--- a/fs/bcachefs/opts.c
+++ b/fs/bcachefs/opts.c
@@ -365,6 +365,7 @@ int bch2_opt_parse(struct bch_fs *c,
struct printbuf *err)
{
ssize_t ret;
+ printbuf_indent_add_nextline(err, 2);
switch (opt->type) {
case BCH_OPT_BOOL:
base-commit: 4d37602fceff942694069cf33cc55863277bd1c2
--
2.49.0
next prev parent reply other threads:[~2025-04-08 10:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 17:41 [PATCH] bcachefs: indent error messages of invalid compression Integral
2025-04-07 18:43 ` Kent Overstreet
2025-04-08 10:31 ` Integral [this message]
2025-04-10 0:05 ` [PATCH v2] " Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250408103129.61829-1-integral@archlinuxcn.org \
--to=integral@archlinuxcn.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).