]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bcachefs: bch2_bkey_sectors_need_rebalance() now only depends on bch_extent_rebalance
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 26 Jan 2025 02:29:45 +0000 (21:29 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 7 Feb 2025 03:35:11 +0000 (22:35 -0500)
commit4be214c26936813b636eed2fac906f585ddbf0f9
treebaa68ff28776dab78b221c751914796bc0605199
parent3539880ef1a5f8c970d0f69a6fdcfeffc000e63d
bcachefs: bch2_bkey_sectors_need_rebalance() now only depends on bch_extent_rebalance

Previously, bch2_bkey_sectors_need_rebalance() called
bch2_target_accepts_data(), checking whether the target is writable.

However, this means that adding or removing devices from a target would
change the value of bch2_bkey_sectors_need_rebalance() for an existing
extent; this needs to be invariant so that the extent trigger can
correctly maintain rebalance_work accounting.

Instead, check target_accepts_data() in io_opts_to_rebalance_opts(),
before creating the bch_extent_rebalance entry.

This fixes (one?) cause of rebalance_work accounting being off.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/inode.h
fs/bcachefs/opts.h
fs/bcachefs/rebalance.c
fs/bcachefs/rebalance.h