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/ec.c | |
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/ec.c')
-rw-r--r-- | fs/bcachefs/ec.c | 15 |
1 files changed, 8 insertions, 7 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); |