diff options
author | Naohiro Aota <naohiro.aota@wdc.com> | 2021-06-17 07:56:18 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-06-17 12:12:14 +0300 |
commit | f9f28e5bd0baee9708c9011897196f06ae3a2733 (patch) | |
tree | 1e0fdbb85996e5a63d09334a413435dc1062c180 /tools/perf/util/parse-events.y | |
parent | aefd7f7065567a4666f42c0fc8cdb379d2e036bf (diff) | |
download | linux-f9f28e5bd0baee9708c9011897196f06ae3a2733.tar.xz |
btrfs: zoned: fix negative space_info->bytes_readonly
Consider we have a using block group on zoned btrfs.
|<- ZU ->|<- used ->|<---free--->|
`- Alloc offset
ZU: Zone unusable
Marking the block group read-only will migrate the zone unusable bytes
to the read-only bytes. So, we will have this.
|<- RO ->|<- used ->|<--- RO --->|
RO: Read only
When marking it back to read-write, btrfs_dec_block_group_ro()
subtracts the above "RO" bytes from the
space_info->bytes_readonly. And, it moves the zone unusable bytes back
and again subtracts those bytes from the space_info->bytes_readonly,
leading to negative bytes_readonly.
This can be observed in the output as eg.:
Data, single: total=512.00MiB, used=165.21MiB, zone_unusable=16.00EiB
Data, single: total=536870912, used=173256704, zone_unusable=18446744073603186688
This commit fixes the issue by reordering the operations.
Link: https://github.com/naota/linux/issues/37
Reported-by: David Sterba <dsterba@suse.com>
Fixes: 169e0da91a21 ("btrfs: zoned: track unusable bytes for zones")
CC: stable@vger.kernel.org # 5.12+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/perf/util/parse-events.y')
0 files changed, 0 insertions, 0 deletions