diff options
| author | Qu Wenruo <wqu@suse.com> | 2026-06-16 09:24:22 +0930 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-08-07 19:16:28 +0200 |
| commit | 0d99b3b1cfa8d5d4a5c0a6d693b52d5d40775f7f (patch) | |
| tree | 01e02f8824886fe0a3f61d649f60edb993d26ec8 /tools/perf/scripts/python/bin | |
| parent | 030d3514c6bb289cd3557a74b8d560dc0a26d8f8 (diff) | |
btrfs: log swapfile activation/deactivation and warn about pinned block groups
A swap file on btrfs will pin down block groups that cover the swap file
extent.
Pinned down block groups will be skipped for scrub and relocation.
These degradation on critical btrfs maintenance operations is never
properly educated to end users, and have already caused problems
including:
- Scrub finished too quick
Because the enabled swap file has pinned down most of the block
groups. Thus any file extents in those block groups, even not utilized
by the swap file, will be skipped from scrub.
- Unbalanced data and metadata usage, meanwhile relocation won't help
The same reason, pinned down block groups will not be considered as
relocation target, thus data extents that are not utilized by the swap
file can still be skipped from relocation.
Although we already have kernel messages for both scrub and balance, the
balance one is still info level.
To better communicate those potential long term problems, add the
following output into dmesg:
- Change the message level to warn for __btrfs_balance()
- Total pinned down block group number and size during swapfile activation
- Total released block group number and size during swapfile deactivation
The above messages have info level.
- The fact that pinned down block groups will not be scrubbed nor
balanced
The above message has warning level.
The example output would look like the following, for enabling a 1.2G
swapfile, which pinned down 2G block groups:
BTRFS info (device dm-3): swapfile activated on root 5 ino 257, pinned down 2147483648 bytes from 2 block group(s)
BTRFS warning (device dm-3): block groups with swapfile extents will not be scrubbed or balanced
Adding 1257468k swap on /mnt/btrfs/foobar. Priority:-1 extents:1 across:1257468k
BTRFS info (device dm-3): swapfile deactivated on root 5 ino 257, released 2147483648 bytes from 2 block group(s)
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
