You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
btrfs-progs: Fixing invalid device size output when "btrfs device usage /" called as normal user
When "btrfs device usage /" is being called as a normal user,
the function device_get_partition_size in device-utils.c calls
device_get_partition_size_sysfs() as a fallback, which reads
the size of the partition from "/sys/class/block/[partition]/size".
The problem here is that the size read is not actually the size of
the partition but rather a number of how many 512B (or whatever the
devices sector size is) sectors the partition contains.
Ex: if read value is 104857600 the size is not 100MB but 104857600 *
512B = 50GB
This patch adds a function named get_partition_sector_size_sysfs which
based on the partition name returns the sector size of the device, and
replaces "return size" with "return size * sector_size" in
device_get_partition_size_sysfs.
Issue: #979
Reviewed-by: Qu Wenruo <[email protected]>
0 commit comments