]> git.hungrycats.org Git - linux/commit
btrfs: don't save block group root into super block
authorQu Wenruo <wqu@suse.com>
Tue, 9 Aug 2022 05:02:17 +0000 (13:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:00:44 +0000 (12:00 +0100)
commitdabf41db56f378a360ff0219c467f8dfecda7dd6
tree22f1562d5b67e76bd42b4a9586d21b5053f94257
parente726d95374544faf4441d8a1d1643e4c13572ef1
btrfs: don't save block group root into super block

[ Upstream commit 14033b08a02916e85ffc5397e4ac15337359f3ae ]

The extent tree v2 needs a new root for storing all block group items,
the whole feature hasn't been finished yet so we can afford to do some
changes.

My initial proposal years ago just added a new tree rootid, and load it
from tree root, just like what we did for quota/free space tree/uuid/extent
roots.

But the extent tree v2 patches introduced a completely new way to store
block group tree root into super block which is arguably wasteful.

Currently there are only 3 trees stored in super blocks, and they all
have their valid reasons:

- Chunk root
  Needed for bootstrap.

- Tree root
  Really the entry point for all trees.

- Log root
  This is special as log root has to be updated out of existing
  transaction mechanism.

There is not even any reason to put block group root into super blocks,
the block group tree is updated at the same time as the old extent tree,
no need for extra bootstrap/out-of-transaction update.

So just move block group root from super block into tree root.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: 2ba48b20049b ("btrfs: fix compat_ro checks against remount")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/block-rsv.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/transaction.c