From dbaee468461bfa82e6453ca0e009e9661cc570da Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 20 Jan 2019 21:16:25 -0500 Subject: [PATCH] bcachefs: fix error message in device remove path Signed-off-by: Kent Overstreet --- fs/bcachefs/super.c | 4 ++-- fs/bcachefs/util.c | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 198f78dbb6d9..55069f40d04b 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -1258,8 +1258,8 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags) if (data) { char data_has_str[100]; - bch2_string_opt_to_text(&PBUF(data_has_str), - bch2_data_types, data); + bch2_flags_to_text(&PBUF(data_has_str), + bch2_data_types, data); bch_err(ca, "Remove failed, still has data (%s)", data_has_str); ret = -EBUSY; goto err; diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c index d998e51dbc30..9f3eafb3e0d4 100644 --- a/fs/bcachefs/util.c +++ b/fs/bcachefs/util.c @@ -134,6 +134,7 @@ void bch2_flags_to_text(struct printbuf *out, const char * const list[], u64 flags) { unsigned bit, nr = 0; + bool first = true; if (out->pos != out->end) *out->pos = '\0'; @@ -142,7 +143,10 @@ void bch2_flags_to_text(struct printbuf *out, nr++; while (flags && (bit = __ffs(flags)) < nr) { - pr_buf(out, "%s,", list[bit]); + pr_buf(out, "%s", list[bit]); + if (!first) + pr_buf(out, ","); + first = false; flags ^= 1 << bit; } }