Commit 042b0f38 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: bch2_hprint(): don't print decimal if conversion was exact

There's places where we parse these numbers, and our parsing doesn't
cope with decimals currently - this is a hack to get the device_add path
working again where for the device blocksize there doesn't ever need to
be a decimal.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent e3ad2937
...@@ -114,7 +114,7 @@ void bch2_hprint(struct printbuf *buf, s64 v) ...@@ -114,7 +114,7 @@ void bch2_hprint(struct printbuf *buf, s64 v)
* 103 is magic: t is in the range [-1023, 1023] and we want * 103 is magic: t is in the range [-1023, 1023] and we want
* to turn it into [-9, 9] * to turn it into [-9, 9]
*/ */
if (u && v < 100 && v > -100) if (u && t && v < 100 && v > -100)
pr_buf(buf, ".%i", t / 103); pr_buf(buf, ".%i", t / 103);
if (u) if (u)
pr_buf(buf, "%c", si_units[u]); pr_buf(buf, "%c", si_units[u]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment