summaryrefslogtreecommitdiff
path: root/cmds-fi-disk_usage.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2014-04-24 18:57:12 +0200
committerDavid Sterba <dsterba@suse.cz>2014-12-04 16:48:11 +0100
commitda28664bf77fbd24ded2987d9792e1209c522433 (patch)
tree3286d8bf9f2c3ff2f42bdd13272900cf4451d926 /cmds-fi-disk_usage.c
parentc7b5293d8d7e3cd5c883a11f979c391fdb45230b (diff)
btrfs-progs: compare unallocated space against the correct value
The device may not be fully occupied by the filesystem, the value of Unallocated should not be calculated against the device size but the size provided by DEV_INFO. Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-fi-disk_usage.c')
-rw-r--r--cmds-fi-disk_usage.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
index 83a3c6d5..0ee6e6bb 100644
--- a/cmds-fi-disk_usage.c
+++ b/cmds-fi-disk_usage.c
@@ -847,7 +847,7 @@ int cmd_filesystem_usage(int argc, char **argv)
return 0;
}
-void print_device_chunks(int fd, u64 devid, u64 total_size,
+void print_device_chunks(int fd, struct device_info *devinfo,
struct chunk_info *chunks_info_ptr,
int chunks_info_count, int mode)
{
@@ -860,7 +860,7 @@ void print_device_chunks(int fd, u64 devid, u64 total_size,
u64 flags;
u64 size;
- if (chunks_info_ptr[i].devid != devid)
+ if (chunks_info_ptr[i].devid != devinfo->devid)
continue;
flags = chunks_info_ptr[i].type;
@@ -879,7 +879,7 @@ 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));
+ df_pretty_sizes(devinfo->size - allocated, mode));
}
void print_device_sizes(int fd, struct device_info *devinfo, int mode)