From: NeilBrown Date: Thu, 22 Dec 2011 22:07:14 +0000 (+1100) Subject: bitmap: print correct percentage of bitmap in use. X-Git-Tag: mdadm-3.2.3~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c9a5fa103c65dfe00fe6648c89357f1ffeb9e5c;p=thirdparty%2Fmdadm.git bitmap: print correct percentage of bitmap in use. We were adding 1, presumably to avoid div-by-zero possibilities. It is better to only substitute '1' if the value actually is zero, else for small numbers of bits the difference is visible. Signed-off-by: NeilBrown --- diff --git a/bitmap.c b/bitmap.c index d02f16e6..103706be 100644 --- a/bitmap.c +++ b/bitmap.c @@ -334,7 +334,7 @@ int ExamineBitmap(char *filename, int brief, struct supertype *st) goto free_info; printf(" Bitmap : %llu bits (chunks), %llu dirty (%2.1f%%)\n", info->total_bits, info->dirty_bits, - 100.0 * info->dirty_bits / (info->total_bits + 1)); + 100.0 * info->dirty_bits / (info->total_bits?:1)); free_info: free(info); return rv;