summaryrefslogtreecommitdiff
path: root/cmds-fi-usage.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2015-11-02 18:44:45 +0100
committerDavid Sterba <dsterba@suse.com>2015-11-03 00:14:06 +0100
commitf3d5694578c6a19afbadaabb4ed95da9f0694834 (patch)
treeeccc2e0e53a7d4cfe614f04feeb6ad2348f38caa /cmds-fi-usage.c
parent7691c2c52bf967130f4ae50f25f44ff21aacf786 (diff)
downloadbtrfs-progs-f3d5694578c6a19afbadaabb4ed95da9f0694834.tar.gz
btrfs-progs: fi usage: properly count real space infos
We did not account the column for path but abused the skipped global block reserve colum instead. Properly count the real infos and manually added headers. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-fi-usage.c')
-rw-r--r--cmds-fi-usage.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c
index b1ae447..2eb5739 100644
--- a/cmds-fi-usage.c
+++ b/cmds-fi-usage.c
@@ -625,8 +625,15 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
int col;
int unallocated_col;
- /* data/metadata/system, unallocated */
- ncols = sargs->total_spaces + 1;
+ /* path, unallocated */
+ ncols = 2;
+ /* Properly count the real space infos */
+ for (i = 0; i < sargs->total_spaces; i++) {
+ if (sargs->spaces[i].flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
+ continue;
+ ncols++;
+ }
+
/* 2 for header, empty line, devices, ===, total, used */
nrows = 2 + 1 + device_info_count + 1 + 2;