linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] bcache: fix rounding in human readable output
@ 2014-11-24 13:05 Juerd Waalboer
  0 siblings, 0 replies; only message in thread
From: Juerd Waalboer @ 2014-11-24 13:05 UTC (permalink / raw)
  To: linux-bcache, Kent Overstreet

Division by 100 caused results like 3.9k < 3.10k < 4.0k; fixed by
increasing the denominator to 103, which is a better approximation
of 1024 / 10 == 102.4

Signed-off-by: Juerd Waalboer <juerd@tnx.nl>
---
 drivers/md/bcache/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c
index db3ae4c..56e8a62 100644
--- a/drivers/md/bcache/util.c
+++ b/drivers/md/bcache/util.c
@@ -88,7 +88,7 @@ ssize_t bch_hprint(char *buf, int64_t v)
 		return sprintf(buf, "%llu", v);
 
 	if (v < 100 && v > -100)
-		snprintf(dec, sizeof(dec), ".%i", t / 100);
+		snprintf(dec, sizeof(dec), ".%i", t / 103);
 
 	return sprintf(buf, "%lli%s%c", v, dec, units[u]);
 }
-- 
2.1.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-24 13:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-24 13:05 [PATCH 1/1] bcache: fix rounding in human readable output Juerd Waalboer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).