bcachefs: fix error message in device remove path

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2019-01-20 21:16:25 -05:00 committed by Kent Overstreet
parent 919dbbd18b
commit dbaee46846
2 changed files with 7 additions and 3 deletions

View File

@ -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;

View File

@ -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;
}
}