Skip to contentSkip to conversation

block: iolatency: avoid 64-bit division

PATCH Applied Arnd Bergmann 3 participants 3 messages Jul 10, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: iolatency: avoid 64-bit division

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")
---
 block/blk-iolatency.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
block/blk-iolatency.c +1 -2
index a35a1f580337..56ddb2c68752 100644
@@ -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;
 }
 
Signature · 1 line
2.9.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Arnd Bergmann

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")

Oops sorry Arnd,

maintainer Applied
#2 lore raw
In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

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.

Applied, thanks Arnd.

Signature · 1 line
Jens Axboe