This is a note to let you know that I've just added the patch titled btrfs: account block group tree when calculating global reserve size to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: btrfs-account-block-group-tree-when-calculating-global-reserve-size.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 8dbfc14fc736eb701089aff09645c3d4ad3decb1 Mon Sep 17 00:00:00 2001 From: Filipe Manana <fdmanana@xxxxxxxx> Date: Thu, 20 Jul 2023 12:44:33 +0100 Subject: btrfs: account block group tree when calculating global reserve size From: Filipe Manana <fdmanana@xxxxxxxx> commit 8dbfc14fc736eb701089aff09645c3d4ad3decb1 upstream. 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@xxxxxxxxxxxxxxx # 6.1+ Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx> Reviewed-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/block-rsv.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/btrfs/block-rsv.c +++ b/fs/btrfs/block-rsv.c @@ -377,6 +377,11 @@ void btrfs_update_global_block_rsv(struc } 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 5 items (see the Patches currently in stable-queue which might be from fdmanana@xxxxxxxx are queue-6.1/btrfs-check-if-the-transaction-was-aborted-at-btrfs_wait_for_commit.patch queue-6.1/btrfs-fix-race-between-quota-disable-and-relocation.patch queue-6.1/btrfs-account-block-group-tree-when-calculating-global-reserve-size.patch queue-6.1/btrfs-check-for-commit-error-at-btrfs_attach_transaction_barrier.patch