From 99aaf57000b4091d2471ed30387d96e15f2fc38b Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 25 Jul 2019 13:52:14 -0400 Subject: bcachefs: Refactor various code to not be extent specific With reflink, various code now has to handle both KEY_TYPE_extent or KEY_TYPE_reflink_v - so, convert it to be generic across all keys with pointers. Signed-off-by: Kent Overstreet --- fs/bcachefs/rebalance.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fs/bcachefs/rebalance.c') diff --git a/fs/bcachefs/rebalance.c b/fs/bcachefs/rebalance.c index fe4a9af92a76..0997c0621b7c 100644 --- a/fs/bcachefs/rebalance.c +++ b/fs/bcachefs/rebalance.c @@ -38,9 +38,9 @@ void bch2_rebalance_add_key(struct bch_fs *c, struct bkey_s_c k, struct bch_io_opts *io_opts) { + struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); const union bch_extent_entry *entry; struct extent_ptr_decoded p; - struct bkey_s_c_extent e; if (!bkey_extent_is_data(k.k)) return; @@ -49,9 +49,7 @@ void bch2_rebalance_add_key(struct bch_fs *c, !io_opts->background_compression) return; - e = bkey_s_c_to_extent(k); - - extent_for_each_ptr_decode(e, p, entry) + bkey_for_each_ptr_decode(k.k, ptrs, p, entry) if (rebalance_ptr_pred(c, p, io_opts)) { struct bch_dev *ca = bch_dev_bkey_exists(c, p.ptr.dev); -- cgit v1.2.3