Commit b0b67378 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: trans_for_each_path_with_node() no longer uses path->idx

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent ccb7b08f
...@@ -418,8 +418,9 @@ void bch2_btree_path_fix_key_modified(struct btree_trans *trans, ...@@ -418,8 +418,9 @@ void bch2_btree_path_fix_key_modified(struct btree_trans *trans,
struct bkey_packed *where) struct bkey_packed *where)
{ {
struct btree_path *path; struct btree_path *path;
unsigned i;
trans_for_each_path_with_node(trans, b, path) { trans_for_each_path_with_node(trans, b, path, i) {
__bch2_btree_path_fix_key_modified(path, b, where); __bch2_btree_path_fix_key_modified(path, b, where);
bch2_btree_path_verify_level(trans, path, b->c.level); bch2_btree_path_verify_level(trans, path, b->c.level);
} }
...@@ -526,6 +527,7 @@ void bch2_btree_node_iter_fix(struct btree_trans *trans, ...@@ -526,6 +527,7 @@ void bch2_btree_node_iter_fix(struct btree_trans *trans,
{ {
struct bset_tree *t = bch2_bkey_to_bset_inlined(b, where); struct bset_tree *t = bch2_bkey_to_bset_inlined(b, where);
struct btree_path *linked; struct btree_path *linked;
unsigned i;
if (node_iter != &path->l[b->c.level].iter) { if (node_iter != &path->l[b->c.level].iter) {
__bch2_btree_node_iter_fix(path, b, node_iter, t, __bch2_btree_node_iter_fix(path, b, node_iter, t,
...@@ -535,7 +537,7 @@ void bch2_btree_node_iter_fix(struct btree_trans *trans, ...@@ -535,7 +537,7 @@ void bch2_btree_node_iter_fix(struct btree_trans *trans,
bch2_btree_node_iter_verify(node_iter, b); bch2_btree_node_iter_verify(node_iter, b);
} }
trans_for_each_path_with_node(trans, b, linked) { trans_for_each_path_with_node(trans, b, linked, i) {
__bch2_btree_node_iter_fix(linked, b, __bch2_btree_node_iter_fix(linked, b,
&linked->l[b->c.level].iter, t, &linked->l[b->c.level].iter, t,
where, clobber_u64s, new_u64s); where, clobber_u64s, new_u64s);
...@@ -714,8 +716,9 @@ void bch2_trans_node_add(struct btree_trans *trans, ...@@ -714,8 +716,9 @@ void bch2_trans_node_add(struct btree_trans *trans,
void bch2_trans_node_reinit_iter(struct btree_trans *trans, struct btree *b) void bch2_trans_node_reinit_iter(struct btree_trans *trans, struct btree *b)
{ {
struct btree_path *path; struct btree_path *path;
unsigned i;
trans_for_each_path_with_node(trans, b, path) trans_for_each_path_with_node(trans, b, path, i)
__btree_path_level_init(path, b->c.level); __btree_path_level_init(path, b->c.level);
bch2_trans_revalidate_updates_in_node(trans, b); bch2_trans_revalidate_updates_in_node(trans, b);
......
...@@ -151,22 +151,21 @@ static inline bool __path_has_node(const struct btree_path *path, ...@@ -151,22 +151,21 @@ static inline bool __path_has_node(const struct btree_path *path,
static inline struct btree_path * static inline struct btree_path *
__trans_next_path_with_node(struct btree_trans *trans, struct btree *b, __trans_next_path_with_node(struct btree_trans *trans, struct btree *b,
unsigned idx) unsigned *idx)
{ {
struct btree_path *path = __trans_next_path(trans, &idx); struct btree_path *path;
while ((path = __trans_next_path(trans, &idx)) && while ((path = __trans_next_path(trans, idx)) &&
!__path_has_node(path, b)) !__path_has_node(path, b))
idx++; (*idx)++;
return path; return path;
} }
#define trans_for_each_path_with_node(_trans, _b, _path) \ #define trans_for_each_path_with_node(_trans, _b, _path, _iter) \
for (_path = __trans_next_path_with_node((_trans), (_b), 1); \ for (_iter = 1; \
(_path); \ (_path = __trans_next_path_with_node((_trans), (_b), &_iter));\
_path = __trans_next_path_with_node((_trans), (_b), \ _iter++)
(_path)->idx + 1))
btree_path_idx_t __bch2_btree_path_make_mut(struct btree_trans *, btree_path_idx_t, btree_path_idx_t __bch2_btree_path_make_mut(struct btree_trans *, btree_path_idx_t,
bool, unsigned long); bool, unsigned long);
......
...@@ -175,6 +175,7 @@ bch2_btree_node_unlock_write_inlined(struct btree_trans *trans, struct btree_pat ...@@ -175,6 +175,7 @@ bch2_btree_node_unlock_write_inlined(struct btree_trans *trans, struct btree_pat
struct btree *b) struct btree *b)
{ {
struct btree_path *linked; struct btree_path *linked;
unsigned i;
EBUG_ON(path->l[b->c.level].b != b); EBUG_ON(path->l[b->c.level].b != b);
EBUG_ON(path->l[b->c.level].lock_seq != six_lock_seq(&b->c.lock)); EBUG_ON(path->l[b->c.level].lock_seq != six_lock_seq(&b->c.lock));
...@@ -182,7 +183,7 @@ bch2_btree_node_unlock_write_inlined(struct btree_trans *trans, struct btree_pat ...@@ -182,7 +183,7 @@ bch2_btree_node_unlock_write_inlined(struct btree_trans *trans, struct btree_pat
mark_btree_node_locked_noreset(path, b->c.level, BTREE_NODE_INTENT_LOCKED); mark_btree_node_locked_noreset(path, b->c.level, BTREE_NODE_INTENT_LOCKED);
trans_for_each_path_with_node(trans, b, linked) trans_for_each_path_with_node(trans, b, linked, i)
linked->l[b->c.level].lock_seq++; linked->l[b->c.level].lock_seq++;
six_unlock_write(&b->c.lock); six_unlock_write(&b->c.lock);
......
...@@ -1646,13 +1646,14 @@ bch2_btree_insert_keys_interior(struct btree_update *as, ...@@ -1646,13 +1646,14 @@ bch2_btree_insert_keys_interior(struct btree_update *as,
struct keylist *keys) struct keylist *keys)
{ {
struct btree_path *linked; struct btree_path *linked;
unsigned i;
__bch2_btree_insert_keys_interior(as, trans, path, b, __bch2_btree_insert_keys_interior(as, trans, path, b,
path->l[b->c.level].iter, keys); path->l[b->c.level].iter, keys);
btree_update_updated_node(as, b); btree_update_updated_node(as, b);
trans_for_each_path_with_node(trans, b, linked) trans_for_each_path_with_node(trans, b, linked, i)
bch2_btree_node_iter_peek(&linked->l[b->c.level].iter, b); bch2_btree_node_iter_peek(&linked->l[b->c.level].iter, b);
bch2_trans_verify_paths(trans); bch2_trans_verify_paths(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