mbox series

[v2,0/3] x Balance vs device add fixes

Message ID 20211108142820.1003187-1-nborisov@suse.com (mailing list archive)
Headers show
Series x Balance vs device add fixes | expand

Message

Nikolay Borisov Nov. 8, 2021, 2:28 p.m. UTC
Here's v2 of the patchset allowinig to add a device if we have paused balanced.

Changes in v2:

 * Patch 1 now contains a btrfs_exclop_pause_balance() helper which reduces
 some code duplication and encapuslates ASSERTS

 * Also in patch 1 balance pause is now handled in btrfs_balance and not in the
 caller of btrfs_balance. The original code was buggy due to my misunderstanding
 when need_unlock code is executed in btrfs_ioctl_balance()

* Patch 3 now uses btrfs_exclop_pause_balance instead of duplicating code.

Nikolay Borisov (3):
  btrfs: introduce BTRFS_EXCLOP_BALANCE_PAUSED exclusive state
  btrfs: make device add compatible with paused balance in
    btrfs_exclop_start_try_lock
  btrfs: allow device add if balance is paused

 fs/btrfs/ctree.h   |  3 +++
 fs/btrfs/ioctl.c   | 39 +++++++++++++++++++++++++++++++++++----
 fs/btrfs/volumes.c | 11 +++++++++--
 3 files changed, 47 insertions(+), 6 deletions(-)

--
2.25.1

Comments

David Sterba Nov. 11, 2021, 3:05 p.m. UTC | #1
On Mon, Nov 08, 2021 at 04:28:17PM +0200, Nikolay Borisov wrote:
> Here's v2 of the patchset allowinig to add a device if we have paused balanced.

I haven't figred out any problematic state. As the paused balance is
a note about the request filters and progress, restarting balance with a
new device will apply accordingly. The result will be of course
affected, eg. chunk layout or allocation order, but other than that I
think it's fine.

One remaining thing is to teach progs that there's a new state and how
it's compatible. This needs to mimic the logic in kernel. As it's a
simple change it can go to any release before the kernel changes get
released.