From 1b933d02b49b48f2cdbb65a7cd1e5fb851695850 Mon Sep 17 00:00:00 2001 From: Jon Derrick Date: Tue, 21 Jul 2015 15:08:13 -0600 Subject: [PATCH] nvme: Fixes u64 division which breaks i386 builds Uses div_u64 for u64 division and round_down, a bitwise operation, instead of rounddown, which uses a modulus. Signed-off-by: Jon Derrick Signed-off-by: Jens Axboe (cherry picked from commit c45f5c9943ce0b16b299b543c2aae12408039027) Orabug: 22620486 Signed-off-by: Jason Luo --- drivers/block/nvme-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 437960af31210..95213dec62a5b 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1461,8 +1461,9 @@ static int nvme_cmb_qdepth(struct nvme_dev *dev, int nr_io_queues, unsigned q_size_aligned = roundup(q_depth * entry_size, dev->page_size); if (q_size_aligned * nr_io_queues > dev->cmb_size) { - q_depth = rounddown(dev->cmb_size / nr_io_queues, - dev->page_size) / entry_size; + u64 mem_per_q = div_u64(dev->cmb_size, nr_io_queues); + mem_per_q = round_down(mem_per_q, dev->page_size); + q_depth = div_u64(mem_per_q, entry_size); /* * Ensure the reduced q_depth is above some threshold where it -- 2.49.0