diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-05-04 15:38:06 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-05-04 15:52:42 -0400 |
commit | 401a20ed984b7ccee689202d9372045d41271bcc (patch) | |
tree | 61a8553d25b04459593fca2c350dfcb7def76150 /libbcachefs/rebalance.c | |
parent | 6e4bda5ad5f7a43b90d9f22b8e86011e51569bf1 (diff) |
Update bcachefs sources to b4927db2cdc7 bcachefs: bcachefs_metadata_version_fast_device_removal
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/rebalance.c')
-rw-r--r-- | libbcachefs/rebalance.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libbcachefs/rebalance.c b/libbcachefs/rebalance.c index a81ffff4..a94f66ff 100644 --- a/libbcachefs/rebalance.c +++ b/libbcachefs/rebalance.c @@ -80,11 +80,13 @@ static inline unsigned bch2_bkey_ptrs_need_move(struct bch_fs *c, unsigned ptr_bit = 1; unsigned rewrite_ptrs = 0; + rcu_read_lock(); bkey_for_each_ptr(ptrs, ptr) { if (!ptr->cached && !bch2_dev_in_target(c, ptr->dev, opts->background_target)) rewrite_ptrs |= ptr_bit; ptr_bit <<= 1; } + rcu_read_unlock(); return rewrite_ptrs; } @@ -132,10 +134,14 @@ u64 bch2_bkey_sectors_need_rebalance(struct bch_fs *c, struct bkey_s_c k) } } incompressible: - if (opts->background_target) + if (opts->background_target) { + rcu_read_lock(); bkey_for_each_ptr_decode(k.k, ptrs, p, entry) - if (!p.ptr.cached && !bch2_dev_in_target(c, p.ptr.dev, opts->background_target)) + if (!p.ptr.cached && + !bch2_dev_in_target(c, p.ptr.dev, opts->background_target)) sectors += p.crc.compressed_size; + rcu_read_unlock(); + } return sectors; } |