btrfs: clear free space tree on ro->rw remount
authorBoris Burkov <boris@bur.io>
Wed, 18 Nov 2020 23:06:21 +0000 (15:06 -0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 9 Dec 2020 18:16:08 +0000 (19:16 +0100)
commit8b228324a8ce03083a034dfa784bc10696ce7489
tree66d63f53a2727690411e86495caa7d49c9f9ecf8
parent8cd2908846d11af9b33246171f71a923d35eb3c4
btrfs: clear free space tree on ro->rw remount

A user might want to revert to v1 or nospace_cache on a root filesystem,
and much like turning on the free space tree, that can only be done
remounting from ro->rw. Support clearing the free space tree on such
mounts by moving it into the shared remount logic.

Since the CLEAR_CACHE option sticks around across remounts, this change
would result in clearing the tree for ever on every remount, which is
not desirable. To fix that, add CLEAR_CACHE to the oneshot options we
clear at mount end, which has the other bonus of not cluttering the
/proc/mounts output with clear_cache.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c