summaryrefslogtreecommitdiff
path: root/cmds-fi-disk_usage.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2014-04-24 18:32:27 +0200
committerDavid Sterba <dsterba@suse.cz>2014-12-04 16:48:11 +0100
commitc7b5293d8d7e3cd5c883a11f979c391fdb45230b (patch)
treecfaa3061aff52f680a012b363a902e9ae9e9e6b8 /cmds-fi-disk_usage.c
parent78f2bb9e8d89f60a9c6fbc447ebc1789ed9f3643 (diff)
btrfs-progs: Print more info about device sizes
The entire device size may not be available to the filesystem, eg. if it's modified via resize. Print this information if it can be obtained from the DEV_INFO ioctl. Print the device ID on the same line as the device name and move size to the next line. Sample: /dev/sda7, ID: 3 Device size: 10.00GiB FS occupied: 5.00GiB Data,RAID10: 512.00MiB Metadata,RAID10: 512.00MiB System,RAID10: 4.00MiB Unallocated: 9.00GiB Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-fi-disk_usage.c')
-rw-r--r--cmds-fi-disk_usage.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
index f984be83..83a3c6d5 100644
--- a/cmds-fi-disk_usage.c
+++ b/cmds-fi-disk_usage.c
@@ -499,7 +499,8 @@ int load_device_info(int fd, struct device_info **device_info_ptr,
info[ndevs].devid = dev_info.devid;
strcpy(info[ndevs].path, (char *)dev_info.path);
- info[ndevs].size = get_partition_size((char *)dev_info.path);
+ info[ndevs].device_size = get_partition_size((char *)dev_info.path);
+ info[ndevs].size = dev_info.total_bytes;
++ndevs;
}
@@ -879,5 +880,14 @@ void print_device_chunks(int fd, u64 devid, u64 total_size,
printf(" Unallocated: %*s%10s\n",
(int)(20 - strlen("Unallocated")), "",
df_pretty_sizes(total_size - allocated, mode));
+}
+void print_device_sizes(int fd, struct device_info *devinfo, int mode)
+{
+ printf(" Device size: %*s%10s\n",
+ (int)(20 - strlen("Device size")), "",
+ df_pretty_sizes(devinfo->device_size, mode));
+ printf(" FS occupied: %*s%10s\n",
+ (int)(20 - strlen("FS occupied")), "",
+ df_pretty_sizes(devinfo->size, mode));
}