diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-11-15 20:40:15 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:32 -0400 |
commit | aef90ce085123c3d0c3f110b4c50b77d007b2d5d (patch) | |
tree | f1b7bcda469879766aceb8a6eeccf6902ed22e90 /fs/bcachefs | |
parent | 35189e09ab46785746df7007ed2a57ee78b56191 (diff) | |
download | lwn-aef90ce085123c3d0c3f110b4c50b77d007b2d5d.tar.gz lwn-aef90ce085123c3d0c3f110b4c50b77d007b2d5d.zip |
bcachefs: kill bch2_extent_has_device()
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r-- | fs/bcachefs/ec.c | 15 | ||||
-rw-r--r-- | fs/bcachefs/extents.h | 3 | ||||
-rw-r--r-- | fs/bcachefs/journal.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/journal_io.c | 2 |
4 files changed, 10 insertions, 12 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c index b24f867520c3..654823a6da74 100644 --- a/fs/bcachefs/ec.c +++ b/fs/bcachefs/ec.c @@ -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); diff --git a/fs/bcachefs/extents.h b/fs/bcachefs/extents.h index cc7ee9067b50..f334b6f763e3 100644 --- a/fs/bcachefs/extents.h +++ b/fs/bcachefs/extents.h @@ -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, diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index 0261c6bbfa92..26a8ff38991d 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.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; diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c index 2531379e67c6..244e3faa6b16 100644 --- a/fs/bcachefs/journal_io.c +++ b/fs/bcachefs/journal_io.c @@ -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; |