mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
btrfs: use READ_ONCE() to read the chunk size from the data space_info
The chunk size of a space_info is always updated with WRITE_ONCE() (see btrfs_update_space_info_chunk_size()), so when reading it in calc_effective_data_chunk_size() we should use READ_ONCE() to prevent load tearing. We are already using READ_ONCE() in every other function that accesses the chunk size of a space_info. Reviewed-by: Daniel Vacek <neelx@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c97b139c6c
commit
bbb86c6dc1
|
|
@ -443,8 +443,8 @@ static u64 calc_effective_data_chunk_size(const struct btrfs_fs_info *fs_info)
|
|||
*/
|
||||
data_sinfo = btrfs_find_space_info(fs_info, BTRFS_BLOCK_GROUP_DATA);
|
||||
if (btrfs_is_zoned(fs_info))
|
||||
return data_sinfo->chunk_size;
|
||||
data_chunk_size = min(data_sinfo->chunk_size,
|
||||
return READ_ONCE(data_sinfo->chunk_size);
|
||||
data_chunk_size = min(READ_ONCE(data_sinfo->chunk_size),
|
||||
mult_perc(fs_info->fs_devices->total_rw_bytes, 10));
|
||||
return min_t(u64, data_chunk_size, SZ_1G);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user