summaryrefslogtreecommitdiff
path: root/fs/bcachefs/rebalance.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-07-25 20:52:14 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:24 +0300
commit99aaf57000b4091d2471ed30387d96e15f2fc38b (patch)
treefe76da2b20b6e089158c640b8d4e6b15bb0488d7 /fs/bcachefs/rebalance.c
parentb1c9358a25eb0ed94c5bfc18ba5f9b00d51d8863 (diff)
downloadlinux-99aaf57000b4091d2471ed30387d96e15f2fc38b.tar.xz
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 <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/rebalance.c')
-rw-r--r--fs/bcachefs/rebalance.c6
1 files changed, 2 insertions, 4 deletions
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);