Skip to content

Commit 8dbfc14

Browse files
fdmananakdave
authored andcommitted
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>
1 parent 95ca659 commit 8dbfc14

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/btrfs/block-rsv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ void btrfs_update_global_block_rsv(struct btrfs_fs_info *fs_info)
349349
}
350350
read_unlock(&fs_info->global_root_lock);
351351

352+
if (btrfs_fs_compat_ro(fs_info, BLOCK_GROUP_TREE)) {
353+
num_bytes += btrfs_root_used(&fs_info->block_group_root->root_item);
354+
min_items++;
355+
}
356+
352357
/*
353358
* But we also want to reserve enough space so we can do the fallback
354359
* global reserve for an unlink, which is an additional

0 commit comments

Comments
 (0)