mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 09:02:00 +00:00
bcachefs: Improve read_from_stale_dirty_pointer() message
With printbufs, it's now easy to build up multi-line log messages and emit them with one call, which is good because it prevents multiple multi-line log messages from getting Interspersed in the log buffer; this patch also improves the formatting and converts it to latest style. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
75f02de43f
commit
64afbbc909
@ -2089,22 +2089,28 @@ static noinline void read_from_stale_dirty_pointer(struct btree_trans *trans,
|
||||
struct printbuf buf = PRINTBUF;
|
||||
int ret;
|
||||
|
||||
bch2_bkey_val_to_text(&buf, c, k);
|
||||
bch2_fs_inconsistent(c, "Attempting to read from stale dirty pointer: %s", buf.buf);
|
||||
|
||||
bch2_trans_iter_init(trans, &iter, BTREE_ID_alloc,
|
||||
POS(ptr.dev, PTR_BUCKET_NR(ca, &ptr)),
|
||||
PTR_BUCKET_POS(c, &ptr),
|
||||
BTREE_ITER_CACHED);
|
||||
|
||||
ret = lockrestart_do(trans, bkey_err(k = bch2_btree_iter_peek_slot(&iter)));
|
||||
if (ret)
|
||||
goto out;
|
||||
pr_buf(&buf, "Attempting to read from stale dirty pointer:");
|
||||
pr_indent_push(&buf, 2);
|
||||
pr_newline(&buf);
|
||||
|
||||
bch2_bkey_val_to_text(&buf, c, k);
|
||||
bch_err(c, "%s", buf.buf);
|
||||
bch_err(c, "memory gen: %u", *bucket_gen(ca, iter.pos.offset));
|
||||
pr_newline(&buf);
|
||||
|
||||
pr_buf(&buf, "memory gen: %u", *bucket_gen(ca, iter.pos.offset));
|
||||
|
||||
ret = lockrestart_do(trans, bkey_err(k = bch2_btree_iter_peek_slot(&iter)));
|
||||
if (!ret) {
|
||||
pr_newline(&buf);
|
||||
bch2_bkey_val_to_text(&buf, c, k);
|
||||
}
|
||||
|
||||
bch2_fs_inconsistent(c, "%s", buf.buf);
|
||||
|
||||
bch2_trans_iter_exit(trans, &iter);
|
||||
out:
|
||||
printbuf_exit(&buf);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user