bcachefs: indent error messages of invalid compression
PATCH 1/1 bcachefs: indent error messages of invalid compression
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 '\n' with prt_newline() to make indentation level work correctly.
[1] Link: https://lore.kernel.org/[email protected]
--- fs/bcachefs/compress.c | 12 ++++++++---- fs/bcachefs/opts.c | 1 + 2 files changed, 9 insertions(+), 4 deletions(-)
fs/bcachefs/compress.c +8 -4
@@ -713,8 +713,10 @@ int bch2_opt_compression_parse(struct bch_fs *c, const char *_val, u64 *res, level_str = p; ret =match_string (bch2_compression_opts,-1 , type_str); -if (ret <0 && err) -prt_str (err,"invalid compression type\n" ); +if (ret <0 && err) { +prt_str (err,"invalid compression type" ); +prt_newline (err); + }if (ret <0 ) goto err;
@@ -728,8 +730,10 @@ int bch2_opt_compression_parse(struct bch_fs *c, const char *_val, u64 *res, ret = -EINVAL ;if (!ret && level >15 ) ret = -EINVAL ; -if (ret <0 && err) -prt_str (err,"invalid compression level\n" ); +if (ret <0 && err) { +prt_str (err,"invalid compression level" ); +prt_newline (err); + }if (ret <0 ) goto err;
fs/bcachefs/opts.c +1 -0
@@ -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
Signature · 1 line
2.49.0
Quoted 33 lines · Integral
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 '\n' withprt_newline()to make indentation level work correctly.[1] Link: https://lore.kernel.org/[email protected]
Signed-off-by Integral <[email protected]>--- fs/bcachefs/compress.c | 12 ++++++++---- fs/bcachefs/opts.c | 1 + 2 files changed, 9 insertions(+), 4 deletions(-)fs/bcachefs/compress.c +4
-2@@ -713,8 +713,10 @@ int bch2_opt_compression_parse(struct bch_fs *c, const char *_val, u64 *res, level_str = p; ret =match_string (bch2_compression_opts,-1 , type_str); -if (ret <0 && err) -prt_str (err,"invalid compression type\n" ); +if (ret <0 && err) { +prt_str (err,"invalid compression type" ); +prt_newline (err); + }if (ret <0 ) goto err;
fs/bcachefs/compress.c int bch2_opt_compression_parse(struct bch_fs *c, const char *_val, u64 *res, · line 734
Quoted 7 lines
fs/bcachefs/compress.c +2
-2@@ -728,8 +730,10 @@ int bch2_opt_compression_parse(struct bch_fs *c, const char *_val, u64 *res, ret = -EINVAL ;if (!ret && level >15 ) ret = -EINVAL ; -if (ret <0 && err) -prt_str (err,"invalid compression level\n" ); +if (ret <0 && err) { +prt_str (err,"invalid compression level" );
You can just change this to prt_printf() or prt_str_indented(), that'll interpret the \n correctly
Quoted 22 lines
fs/bcachefs/compress.c +2
-0+prt_newline (err); + }if (ret <0 ) goto err;fs/bcachefs/opts.c +1
-0@@ -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:
4d37602fceff942694069cf33cc55863277bd1c2Signature · 1 line
2.49.0
PATCH v2 1/1 bcachefs: indent error messages of invalid compression
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/[email protected]
--- fs/bcachefs/compress.c | 4 ++-- fs/bcachefs/opts.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
fs/bcachefs/compress.c +2 -2
@@ -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;
fs/bcachefs/opts.c +1 -0
@@ -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
Signature · 1 line
2.49.0
Kent Overstreet
AppliedQuoted 10 lines · Integral
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 replacesprt_str()withprt_printf()to make indentation level work correctly.[1] Link: https://lore.kernel.org/[email protected]
Signed-off-by Integral <[email protected]>
Applied
Quoted 44 lines
--- fs/bcachefs/compress.c | 4 ++-- fs/bcachefs/opts.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)fs/bcachefs/compress.c +2
-2@@ -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;fs/bcachefs/opts.c +1
-0@@ -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:
4d37602fceff942694069cf33cc55863277bd1c2Signature · 1 line
2.49.0