mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-17 22:05:08 +00:00
bcachefs: bucket_pos_to_bp_end()
Better helpers for iterating over backpointers within a specific bucket Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
debe6965ac
commit
5b5a7ae8fa
@ -80,6 +80,16 @@ static inline struct bpos bucket_pos_to_bp(const struct bch_dev *ca,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline struct bpos bucket_pos_to_bp_start(const struct bch_dev *ca, struct bpos bucket)
|
||||
{
|
||||
return bucket_pos_to_bp(ca, bucket, 0);
|
||||
}
|
||||
|
||||
static inline struct bpos bucket_pos_to_bp_end(const struct bch_dev *ca, struct bpos bucket)
|
||||
{
|
||||
return bpos_nosnap_predecessor(bucket_pos_to_bp(ca, bpos_nosnap_successor(bucket), 0));
|
||||
}
|
||||
|
||||
int bch2_bucket_backpointer_mod_nowritebuffer(struct btree_trans *, struct bch_dev *,
|
||||
struct bpos bucket, struct bch_backpointer, struct bkey_s_c, bool);
|
||||
|
||||
|
@ -1365,8 +1365,9 @@ static int ec_stripe_update_bucket(struct btree_trans *trans, struct ec_stripe_b
|
||||
|
||||
struct bpos bucket_pos = PTR_BUCKET_POS(ca, &ptr);
|
||||
|
||||
ret = for_each_btree_key_commit(trans, bp_iter, BTREE_ID_backpointers,
|
||||
bucket_pos_to_bp(ca, bucket_pos, 0), 0, bp_k,
|
||||
ret = for_each_btree_key_max_commit(trans, bp_iter, BTREE_ID_backpointers,
|
||||
bucket_pos_to_bp_start(ca, bucket_pos),
|
||||
bucket_pos_to_bp_end(ca, bucket_pos), 0, bp_k,
|
||||
NULL, NULL,
|
||||
BCH_TRANS_COMMIT_no_check_rw|
|
||||
BCH_TRANS_COMMIT_no_enospc, ({
|
||||
|
@ -691,7 +691,7 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
|
||||
bch2_trans_begin(trans);
|
||||
|
||||
bch2_trans_iter_init(trans, &bp_iter, BTREE_ID_backpointers,
|
||||
bucket_pos_to_bp(ca, bucket, 0), 0);
|
||||
bucket_pos_to_bp_start(ca, bucket), 0);
|
||||
|
||||
bch_err_msg(c, ret, "looking up alloc key");
|
||||
if (ret)
|
||||
@ -715,8 +715,7 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
if (!k.k ||
|
||||
bkey_ge(k.k->p, bucket_pos_to_bp(ca, bpos_nosnap_successor(bucket), 0)))
|
||||
if (!k.k || bkey_gt(k.k->p, bucket_pos_to_bp_end(ca, bucket)))
|
||||
break;
|
||||
|
||||
if (k.k->type != KEY_TYPE_backpointer)
|
||||
|
Loading…
x
Reference in New Issue
Block a user