From fd0bd123d5bc11d665ad0e80eaf4b458619f8b3d Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Tue, 17 Aug 2021 17:14:26 -0600 Subject: [PATCH] bcachefs: Fix 32 bit build failures This fix replaces multiple 64 bit divisions with do_div() equivalents. Signed-off-by: Brett Holman Signed-off-by: Kent Overstreet --- fs/bcachefs/buckets.c | 2 +- fs/bcachefs/tests.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index e00c02dcb63ea..d7994229ad5ae 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -670,7 +670,7 @@ static s64 ptr_disk_sectors(s64 sectors, struct extent_ptr_decoded p) return p.crc.compression_type && p.crc.compression_type != BCH_COMPRESSION_TYPE_incompressible - ? DIV_ROUND_UP(sectors * p.crc.compressed_size, + ? DIV_ROUND_UP_ULL(sectors * p.crc.compressed_size, p.crc.uncompressed_size) : sectors; } diff --git a/fs/bcachefs/tests.c b/fs/bcachefs/tests.c index 9c7812f629356..43b514974d91b 100644 --- a/fs/bcachefs/tests.c +++ b/fs/bcachefs/tests.c @@ -778,7 +778,7 @@ static int btree_perf_test_thread(void *data) wait_event(j->ready_wait, !atomic_read(&j->ready)); } - ret = j->fn(j->c, j->nr / j->nr_threads); + ret = j->fn(j->c, div64_u64(j->nr, j->nr_threads)); if (ret) j->ret = ret; @@ -854,11 +854,11 @@ int bch2_btree_perf_test(struct bch_fs *c, const char *testname, scnprintf(name_buf, sizeof(name_buf), "%s:", testname); bch2_hprint(&PBUF(nr_buf), nr); - bch2_hprint(&PBUF(per_sec_buf), nr * NSEC_PER_SEC / time); + bch2_hprint(&PBUF(per_sec_buf), div64_u64(nr * NSEC_PER_SEC, time)); printk(KERN_INFO "%-12s %s with %u threads in %5llu sec, %5llu nsec per iter, %5s per sec\n", name_buf, nr_buf, nr_threads, - time / NSEC_PER_SEC, - time * nr_threads / nr, + div_u64(time, NSEC_PER_SEC), + div_u64(time * nr_threads, nr), per_sec_buf); return j.ret; } -- 2.30.2