From 6c9a5fa103c65dfe00fe6648c89357f1ffeb9e5c Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 23 Dec 2011 09:07:14 +1100 Subject: [PATCH] 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 --- bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitmap.c b/bitmap.c index d02f16e..103706b 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;