Commit aef90ce0 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: kill bch2_extent_has_device()

Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 35189e09
......@@ -777,7 +777,6 @@ static int ec_stripe_update_ptrs(struct bch_fs *c,
struct btree_iter *iter;
struct bkey_s_c k;
struct bkey_s_extent e;
struct bch_extent_ptr *ptr;
struct bkey_on_stack sk;
int ret = 0, dev, idx;
......@@ -791,6 +790,8 @@ static int ec_stripe_update_ptrs(struct bch_fs *c,
while ((k = bch2_btree_iter_peek(iter)).k &&
!(ret = bkey_err(k)) &&
bkey_cmp(bkey_start_pos(k.k), pos->p) < 0) {
struct bch_extent_ptr *ptr, *ec_ptr = NULL;
if (extent_has_stripe_ptr(k, s->key.k.p.offset)) {
bch2_btree_iter_next(iter);
continue;
......@@ -810,14 +811,14 @@ static int ec_stripe_update_ptrs(struct bch_fs *c,
bkey_reassemble(sk.k, k);
e = bkey_i_to_s_extent(sk.k);
extent_for_each_ptr(e, ptr)
if (ptr->dev != dev)
extent_for_each_ptr(e, ptr) {
if (ptr->dev == dev)
ec_ptr = ptr;
else
ptr->cached = true;
}
ptr = (void *) bch2_extent_has_device(e.c, dev);
BUG_ON(!ptr);
extent_stripe_ptr_add(e, s, ptr, idx);
extent_stripe_ptr_add(e, s, ec_ptr, idx);
bch2_trans_update(&trans, iter, sk.k);
......
......@@ -447,9 +447,6 @@ void bch2_insert_fixup_extent(struct btree_trans *,
void bch2_bkey_mark_replicas_cached(struct bch_fs *, struct bkey_s,
unsigned, unsigned);
const struct bch_extent_ptr *
bch2_extent_has_device(struct bkey_s_c_extent, unsigned);
unsigned bch2_extent_is_compressed(struct bkey_s_c);
bool bch2_bkey_matches_ptr(struct bch_fs *, struct bkey_s_c,
......
......@@ -944,7 +944,7 @@ static bool bch2_journal_writing_to_device(struct journal *j, unsigned dev_idx)
w = j->buf + !state.idx;
ret = state.prev_buf_unwritten &&
bch2_extent_has_device(bkey_i_to_s_c_extent(&w->key), dev_idx);
bch2_bkey_has_device(bkey_i_to_s_c(&w->key), dev_idx);
spin_unlock(&j->lock);
return ret;
......
......@@ -1097,7 +1097,7 @@ void bch2_journal_write(struct closure *cl)
for_each_rw_member(ca, c, i)
if (journal_flushes_device(ca) &&
!bch2_extent_has_device(bkey_i_to_s_c_extent(&w->key), i)) {
!bch2_bkey_has_device(bkey_i_to_s_c(&w->key), i)) {
percpu_ref_get(&ca->io_ref);
bio = ca->journal.bio;
......
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