@@ -450,10 +450,8 @@ static int _cmd_device_usage(int fd, char *path, int mode)
printf("%s, ID: %llu\n", device_info_ptr[i].path,
device_info_ptr[i].devid);
print_device_sizes(fd, &device_info_ptr[i], mode);
- print_device_chunks(fd, device_info_ptr[i].devid,
- device_info_ptr[i].size,
- info_ptr, info_count,
- mode);
+ print_device_chunks(fd, &device_info_ptr[i],
+ info_ptr, info_count, mode);
printf("\n");
}
@@ -500,7 +500,7 @@ 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].device_size = get_partition_size((char *)dev_info.path);
- info[ndevs].size = dev_info.total_size;
+ info[ndevs].size = dev_info.total_bytes;
++ndevs;
}
@@ -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)
@@ -890,5 +890,4 @@ void print_device_sizes(int fd, struct device_info *devinfo, int mode)
printf(" FS occuppied:%*s%10s\n",
(int)(20 - strlen("FS occupied")), "",
df_pretty_sizes(devinfo->size, mode));
- }
}
@@ -50,7 +50,7 @@ int load_device_info(int fd, struct device_info **device_info_ptr,
int *device_info_count);
int load_chunk_info(int fd, struct chunk_info **info_ptr, int *info_count);
char *df_pretty_sizes(u64 size, int mode);
-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);
void print_device_sizes(int fd, struct device_info *devinfo, int mode);
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> --- cmds-device.c | 6 ++---- cmds-fi-disk_usage.c | 9 ++++----- cmds-fi-disk_usage.h | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-)