From 702ffea204840455e4f2d918538c39cc5c59666b Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Fri, 10 Mar 2023 16:28:37 -0500 Subject: bcachefs: Extent helper improvements - __bch2_bkey_drop_ptr() -> bch2_bkey_drop_ptr_noerror(), now available outside extents. - Split bch2_bkey_has_device() and bch2_bkey_has_device_c(), const and non const versions - bch2_extent_has_ptr() now returns the pointer it found Signed-off-by: Kent Overstreet --- fs/bcachefs/data_update.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fs/bcachefs/data_update.c') diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c index 26b351d48940..8332e8a0b05a 100644 --- a/fs/bcachefs/data_update.c +++ b/fs/bcachefs/data_update.c @@ -170,13 +170,13 @@ static int __bch2_data_update_index_update(struct btree_trans *trans, i = 0; bkey_for_each_ptr_decode(old.k, bch2_bkey_ptrs_c(old), p, entry) { if (((1U << i) & m->data_opts.rewrite_ptrs) && - bch2_extent_has_ptr(old, p, bkey_i_to_s_c(insert))) { + bch2_extent_has_ptr(old, p, bkey_i_to_s(insert))) { /* * If we're going to be adding a pointer to the * same device, we have to drop the old one - * otherwise, we can just mark it cached: */ - if (bch2_bkey_has_device(bkey_i_to_s_c(&new->k_i), p.ptr.dev)) + if (bch2_bkey_has_device_c(bkey_i_to_s_c(&new->k_i), p.ptr.dev)) bch2_bkey_drop_device_noerror(bkey_i_to_s(insert), p.ptr.dev); else bch2_bkey_mark_dev_cached(bkey_i_to_s(insert), p.ptr.dev); @@ -188,7 +188,7 @@ static int __bch2_data_update_index_update(struct btree_trans *trans, /* Add new ptrs: */ extent_for_each_ptr_decode(extent_i_to_s(new), p, entry) { const struct bch_extent_ptr *existing_ptr = - bch2_bkey_has_device(bkey_i_to_s_c(insert), p.ptr.dev); + bch2_bkey_has_device_c(bkey_i_to_s_c(insert), p.ptr.dev); if (existing_ptr && existing_ptr->cached) { /* -- cgit v1.2.3