summaryrefslogtreecommitdiff
path: root/cmds-fi-disk_usage.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2014-04-29 17:32:22 +0200
committerDavid Sterba <dsterba@suse.cz>2014-12-04 16:48:11 +0100
commit8f43fed5e24c66ae71ae29ffc682b2dbb3d6ea0d (patch)
tree174c0e4e9894315602d7ffe9aa563a9b946af72c /cmds-fi-disk_usage.c
parent85a0566d4b5c12a2f8593d03aac355981ef21f73 (diff)
btrfs-progs: move global reserve to overall summary
It looks confusing among the chunks, it is not in fact a chunk type. Sample: Overall: Device size: 35.00GiB Device allocated: 8.07GiB Device unallocated: 26.93GiB Used: 1.12MiB Free (Estimated): 17.57GiB (Max: 30.98GiB, min: 17.52GiB) Data to device ratio: 50 % Global reserve: 16.00MiB (used: 0.00B) ... Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-fi-disk_usage.c')
-rw-r--r--cmds-fi-disk_usage.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
index e088956f..2c3c0a3e 100644
--- a/cmds-fi-disk_usage.c
+++ b/cmds-fi-disk_usage.c
@@ -319,6 +319,8 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
u64 total_free; /* logical space un-used */
double K;
u64 raid5_used, raid6_used;
+ u64 global_reserve;
+ u64 global_reserve_used;
sargs = load_space_info(fd, path);
if (!sargs) {
@@ -341,6 +343,8 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
total_chunks = 0;
total_used = 0;
total_free = 0;
+ global_reserve = 0;
+ global_reserve_used = 0;
for (i = 0; i < sargs->total_spaces; i++) {
float ratio = 1;
@@ -366,6 +370,11 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
else
ratio = 1;
+ if (flags & BTRFS_SPACE_INFO_GLOBAL_RSV) {
+ global_reserve = sargs->spaces[i].total_bytes;
+ global_reserve_used = sargs->spaces[i].used_bytes;
+ }
+
allocated = sargs->spaces[i].total_bytes * ratio;
total_chunks += allocated;
@@ -404,6 +413,9 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
pretty_size_mode((total_disk-total_chunks) / 2 + total_free, mode));
printf(" Data to device ratio:\t%*.0f %%\n",
width - 2, K * 100);
+ printf(" Global reserve:\t\t%*s\t(used: %s)\n", width,
+ pretty_size_mode(global_reserve, mode),
+ pretty_size_mode(global_reserve_used, mode));
exit:
@@ -553,8 +565,11 @@ static void _cmd_filesystem_usage_tabular(int mode,
/* header */
for (i = 0; i < sargs->total_spaces; i++) {
const char *description;
-
u64 flags = sargs->spaces[i].flags;
+
+ if (flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
+ continue;
+
description = btrfs_group_type_str(flags);
table_printf(matrix, 1+i, 0, "<%s", description);
@@ -715,8 +730,11 @@ static void _cmd_filesystem_usage_linear(int mode,
for (i = 0; i < sargs->total_spaces; i++) {
const char *description;
const char *r_mode;
-
u64 flags = sargs->spaces[i].flags;
+
+ if (flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
+ continue;
+
description = btrfs_group_type_str(flags);
r_mode = btrfs_group_profile_str(flags);