Skip to content

Commit 021bc89

Browse files
committed
btrfs-progs: remove the unnecessary device_get_partition_size() call
Inside function _cmd_filesystem_usage_tabular(), there is a call of device_get_partition_size() to calculate @unused. However immediately after that call, @unused is updated using devinfo->size, so that the previous call of device_get_partition_size() is completely useless. Just remove the unnecessary call. And since we're here, also remove a dead newline in that loop at variable declaration. Fixes: 7ab0c46 ("btrfs-progs: fi usage: fix unallocated and print total and slack") Reviewed-by: Anand Jain <[email protected]> Signed-off-by: Qu Wenruo <[email protected]>
1 parent 0c646f7 commit 021bc89

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

cmds/filesystem-usage.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,6 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
959959
int k;
960960
const char *p;
961961
const struct device_info *devinfo = devinfos->data[i];
962-
963962
u64 total_allocated = 0, unused;
964963

965964
p = strrchr(devinfo->path, '/');
@@ -1000,7 +999,6 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
1000999
col++;
10011000
}
10021001

1003-
unused = device_get_partition_size(devinfo->path) - total_allocated;
10041002
unused = devinfo->size - total_allocated;
10051003

10061004
table_printf(matrix, unallocated_col, vhdr_skip + i, ">%s",

0 commit comments

Comments
 (0)