Pretty printing of sizes could introduce spaces and break
the expected space-separated format.

Signed-off-by: Gabriel de Perthuis <g2p.c...@gmail.com>
---
v2: Tested and working this time

 fs/bcachefs/opts.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c
index b1cf88905b816..633137567f463 100644
--- a/fs/bcachefs/opts.c
+++ b/fs/bcachefs/opts.c
@@ -452,25 +452,29 @@ int bch2_opt_parse(struct bch_fs *c,
 void bch2_opt_to_text(struct printbuf *out,
                      struct bch_fs *c, struct bch_sb *sb,
                      const struct bch_option *opt, u64 v,
                      unsigned flags)
 {
+       enum opt_flags opt_flags = opt->flags;
+
        if (flags & OPT_SHOW_MOUNT_STYLE) {
                if (opt->type == BCH_OPT_BOOL) {
                        prt_printf(out, "%s%s",
                               v ? "" : "no",
                               opt->attr.name);
                        return;
                }
 
                prt_printf(out, "%s=", opt->attr.name);
+               // OPT_HUMAN_READABLE can introduce spaces which break the 
expected tabular format
+               opt_flags &= ~OPT_HUMAN_READABLE;
        }
 
        switch (opt->type) {
        case BCH_OPT_BOOL:
        case BCH_OPT_UINT:
-               if (opt->flags & OPT_HUMAN_READABLE)
+               if (opt_flags & OPT_HUMAN_READABLE)
                        prt_human_readable_u64(out, v);
                else
                        prt_printf(out, "%lli", v);
                break;
        case BCH_OPT_STR:
-- 
2.45.2


Reply via email to