block: iolatency: avoid 64-bit division
authorArnd Bergmann <arnd@arndb.de>
Tue, 10 Jul 2018 15:21:34 +0000 (17:21 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 10 Jul 2018 18:26:09 +0000 (12:26 -0600)
On 32-bit architectures, dividing a 64-bit number needs to use the
do_div() function or something like it to avoid a link failure:

block/blk-iolatency.o: In function `iolatency_prfill_limit':
blk-iolatency.c:(.text+0x8cc): undefined reference to `__aeabi_uldivmod'

Using div_u64() gives us the best output and avoids the need for an
explicit cast.

Fixes: d70675121546 ("block: introduce blk-iolatency io controller")
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-iolatency.c

index a35a1f58033765563cd96649c2ccdb4cfef844c4..56ddb2c68752c014ebe5985329195c1498a7b399 100644 (file)
@@ -798,8 +798,7 @@ static u64 iolatency_prfill_limit(struct seq_file *sf,
        if (!dname || !iolat->min_lat_nsec)
                return 0;
        seq_printf(sf, "%s target=%llu\n",
-                  dname,
-                  (unsigned long long)iolat->min_lat_nsec / NSEC_PER_USEC);
+                  dname, div_u64(iolat->min_lat_nsec, NSEC_PER_USEC));
        return 0;
 }