From 77f2c84d2f599d86a60586494169dcab17853e3a Mon Sep 17 00:00:00 2001 From: Matthias Eble Date: Mon, 15 Nov 2010 23:59:35 +0100 Subject: Fix check_disk free space calculation if blocksizes differ within a disk group (Bekar - #2973603) Various values (dused_pct, dfree_pct, inodes_free, inodes_total, ...) are now carried in the parameter_list structure. Assignments have been moved to a subroutine preventing code redundancies. Group metrics are now calculated based on units rather than blocks. This fixes freespace calculation when blocksizes differ within a group. --- lib/utils_disk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/utils_disk.c') diff --git a/lib/utils_disk.c b/lib/utils_disk.c index 3d20f4d4..5be2b2c0 100644 --- a/lib/utils_disk.c +++ b/lib/utils_disk.c @@ -58,6 +58,19 @@ np_add_parameter(struct parameter_list **list, const char *name) new_path->usedinodes_percent = NULL; new_path->freeinodes_percent = NULL; new_path->group = NULL; + new_path->dfree_pct = -1; + new_path->dused_pct = -1; + new_path->total = 0; + new_path->available = 0; + new_path->available_to_root = 0; + new_path->used = 0; + new_path->dused_units = 0; + new_path->dfree_units = 0; + new_path->dtotal_units = 0; + new_path->inodes_total = 0; + new_path->inodes_free = 0; + new_path->dused_inodes_percent = 0; + new_path->dfree_inodes_percent = 0; if (current == NULL) { *list = new_path; -- cgit v1.2.3-74-g34f1