From: Trond Myklebust <trond.myklebust@primarydata.com>
To: linux-nfs@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>, Stephen Rothwell <sfr@canb.auug.org.au>
Subject: [PATCH v2] pnfs/blocklayout: Fix a 64-bit division/remainder issue in bl_map_stripe
Date: Thu, 18 Sep 2014 17:15:48 -0400 [thread overview]
Message-ID: <1411074948-77880-1-git-send-email-trond.myklebust@primarydata.com> (raw)
kbuild test robot reports:
fs/built-in.o: In function `bl_map_stripe':
>> :(.text+0x965b4): undefined reference to `__aeabi_uldivmod'
>> :(.text+0x965cc): undefined reference to `__aeabi_uldivmod'
>> :(.text+0x96604): undefined reference to `__aeabi_uldivmod'
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
v2: Include the calculation of disk_offset.
fs/nfs/blocklayout/dev.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/blocklayout/dev.c b/fs/nfs/blocklayout/dev.c
index 00f159da06ee..5aed4f98df41 100644
--- a/fs/nfs/blocklayout/dev.c
+++ b/fs/nfs/blocklayout/dev.c
@@ -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);
@@ -165,7 +168,7 @@ static bool bl_map_stripe(struct pnfs_block_dev *dev, u64 offset,
offset = chunk * dev->chunk_size;
/* disk offset of the stripe */
- disk_offset = offset / dev->nr_children;
+ disk_offset = div_u64(offset, dev->nr_children);
child = &dev->children[chunk_idx];
child->map(child, disk_offset, map);
--
1.9.3
next reply other threads:[~2014-09-18 21:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 21:15 Trond Myklebust [this message]
2014-09-18 23:39 ` [PATCH v2] pnfs/blocklayout: Fix a 64-bit division/remainder issue in bl_map_stripe Christoph Hellwig
2014-09-21 17:08 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411074948-77880-1-git-send-email-trond.myklebust@primarydata.com \
--to=trond.myklebust@primarydata.com \
--cc=hch@lst.de \
--cc=linux-nfs@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox