]> Gentwo Git Trees - linux/.git/commit
btrfs: reduce block group critical section in btrfs_add_reserved_bytes()
authorFilipe Manana <fdmanana@suse.com>
Mon, 20 Oct 2025 11:57:34 +0000 (12:57 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 24 Nov 2025 21:14:40 +0000 (22:14 +0100)
commita270cb420c06ae7b52f385e139577209c705e5e0
treec1b755b6d45d58843a759397ccc807b494e60359
parent8b6fa164ab59f9e3f24e627fe09a0234783e7a8b
btrfs: reduce block group critical section in btrfs_add_reserved_bytes()

We are doing some things inside the block group's critical section that
are relevant only to the space_info: updating the space_info counters
bytes_reserved and bytes_may_use as well as trying to grant tickets
(calling btrfs_try_granting_tickets()), and this later can take some
time. So move all those updates to outside the block group's critical
section and still inside the space_info's critical section. Like this
we keep the block group's critical section only for block group updates
and can help reduce contention on a block group's lock.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c