Commit dcced069 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Kill __btree_trans_peek_key_cache()

There was no reason for this to be a separate helper - we always want
the relock call that btree_trans_peek_key_cache() did.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent a52a4da4
...@@ -1846,7 +1846,7 @@ struct bkey_s_c btree_trans_peek_journal(struct btree_trans *trans, ...@@ -1846,7 +1846,7 @@ struct bkey_s_c btree_trans_peek_journal(struct btree_trans *trans,
* bkey_s_c_null: * bkey_s_c_null:
*/ */
static noinline static noinline
struct bkey_s_c __btree_trans_peek_key_cache(struct btree_iter *iter, struct bpos pos) struct bkey_s_c btree_trans_peek_key_cache(struct btree_iter *iter, struct bpos pos)
{ {
struct btree_trans *trans = iter->trans; struct btree_trans *trans = iter->trans;
struct bch_fs *c = trans->c; struct bch_fs *c = trans->c;
...@@ -1865,7 +1865,9 @@ struct bkey_s_c __btree_trans_peek_key_cache(struct btree_iter *iter, struct bpo ...@@ -1865,7 +1865,9 @@ struct bkey_s_c __btree_trans_peek_key_cache(struct btree_iter *iter, struct bpo
iter->key_cache_path = bch2_btree_path_set_pos(trans, iter->key_cache_path, pos, iter->key_cache_path = bch2_btree_path_set_pos(trans, iter->key_cache_path, pos,
iter->flags & BTREE_ITER_INTENT); iter->flags & BTREE_ITER_INTENT);
ret = bch2_btree_path_traverse(trans, iter->key_cache_path, iter->flags|BTREE_ITER_CACHED); ret = bch2_btree_path_traverse(trans, iter->key_cache_path,
iter->flags|BTREE_ITER_CACHED) ?:
bch2_btree_path_relock(trans, iter->path, _THIS_IP_);
if (unlikely(ret)) if (unlikely(ret))
return bkey_s_c_err(ret); return bkey_s_c_err(ret);
...@@ -1879,15 +1881,6 @@ struct bkey_s_c __btree_trans_peek_key_cache(struct btree_iter *iter, struct bpo ...@@ -1879,15 +1881,6 @@ struct bkey_s_c __btree_trans_peek_key_cache(struct btree_iter *iter, struct bpo
return k; return k;
} }
static noinline
struct bkey_s_c btree_trans_peek_key_cache(struct btree_iter *iter, struct bpos pos)
{
struct bkey_s_c ret = __btree_trans_peek_key_cache(iter, pos);
int err = bkey_err(ret) ?: bch2_btree_path_relock(iter->trans, iter->path, _THIS_IP_);
return err ? bkey_s_c_err(err) : ret;
}
static struct bkey_s_c __bch2_btree_iter_peek(struct btree_iter *iter, struct bpos search_key) static struct bkey_s_c __bch2_btree_iter_peek(struct btree_iter *iter, struct bpos search_key)
{ {
struct btree_trans *trans = iter->trans; struct btree_trans *trans = iter->trans;
...@@ -2394,7 +2387,7 @@ struct bkey_s_c bch2_btree_iter_peek_slot(struct btree_iter *iter) ...@@ -2394,7 +2387,7 @@ struct bkey_s_c bch2_btree_iter_peek_slot(struct btree_iter *iter)
goto out; goto out;
if (unlikely(iter->flags & BTREE_ITER_WITH_KEY_CACHE) && if (unlikely(iter->flags & BTREE_ITER_WITH_KEY_CACHE) &&
(k = __btree_trans_peek_key_cache(iter, iter->pos)).k) { (k = btree_trans_peek_key_cache(iter, iter->pos)).k) {
if (!bkey_err(k)) if (!bkey_err(k))
iter->k = *k.k; iter->k = *k.k;
/* We're not returning a key from iter->path: */ /* We're not returning a key from iter->path: */
......
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