bcachefs: Fix a 64 bit divide
authorKent Overstreet <kent.overstreet@gmail.com>
Fri, 13 Nov 2020 19:49:57 +0000 (14:49 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:47 +0000 (17:08 -0400)
this fixes builds on 32 bit.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/buckets.c

index 0dc01386d1cde05863cc64cbc7007c7e830186d2..65d9b81266099738945e360b39d1d5e8df4cea0d 100644 (file)
@@ -321,7 +321,7 @@ static u64 reserve_factor(u64 r)
 
 static u64 avail_factor(u64 r)
 {
-       return (r << RESERVE_FACTOR) / ((1 << RESERVE_FACTOR) + 1);
+       return div_u64(r << RESERVE_FACTOR, (1 << RESERVE_FACTOR) + 1);
 }
 
 u64 bch2_fs_sectors_used(struct bch_fs *c, struct bch_fs_usage_online *fs_usage)