diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-04-08 00:28:09 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:30 +0300 |
commit | 1d8a268940045b73f43f86e6332bdfdfe64d0fa0 (patch) | |
tree | 216f70b5089ffbe9b5dcedef4719aa288171d175 /fs/bcachefs/btree_cache.c | |
parent | 11c7d3e8176a2e674faefa9d9d14210f5062326c (diff) | |
download | linux-1d8a268940045b73f43f86e6332bdfdfe64d0fa0.tar.xz |
bcachefs: Improve btree_bad_header()
In the future printbufs will be mempool-ified, so we shouldn't be using
more than one at a time if we don't have to.
This also fixes an extra trailing newline.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/btree_cache.c')
-rw-r--r-- | fs/bcachefs/btree_cache.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c index 0e3db9ee65d2..6557fcb24b21 100644 --- a/fs/bcachefs/btree_cache.c +++ b/fs/bcachefs/btree_cache.c @@ -767,31 +767,29 @@ static int lock_node_check_fn(struct six_lock *lock, void *p) static noinline void btree_bad_header(struct bch_fs *c, struct btree *b) { - struct printbuf buf1 = PRINTBUF; - struct printbuf buf2 = PRINTBUF; - struct printbuf buf3 = PRINTBUF; + struct printbuf buf = PRINTBUF; if (!test_bit(BCH_FS_INITIAL_GC_DONE, &c->flags)) return; - bch2_bkey_val_to_text(&buf1, c, bkey_i_to_s_c(&b->key)); - bch2_bpos_to_text(&buf2, b->data->min_key); - bch2_bpos_to_text(&buf3, b->data->max_key); - - bch2_fs_inconsistent(c, "btree node header doesn't match ptr\n" - "btree %s level %u\n" - "ptr: %s\n" - "header: btree %s level %llu\n" - "min %s max %s\n", - bch2_btree_ids[b->c.btree_id], b->c.level, - buf1.buf, - bch2_btree_ids[BTREE_NODE_ID(b->data)], - BTREE_NODE_LEVEL(b->data), - buf2.buf, buf3.buf); - - printbuf_exit(&buf3); - printbuf_exit(&buf2); - printbuf_exit(&buf1); + pr_buf(&buf, + "btree node header doesn't match ptr\n" + "btree %s level %u\n" + "ptr: ", + bch2_btree_ids[b->c.btree_id], b->c.level); + bch2_bkey_val_to_text(&buf, c, bkey_i_to_s_c(&b->key)); + + pr_buf(&buf, "\nheader: btree %s level %llu\n" + "min ", + bch2_btree_ids[BTREE_NODE_ID(b->data)], + BTREE_NODE_LEVEL(b->data)); + bch2_bpos_to_text(&buf, b->data->min_key); + + pr_buf(&buf, "\nmax "); + bch2_bpos_to_text(&buf, b->data->max_key); + + bch2_fs_inconsistent(c, "%s", buf.buf); + printbuf_exit(&buf); } static inline void btree_check_header(struct bch_fs *c, struct btree *b) |