-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Btrfs unallocated space accounting #14824
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
area/collectors
Everything related to data collection
collectors/proc
labels
Mar 28, 2023
@Ferroin could you please test this on your setup? |
Ferroin
previously approved these changes
Mar 29, 2023
thiagoftsm
previously approved these changes
Mar 29, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ilyam8
previously approved these changes
Mar 30, 2023
Dim-P
previously approved these changes
Mar 30, 2023
intelfx
dismissed stale reviews from Dim-P, ilyam8, thiagoftsm, and Ferroin
via
March 30, 2023 10:50
9c89eba
ilyam8
approved these changes
Mar 30, 2023
Dim-P
approved these changes
Mar 30, 2023
Ferroin
approved these changes
Mar 30, 2023
Thanks, @intelfx 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Btrfs part of the proc collector assumes that
/sys/block/<name>/size
is reported in hardware sectors, while it is in fact reported in 512-byte sectors (the basic Linux SECTOR_SIZE/SECTOR_SHIFT). This causes unallocated space to be misaccounted by a factor ofhw_sector_size/512
. Fix this by hardcoding sector size to 512.Fixes #14816.
Test Plan
Manually tested on multiple systems with Btrfs volumes mounted (single-disk and multi-disk, with and without LUKS2).
Additional Information
For users: How does this change affect me?
This change is related to the Btrfs support in the proc collector plugin ("Btrfs" section on the netdata dashboard). It fixes the "unallocated" storage size on the "BTRFS Physical Disk Allocation" chart, which previously could be off by a factor of 8 if using Btrfs on a modern disk that uses 4KiB hardware sectors.