Commit 6bdefe9c authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Use BTREE_ITER_INTENT in ec_stripe_update_extent()

This adds a flags param to bch2_backpointer_get_key() so that we can
pass BTREE_ITER_INTENT, since ec_stripe_update_extent() is updating the
extent immediately.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 4f77dcde
......@@ -420,7 +420,8 @@ struct bkey_s_c bch2_backpointer_get_key(struct btree_trans *trans,
struct btree_iter *iter,
struct bpos bucket,
u64 bp_offset,
struct bch_backpointer bp)
struct bch_backpointer bp,
unsigned iter_flags)
{
struct bch_fs *c = trans->c;
struct bkey_s_c k;
......@@ -430,7 +431,7 @@ struct bkey_s_c bch2_backpointer_get_key(struct btree_trans *trans,
bp.pos,
0,
min(bp.level, c->btree_roots[bp.btree_id].level),
0);
iter_flags);
k = bch2_btree_iter_peek_slot(iter);
if (bkey_err(k)) {
bch2_trans_iter_exit(trans, iter);
......@@ -976,7 +977,7 @@ static int check_one_backpointer(struct btree_trans *trans,
bbpos_cmp(pos, end) > 0)
return 0;
k = bch2_backpointer_get_key(trans, &iter, bucket, *bp_offset, bp);
k = bch2_backpointer_get_key(trans, &iter, bucket, *bp_offset, bp, 0);
ret = bkey_err(k);
if (ret == -BCH_ERR_backpointer_to_overwritten_btree_node)
return 0;
......
......@@ -128,7 +128,8 @@ static inline void bch2_extent_ptr_to_bp(struct bch_fs *c,
int bch2_get_next_backpointer(struct btree_trans *, struct bpos, int,
u64 *, struct bch_backpointer *, unsigned);
struct bkey_s_c bch2_backpointer_get_key(struct btree_trans *, struct btree_iter *,
struct bpos, u64, struct bch_backpointer);
struct bpos, u64, struct bch_backpointer,
unsigned);
struct btree *bch2_backpointer_get_node(struct btree_trans *, struct btree_iter *,
struct bpos, u64, struct bch_backpointer);
......
......@@ -925,7 +925,8 @@ static int ec_stripe_update_extent(struct btree_trans *trans,
return -EIO;
}
k = bch2_backpointer_get_key(trans, &iter, bucket, *bp_offset, bp);
k = bch2_backpointer_get_key(trans, &iter, bucket, *bp_offset, bp,
BTREE_ITER_INTENT);
ret = bkey_err(k);
if (ret)
return ret;
......
......@@ -678,7 +678,7 @@ void bch2_verify_bucket_evacuated(struct btree_trans *trans, struct bpos bucket,
break;
k = bch2_backpointer_get_key(trans, &iter,
bucket, bp_offset, bp);
bucket, bp_offset, bp, 0);
ret = bkey_err(k);
if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
continue;
......@@ -767,7 +767,7 @@ int __bch2_evacuate_bucket(struct btree_trans *trans,
unsigned i = 0;
k = bch2_backpointer_get_key(trans, &iter,
bucket, bp_offset, bp);
bucket, bp_offset, bp, 0);
ret = bkey_err(k);
if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
continue;
......
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