Commit 3b0baf6f authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Internal btree iterator renaming

This just gives some internal helpers some better names.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 07fc72e1
...@@ -815,7 +815,7 @@ static inline struct bkey_s_c __btree_iter_unpack(struct btree_iter *iter, ...@@ -815,7 +815,7 @@ static inline struct bkey_s_c __btree_iter_unpack(struct btree_iter *iter,
} }
/* peek_all() doesn't skip deleted keys */ /* peek_all() doesn't skip deleted keys */
static inline struct bkey_s_c __btree_iter_peek_all(struct btree_iter *iter, static inline struct bkey_s_c btree_iter_level_peek_all(struct btree_iter *iter,
struct btree_iter_level *l, struct btree_iter_level *l,
struct bkey *u) struct bkey *u)
{ {
...@@ -823,14 +823,14 @@ static inline struct bkey_s_c __btree_iter_peek_all(struct btree_iter *iter, ...@@ -823,14 +823,14 @@ static inline struct bkey_s_c __btree_iter_peek_all(struct btree_iter *iter,
bch2_btree_node_iter_peek_all(&l->iter, l->b)); bch2_btree_node_iter_peek_all(&l->iter, l->b));
} }
static inline struct bkey_s_c __btree_iter_peek(struct btree_iter *iter, static inline struct bkey_s_c btree_iter_level_peek(struct btree_iter *iter,
struct btree_iter_level *l) struct btree_iter_level *l)
{ {
return __btree_iter_unpack(iter, l, &iter->k, return __btree_iter_unpack(iter, l, &iter->k,
bch2_btree_node_iter_peek(&l->iter, l->b)); bch2_btree_node_iter_peek(&l->iter, l->b));
} }
static inline struct bkey_s_c __btree_iter_prev(struct btree_iter *iter, static inline struct bkey_s_c btree_iter_level_prev(struct btree_iter *iter,
struct btree_iter_level *l) struct btree_iter_level *l)
{ {
return __btree_iter_unpack(iter, l, &iter->k, return __btree_iter_unpack(iter, l, &iter->k,
...@@ -1546,7 +1546,7 @@ struct bkey_s_c bch2_btree_iter_peek(struct btree_iter *iter) ...@@ -1546,7 +1546,7 @@ struct bkey_s_c bch2_btree_iter_peek(struct btree_iter *iter)
if (unlikely(ret)) if (unlikely(ret))
return bkey_s_c_err(ret); return bkey_s_c_err(ret);
k = __btree_iter_peek(iter, l); k = btree_iter_level_peek(iter, l);
if (likely(k.k)) if (likely(k.k))
break; break;
...@@ -1600,7 +1600,7 @@ static struct bkey_s_c __btree_trans_updates_peek(struct btree_iter *iter) ...@@ -1600,7 +1600,7 @@ static struct bkey_s_c __btree_trans_updates_peek(struct btree_iter *iter)
static struct bkey_s_c __bch2_btree_iter_peek_with_updates(struct btree_iter *iter) static struct bkey_s_c __bch2_btree_iter_peek_with_updates(struct btree_iter *iter)
{ {
struct btree_iter_level *l = &iter->l[0]; struct btree_iter_level *l = &iter->l[0];
struct bkey_s_c k = __btree_iter_peek(iter, l); struct bkey_s_c k = btree_iter_level_peek(iter, l);
struct bkey_s_c u = __btree_trans_updates_peek(iter); struct bkey_s_c u = __btree_trans_updates_peek(iter);
if (k.k && (!u.k || bkey_cmp(k.k->p, u.k->p) < 0)) if (k.k && (!u.k || bkey_cmp(k.k->p, u.k->p) < 0))
...@@ -1681,12 +1681,12 @@ struct bkey_s_c bch2_btree_iter_peek_prev(struct btree_iter *iter) ...@@ -1681,12 +1681,12 @@ struct bkey_s_c bch2_btree_iter_peek_prev(struct btree_iter *iter)
goto no_key; goto no_key;
} }
k = __btree_iter_peek(iter, l); k = btree_iter_level_peek(iter, l);
if (!k.k || if (!k.k ||
((iter->flags & BTREE_ITER_IS_EXTENTS) ((iter->flags & BTREE_ITER_IS_EXTENTS)
? bkey_cmp(bkey_start_pos(k.k), iter->pos) >= 0 ? bkey_cmp(bkey_start_pos(k.k), iter->pos) >= 0
: bkey_cmp(bkey_start_pos(k.k), iter->pos) > 0)) : bkey_cmp(bkey_start_pos(k.k), iter->pos) > 0))
k = __btree_iter_prev(iter, l); k = btree_iter_level_prev(iter, l);
if (likely(k.k)) if (likely(k.k))
break; break;
...@@ -1709,7 +1709,7 @@ struct bkey_s_c bch2_btree_iter_peek_prev(struct btree_iter *iter) ...@@ -1709,7 +1709,7 @@ struct bkey_s_c bch2_btree_iter_peek_prev(struct btree_iter *iter)
return k; return k;
no_key: no_key:
/* /*
* __btree_iter_peek() may have set iter->k to a key we didn't want, and * btree_iter_level_peek() may have set iter->k to a key we didn't want, and
* then we errored going to the previous leaf - make sure it's * then we errored going to the previous leaf - make sure it's
* consistent with iter->pos: * consistent with iter->pos:
*/ */
...@@ -1792,7 +1792,7 @@ struct bkey_s_c bch2_btree_iter_peek_slot(struct btree_iter *iter) ...@@ -1792,7 +1792,7 @@ struct bkey_s_c bch2_btree_iter_peek_slot(struct btree_iter *iter)
if (unlikely(ret)) if (unlikely(ret))
return bkey_s_c_err(ret); return bkey_s_c_err(ret);
k = __btree_iter_peek_all(iter, l, &iter->k); k = btree_iter_level_peek_all(iter, l, &iter->k);
EBUG_ON(k.k && bkey_deleted(k.k) && bkey_cmp(k.k->p, iter->pos) == 0); EBUG_ON(k.k && bkey_deleted(k.k) && bkey_cmp(k.k->p, iter->pos) == 0);
......
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