mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
btrfs: do not subtract delalloc from avail bytes
commit d89c285d28491d8f10534c262ac9e6bdcbe1b4d2 upstream.
The block group's avail bytes printed when dumping a space info subtract
the delalloc_bytes. However, as shown in btrfs_add_reserved_bytes() and
btrfs_free_reserved_bytes(), it is added or subtracted along with
"reserved" for the delalloc case, which means the "delalloc_bytes" is a
part of the "reserved" bytes. So, excluding it to calculate the avail space
counts delalloc_bytes twice, which can lead to an invalid result.
Fixes: e50b122b83
("btrfs: print available space for a block group when dumping a space info")
CC: stable@vger.kernel.org # 6.6+
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ae29e6f764
commit
0caf15bee7
1 changed files with 1 additions and 2 deletions
|
@ -524,8 +524,7 @@ again:
|
||||||
|
|
||||||
spin_lock(&cache->lock);
|
spin_lock(&cache->lock);
|
||||||
avail = cache->length - cache->used - cache->pinned -
|
avail = cache->length - cache->used - cache->pinned -
|
||||||
cache->reserved - cache->delalloc_bytes -
|
cache->reserved - cache->bytes_super - cache->zone_unusable;
|
||||||
cache->bytes_super - cache->zone_unusable;
|
|
||||||
btrfs_info(fs_info,
|
btrfs_info(fs_info,
|
||||||
"block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %llu delalloc %llu super %llu zone_unusable (%llu bytes available) %s",
|
"block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %llu delalloc %llu super %llu zone_unusable (%llu bytes available) %s",
|
||||||
cache->start, cache->length, cache->used, cache->pinned,
|
cache->start, cache->length, cache->used, cache->pinned,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue