]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: zoned: remove redundant space_info lock and variable in do_allocation_zoned()
authorJiasheng Jiang <jiashengjiangcool@gmail.com>
Wed, 14 Jan 2026 14:44:50 +0000 (14:44 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:55:52 +0000 (18:55 +0200)
commit08ef56661f69d40081ef782cd6a162bb0777af74
tree82ffc9319c5fbd965f4a4b89746a57dc4c43b074
parent6141abb7f18f381d879d98f6c200494f14e502a0
btrfs: zoned: remove redundant space_info lock and variable in do_allocation_zoned()

In do_allocation_zoned(), the code acquires space_info->lock before
block_group->lock. However, the critical section does not access or
modify any members of the space_info structure. Thus, the lock is
redundant as it provides no necessary synchronization here.

This change simplifies the locking logic and aligns the function with
other zoned paths, such as __btrfs_add_free_space_zoned(), which only
rely on block_group->lock. Since the 'space_info' local variable is
no longer used after removing the lock calls, it is also removed.

Removing this unnecessary lock reduces contention on the global
space_info lock, improving concurrency in the zoned allocation path.

Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c