diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-10 23:29:06 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-01 11:47:43 -0500 |
commit | 311e446a414885aed71bc8106bdc4874774343c4 (patch) | |
tree | 1e317a603ba0dfe4a500d35c1e3ac053730e0298 /fs | |
parent | 1f75ba4e65c54ff0517d7cd073afceb0751d1a32 (diff) | |
download | lwn-311e446a414885aed71bc8106bdc4874774343c4.tar.gz lwn-311e446a414885aed71bc8106bdc4874774343c4.zip |
bcachefs: bch2_btree_path_to_text() -> btree_path_idx_t
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/btree_iter.c | 12 | ||||
-rw-r--r-- | fs/bcachefs/btree_iter.h | 7 |
2 files changed, 12 insertions, 7 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index 0f904a79d4e5..95c0a50ae03f 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -1413,11 +1413,12 @@ void bch2_dump_trans_updates(struct btree_trans *trans) printbuf_exit(&buf); } -noinline __cold -void bch2_btree_path_to_text(struct printbuf *out, struct btree_path *path) +static void bch2_btree_path_to_text(struct printbuf *out, struct btree_trans *trans, btree_path_idx_t path_idx) { + struct btree_path *path = trans->paths + path_idx; + 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->should_be_locked ? 'S' : ' ', bch2_btree_id_str(path->btree_id), @@ -1436,13 +1437,12 @@ void __bch2_trans_paths_to_text(struct printbuf *out, struct btree_trans *trans, bool nosort) { struct trans_for_each_path_inorder_iter iter; - struct btree_path *path; if (!nosort) btree_trans_sort_paths(trans); - trans_for_each_path_inorder(trans, path, iter) - bch2_btree_path_to_text(out, path); + trans_for_each_path_idx_inorder(trans, iter) + bch2_btree_path_to_text(out, trans, iter.path_idx); } noinline __cold diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h index a4d1d26c706d..173c91e5f6b0 100644 --- a/fs/bcachefs/btree_iter.h +++ b/fs/bcachefs/btree_iter.h @@ -125,6 +125,12 @@ static inline struct btree_path *prev_btree_path(struct btree_trans *trans, stru : 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 { btree_path_idx_t sorted_idx; btree_path_idx_t path_idx; @@ -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_btree_path_to_text(struct printbuf *, struct btree_path *); void bch2_trans_paths_to_text(struct printbuf *, struct btree_trans *); void bch2_dump_trans_updates(struct btree_trans *); void bch2_dump_trans_paths_updates(struct btree_trans *); |