Skip to content

Commit ea9a28d

Browse files
morbidrsakdave
authored andcommitted
btrfs: zoned: don't hold space_info lock on zoned allocation
The zoned extent allocator holds 'struct btrfs_space_info::lock' nearly over the entirety of the allocation process, but nothing in do_allocation_zoned() is actually accessing fields of 'struct btrfs_space_info'. Furthermore taking lock_stat snapshots in performance testing, always shows the space_info::lock as the most contented lock in the entire system. Remove locking the space_info lock during do_allocation_zoned() to reduce lock contention. Signed-off-by: Johannes Thumshirn <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent a8349f7 commit ea9a28d

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

fs/btrfs/extent-tree.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3819,7 +3819,6 @@ static int do_allocation_zoned(struct btrfs_block_group *block_group,
38193819
struct btrfs_block_group **bg_ret)
38203820
{
38213821
struct btrfs_fs_info *fs_info = block_group->fs_info;
3822-
struct btrfs_space_info *space_info = block_group->space_info;
38233822
struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;
38243823
u64 start = block_group->start;
38253824
u64 num_bytes = ffe_ctl->num_bytes;
@@ -3868,7 +3867,6 @@ static int do_allocation_zoned(struct btrfs_block_group *block_group,
38683867
*/
38693868
}
38703869

3871-
spin_lock(&space_info->lock);
38723870
spin_lock(&block_group->lock);
38733871

38743872
if (ret)
@@ -3966,7 +3964,6 @@ static int do_allocation_zoned(struct btrfs_block_group *block_group,
39663964
if (ret && ffe_ctl->for_data_reloc)
39673965
WRITE_ONCE(fs_info->data_reloc_bg, 0);
39683966
spin_unlock(&block_group->lock);
3969-
spin_unlock(&space_info->lock);
39703967
return ret;
39713968
}
39723969

0 commit comments

Comments
 (0)