From: David Sterba Date: Mon, 2 Nov 2015 17:44:45 +0000 (+0100) Subject: btrfs-progs: fi usage: properly count real space infos X-Git-Tag: upstream/4.16.1~1903 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3d5694578c6a19afbadaabb4ed95da9f0694834;p=platform%2Fupstream%2Fbtrfs-progs.git 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 --- 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;