Commit 311e446a authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bch2_btree_path_to_text() -> btree_path_idx_t

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 1f75ba4e
...@@ -1413,11 +1413,12 @@ void bch2_dump_trans_updates(struct btree_trans *trans) ...@@ -1413,11 +1413,12 @@ void bch2_dump_trans_updates(struct btree_trans *trans)
printbuf_exit(&buf); printbuf_exit(&buf);
} }
noinline __cold static void bch2_btree_path_to_text(struct printbuf *out, struct btree_trans *trans, btree_path_idx_t path_idx)
void bch2_btree_path_to_text(struct printbuf *out, struct btree_path *path)
{ {
struct btree_path *path = trans->paths + path_idx;
prt_printf(out, "path: idx %2u ref %u:%u %c %c btree=%s l=%u pos ", prt_printf(out, "path: idx %2u ref %u:%u %c %c btree=%s l=%u pos ",
path->idx, path->ref, path->intent_ref, path_idx, path->ref, path->intent_ref,
path->preserve ? 'P' : ' ', path->preserve ? 'P' : ' ',
path->should_be_locked ? 'S' : ' ', path->should_be_locked ? 'S' : ' ',
bch2_btree_id_str(path->btree_id), bch2_btree_id_str(path->btree_id),
...@@ -1436,13 +1437,12 @@ void __bch2_trans_paths_to_text(struct printbuf *out, struct btree_trans *trans, ...@@ -1436,13 +1437,12 @@ void __bch2_trans_paths_to_text(struct printbuf *out, struct btree_trans *trans,
bool nosort) bool nosort)
{ {
struct trans_for_each_path_inorder_iter iter; struct trans_for_each_path_inorder_iter iter;
struct btree_path *path;
if (!nosort) if (!nosort)
btree_trans_sort_paths(trans); btree_trans_sort_paths(trans);
trans_for_each_path_inorder(trans, path, iter) trans_for_each_path_idx_inorder(trans, iter)
bch2_btree_path_to_text(out, path); bch2_btree_path_to_text(out, trans, iter.path_idx);
} }
noinline __cold noinline __cold
......
...@@ -125,6 +125,12 @@ static inline struct btree_path *prev_btree_path(struct btree_trans *trans, stru ...@@ -125,6 +125,12 @@ static inline struct btree_path *prev_btree_path(struct btree_trans *trans, stru
: NULL; : NULL;
} }
#define trans_for_each_path_idx_inorder(_trans, _iter) \
for (_iter = (struct trans_for_each_path_inorder_iter) { 0 }; \
(_iter.path_idx = trans->sorted[_iter.sorted_idx], \
_iter.sorted_idx < (_trans)->nr_sorted); \
_iter.sorted_idx++)
struct trans_for_each_path_inorder_iter { struct trans_for_each_path_inorder_iter {
btree_path_idx_t sorted_idx; btree_path_idx_t sorted_idx;
btree_path_idx_t path_idx; btree_path_idx_t path_idx;
...@@ -835,7 +841,6 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans, ...@@ -835,7 +841,6 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans,
}) })
void bch2_trans_updates_to_text(struct printbuf *, struct btree_trans *); void bch2_trans_updates_to_text(struct printbuf *, struct btree_trans *);
void bch2_btree_path_to_text(struct printbuf *, struct btree_path *);
void bch2_trans_paths_to_text(struct printbuf *, struct btree_trans *); void bch2_trans_paths_to_text(struct printbuf *, struct btree_trans *);
void bch2_dump_trans_updates(struct btree_trans *); void bch2_dump_trans_updates(struct btree_trans *);
void bch2_dump_trans_paths_updates(struct btree_trans *); void bch2_dump_trans_paths_updates(struct btree_trans *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment