]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
nvme: Fixes u64 division which breaks i386 builds
authorJon Derrick <jonathan.derrick@intel.com>
Tue, 21 Jul 2015 21:08:13 +0000 (15:08 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 21 Jul 2015 21:36:24 +0000 (15:36 -0600)
Uses div_u64 for u64 division and round_down, a bitwise operation,
instead of rounddown, which uses a modulus.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/nvme-core.c

index 82b4ffb6eefa7bc5f2690f31d40fb10c2c0e3993..666e994fd622ce33403cff239ea251ded13e29c5 100644 (file)
@@ -1454,8 +1454,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