Skip to contentSkip to conversation

pnfs/blocklayout: Fix a 64-bit division/remainder issue in bl_map_stripe

PATCH Superseded Trond Myklebust 1 participant 1 message Sep 18, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pnfs/blocklayout: Fix a 64-bit division/remainder issue in bl_map_stripe

kbuild test robot reports:

fs/built-in.o: In function `bl_map_stripe':

Quoted 3 lines
Quoted 3 lines

:(.text+0x965b4): undefined reference to __aeabi_uldivmod' :(.text+0x965cc): undefined reference to __aeabi_uldivmod' :(.text+0x96604): undefined reference to `__aeabi_uldivmod'

Cc Stephen Rothwell <[email protected]>
Cc Christoph Hellwig <[email protected]>
---
 fs/nfs/blocklayout/dev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/nfs/blocklayout/dev.c +5 -2
index 00f159da06ee..ffe23b0d8a31 100644
@@ -150,10 +150,13 @@ static bool bl_map_stripe(struct pnfs_block_dev *dev, u64 offset,
 		struct pnfs_block_dev_map *map)
 {
 	struct pnfs_block_dev *child;
-	u64 chunk = (offset / dev->chunk_size);
-	int chunk_idx = chunk % dev->nr_children;
+	u64 chunk;
+	u32 chunk_idx;
 	u64 disk_offset;
 
+	chunk = div_u64(offset, dev->chunk_size);
+	div_u64_rem(chunk, dev->nr_children, &chunk_idx);
+
 	if (chunk_idx > dev->nr_children) {
 		dprintk("%s: invalid chunk idx %d (%lld/%lld)\n",
 			__func__, chunk_idx, offset, dev->chunk_size);
Signature · 1 line
1.9.3