From: "Juerd Waalboer" <juerd@tnx.nl>
To: linux-bcache@vger.kernel.org, Kent Overstreet <kmo@daterainc.com>
Subject: [PATCH 1/1] bcache: fix rounding in human readable output
Date: Mon, 24 Nov 2014 14:05:43 +0100 [thread overview]
Message-ID: <20141124130543.GD2814@k> (raw)
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
reply other threads:[~2014-11-24 13:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141124130543.GD2814@k \
--to=juerd@tnx.nl \
--cc=kmo@daterainc.com \
--cc=linux-bcache@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox