From: liubo <liubo2009@cn.fujitsu.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: fix compile warning from __btrfs_map_block
Date: Fri, 01 Apr 2011 08:46:24 +0800 [thread overview]
Message-ID: <4D952060.1020903@cn.fujitsu.com> (raw)
In-Reply-To: <1301573269-sup-7700@think>
On 03/31/2011 08:10 PM, Chris Mason wrote:
> Excerpts from liubo's message of 2011-03-31 05:45:20 -0400:
>> While compile btrfs modules on 32bit box, I encounter the following:
>>
>> WARNING: "__umoddi3" [fs/btrfs/btrfs.ko] undefined!
>>
>> The WARNING comes from that __btrfs_map_block does not use do_div() for
>> relative operations, this will cause problems on 32bit box, for values
>> with "u64" type should use do_div() instead of a direct "%".
>
> Which kernel tree was this against? I had rebased the for-linus and
> for-linus-unmerged branch to get rid of it.
>
> Sorry for the confusion.
Ah, it is my fault to neglect the version, I found this warning while compiling
the latest for-linus tree (top commit: c1e1f82c56af1a286fd747e809c94628c2ca15fb).
thanks,
liubo
>
> -chris
>
>> Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
>> ---
>> fs/btrfs/volumes.c | 23 +++++++++++++++--------
>> 1 files changed, 15 insertions(+), 8 deletions(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index 41afd50..7b23d0f 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -3076,16 +3076,19 @@ again:
>> multi->stripes[i].dev = map->stripes[stripe_index].dev;
>>
>> if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
>> - u64 stripes;
>> - int last_stripe = (stripe_nr_end - 1) %
>> - map->num_stripes;
>> + u64 stripes = stripe_nr_end - 1;
>> + int last_stripe = do_div(stripes,
>> + map->num_stripes);
>> int j;
>>
>> for (j = 0; j < map->num_stripes; j++) {
>> - if ((stripe_nr_end - 1 - j) %
>> - map->num_stripes == stripe_index)
>> + stripes = stripe_nr_end - 1 - j;
>> +
>> + if (do_div(stripes, map->num_stripes) ==
>> + stripe_index)
>> break;
>> }
>> +
>> stripes = stripe_nr_end - 1 - j;
>> do_div(stripes, map->num_stripes);
>> multi->stripes[i].length = map->stripe_len *
>> @@ -3100,18 +3103,22 @@ again:
>> multi->stripes[i].length -=
>> stripe_end_offset;
>> } else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
>> - u64 stripes;
>> + u64 stripes = stripe_nr_end - 1;
>> int j;
>> int factor = map->num_stripes /
>> map->sub_stripes;
>> - int last_stripe = (stripe_nr_end - 1) % factor;
>> + int last_stripe = do_div(stripes, factor);
>> +
>> last_stripe *= map->sub_stripes;
>>
>> for (j = 0; j < factor; j++) {
>> - if ((stripe_nr_end - 1 - j) % factor ==
>> + stripes = stripe_nr_end - 1 - j;
>> +
>> + if (do_div(stripes, factor) ==
>> stripe_index / map->sub_stripes)
>> break;
>> }
>> +
>> stripes = stripe_nr_end - 1 - j;
>> do_div(stripes, factor);
>> multi->stripes[i].length = map->stripe_len *
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2011-04-01 0:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4D944235.7020408@cn.fujitsu.com>
2011-03-31 9:45 ` [PATCH] Btrfs: fix compile warning from __btrfs_map_block liubo
2011-03-31 12:10 ` Chris Mason
2011-04-01 0:46 ` liubo [this message]
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=4D952060.1020903@cn.fujitsu.com \
--to=liubo2009@cn.fujitsu.com \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).