mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2025-01-09 20:44:11 +08:00
btrfs-progs: fi usage: cleanup, replace space info starting column constant
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ffa899f296
commit
258a0e8812
@ -624,10 +624,12 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
|
|||||||
int ncols, nrows;
|
int ncols, nrows;
|
||||||
int col;
|
int col;
|
||||||
int unallocated_col;
|
int unallocated_col;
|
||||||
|
int spaceinfos_col;
|
||||||
const int vhdr_skip = 3; /* amount of vertical header space */
|
const int vhdr_skip = 3; /* amount of vertical header space */
|
||||||
|
|
||||||
/* path, unallocated */
|
/* path, unallocated */
|
||||||
ncols = 2;
|
ncols = 2;
|
||||||
|
spaceinfos_col = 1;
|
||||||
/* Properly count the real space infos */
|
/* Properly count the real space infos */
|
||||||
for (i = 0; i < sargs->total_spaces; i++) {
|
for (i = 0; i < sargs->total_spaces; i++) {
|
||||||
if (sargs->spaces[i].flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
if (sargs->spaces[i].flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
||||||
@ -650,7 +652,7 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
for (i = 0, col = 1; i < sargs->total_spaces; i++) {
|
for (i = 0, col = spaceinfos_col; i < sargs->total_spaces; i++) {
|
||||||
u64 flags = sargs->spaces[i].flags;
|
u64 flags = sargs->spaces[i].flags;
|
||||||
|
|
||||||
if (flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
if (flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
||||||
@ -683,7 +685,7 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
|
|||||||
table_printf(matrix, 0, vhdr_skip + i, "<%s",
|
table_printf(matrix, 0, vhdr_skip + i, "<%s",
|
||||||
device_info_ptr[i].path);
|
device_info_ptr[i].path);
|
||||||
|
|
||||||
for (col = 1, k = 0 ; k < sargs->total_spaces ; k++) {
|
for (col = spaceinfos_col, k = 0; k < sargs->total_spaces; k++) {
|
||||||
u64 flags = sargs->spaces[k].flags;
|
u64 flags = sargs->spaces[k].flags;
|
||||||
u64 devid = device_info_ptr[i].devid;
|
u64 devid = device_info_ptr[i].devid;
|
||||||
int j;
|
int j;
|
||||||
@ -720,7 +722,7 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, col = 1; i < sargs->total_spaces; i++) {
|
for (i = 0, col = spaceinfos_col; i < sargs->total_spaces; i++) {
|
||||||
if (sargs->spaces[i].flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
if (sargs->spaces[i].flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -731,7 +733,7 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
|
|||||||
|
|
||||||
/* footer */
|
/* footer */
|
||||||
table_printf(matrix, 0, vhdr_skip + device_info_count + 1, "<Total");
|
table_printf(matrix, 0, vhdr_skip + device_info_count + 1, "<Total");
|
||||||
for (i = 0, col = 1; i < sargs->total_spaces; i++) {
|
for (i = 0, col = spaceinfos_col; i < sargs->total_spaces; i++) {
|
||||||
if (sargs->spaces[i].flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
if (sargs->spaces[i].flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -744,7 +746,7 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
|
|||||||
">%s", pretty_size_mode(total_unused, unit_mode));
|
">%s", pretty_size_mode(total_unused, unit_mode));
|
||||||
|
|
||||||
table_printf(matrix, 0, vhdr_skip + device_info_count + 2, "<Used");
|
table_printf(matrix, 0, vhdr_skip + device_info_count + 2, "<Used");
|
||||||
for (i = 0, col = 1; i < sargs->total_spaces; i++) {
|
for (i = 0, col = spaceinfos_col; i < sargs->total_spaces; i++) {
|
||||||
if (sargs->spaces[i].flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
if (sargs->spaces[i].flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user