Re: [PATCH] btrfs: fix BUG_ON condition in btrfs_cancel_balance

From: xiaoshoukui
Date: Thu Aug 17 2023 - 23:03:50 EST


> Seems that it's from times the balance was not cancellable the same way
> as now. Also it's a good time to switch the BUG_ON to an assertion or
> handle it properly.

That's the point. Canceling the balance only takes into account the normal scenarios.
Replacing the BUG ON here with an assertion would make the code cleaner.

> I'll change to to ASSERT, this is really to verify that the state
> tracking works properly.

The ASSERT and BUG ON macros have already helped us uncover many hidden issues.