summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/util.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-12-28 22:01:25 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:09:20 +0200
commit042b0f38642f534fe92122c5b5695739390bbe34 (patch)
tree6bea64b6bff8d3c272a0afbf42255cdf3c86587e /fs/bcachefs/util.c
parentbcachefs: Optimize bucket reuse (diff)
downloadlinux-042b0f38642f534fe92122c5b5695739390bbe34.tar.xz
linux-042b0f38642f534fe92122c5b5695739390bbe34.zip
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: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/util.c')
-rw-r--r--fs/bcachefs/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c
index 8211c9a1b6cb..e7675b4597db 100644
--- a/fs/bcachefs/util.c
+++ b/fs/bcachefs/util.c
@@ -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
* 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);
if (u)
pr_buf(buf, "%c", si_units[u]);