diff options
author | Filipe Manana <fdmanana@suse.com> | 2023-07-20 13:44:33 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-07-20 19:22:54 +0200 |
commit | 8dbfc14fc736eb701089aff09645c3d4ad3decb1 (patch) | |
tree | 82540e9b2817bb828a14909a0e820f9fee4f133c /fs | |
parent | btrfs: zoned: do not enable async discard (diff) | |
download | linux-8dbfc14fc736eb701089aff09645c3d4ad3decb1.tar.xz linux-8dbfc14fc736eb701089aff09645c3d4ad3decb1.zip |
btrfs: account block group tree when calculating global reserve size
When using the block group tree feature, this tree is a critical tree just
like the extent, csum and free space trees, and just like them it uses the
delayed refs block reserve.
So take into account the block group tree, and its current size, when
calculating the size for the global reserve.
CC: stable@vger.kernel.org # 6.1+
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/block-rsv.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/block-rsv.c b/fs/btrfs/block-rsv.c index 6279d200cf83..77684c5e0c8b 100644 --- a/fs/btrfs/block-rsv.c +++ b/fs/btrfs/block-rsv.c @@ -349,6 +349,11 @@ void btrfs_update_global_block_rsv(struct btrfs_fs_info *fs_info) } read_unlock(&fs_info->global_root_lock); + if (btrfs_fs_compat_ro(fs_info, BLOCK_GROUP_TREE)) { + num_bytes += btrfs_root_used(&fs_info->block_group_root->root_item); + min_items++; + } + /* * But we also want to reserve enough space so we can do the fallback * global reserve for an unlink, which is an additional |