From: Filipe Manana Date: Fri, 17 Oct 2025 16:34:36 +0000 (+0100) Subject: btrfs: process ticket outside global reserve critical section X-Git-Tag: v6.19-rc1~167^2~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=189db2510569c0f1cc7eefb583c48a36d373cae3;p=thirdparty%2Fkernel%2Flinux.git btrfs: process ticket outside global reserve critical section In steal_from_global_rsv() there's no need to process the ticket inside the critical section of the global reserve. Move the ticket processing to happen after the critical section. This helps reduce contention on the global reserve's spinlock. Reviewed-by: Johannes Thumshirn Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 62e1ba7f09c0a..957477e5f01f9 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -1062,13 +1062,14 @@ static bool steal_from_global_rsv(struct btrfs_space_info *space_info, return false; } global_rsv->reserved -= ticket->bytes; + if (global_rsv->reserved < global_rsv->size) + global_rsv->full = false; + spin_unlock(&global_rsv->lock); + remove_ticket(space_info, ticket); ticket->bytes = 0; wake_up(&ticket->wait); space_info->tickets_id++; - if (global_rsv->reserved < global_rsv->size) - global_rsv->full = false; - spin_unlock(&global_rsv->lock); return true; }