diff options
author | Filipe Manana <fdmanana@suse.com> | 2024-09-24 15:58:31 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-10-11 18:33:35 +0200 |
commit | 97420be7bda57030110c7032ad190d320f2e0157 (patch) | |
tree | 82cee71ce13b7e21ecc428a939f8ecea10e6a475 /drivers/platform/surface/aggregator/ssh_parser.c | |
parent | e761be2a0744086fc4793a4870d4b5746b7fe8cd (diff) |
btrfs: use sector numbers as keys for the dirty extents xarray
We are using the logical address ("bytenr") of an extent as the key for
qgroup records in the dirty extents xarray. This is a problem because the
xarrays use "unsigned long" for keys/indices, meaning that on a 32 bits
platform any extent starting at or beyond 4G is truncated, which is a too
low limitation as virtually everyone is using storage with more than 4G of
space. This means a "bytenr" of 4G gets truncated to 0, and so does 8G and
16G for example, resulting in incorrect qgroup accounting.
Fix this by using sector numbers as keys instead, that is, using keys that
match the logical address right shifted by fs_info->sectorsize_bits, which
is what we do for the fs_info->buffer_radix that tracks extent buffers
(radix trees also use an "unsigned long" type for keys). This also makes
the index space more dense which helps optimize the xarray (as mentioned
at Documentation/core-api/xarray.rst).
Fixes: 3cce39a8ca4e ("btrfs: qgroup: use xarray to track dirty extents in transaction")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'drivers/platform/surface/aggregator/ssh_parser.c')
0 files changed, 0 insertions, 0 deletions