diff options
| author | Filipe Manana <fdmanana@suse.com> | 2025-10-17 19:34:36 +0300 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2025-11-25 00:12:37 +0300 |
| commit | 189db2510569c0f1cc7eefb583c48a36d373cae3 (patch) | |
| tree | 31a029483d309a57be8305cefca92f8aa75be6a7 | |
| parent | 5ca7725ddfc5b7a1e5b87ba3cb489b3cd052faab (diff) | |
| download | linux-189db2510569c0f1cc7eefb583c48a36d373cae3.tar.xz | |
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 <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>
| -rw-r--r-- | fs/btrfs/space-info.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 62e1ba7f09c0..957477e5f01f 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; } |
