diff options
author | Chris Mason <chris.mason@oracle.com> | 2011-03-27 21:23:21 -0400 |
---|---|---|
committer | root <Chris Mason chris.mason@oracle.com> | 2011-03-28 05:37:59 -0400 |
commit | d9d04879321af570ea7285c6dad92d9c3cd108a1 (patch) | |
tree | 5a861897ca626d7bfa95ffc82a8448da2987533d /fs | |
parent | 1561deda687eef0e95065f1268d680ddc5976ee7 (diff) | |
download | linux-stable-d9d04879321af570ea7285c6dad92d9c3cd108a1.tar.gz linux-stable-d9d04879321af570ea7285c6dad92d9c3cd108a1.tar.bz2 linux-stable-d9d04879321af570ea7285c6dad92d9c3cd108a1.zip |
Btrfs: fix __btrfs_map_block on 32 bit machines
Recent changes for discard support didn't compile,
this fixes them not to try and % 64 bit numbers.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/volumes.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c440c89a470a..8b9fb8c7683d 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -3126,13 +3126,19 @@ again: if (map->type & BTRFS_BLOCK_GROUP_RAID0) { u64 stripes; - int last_stripe = (stripe_nr_end - 1) % - map->num_stripes; + u32 last_stripe = 0; int j; + div_u64_rem(stripe_nr_end - 1, + map->num_stripes, + &last_stripe); + for (j = 0; j < map->num_stripes; j++) { - if ((stripe_nr_end - 1 - j) % - map->num_stripes == stripe_index) + u32 test; + + div_u64_rem(stripe_nr_end - 1 - j, + map->num_stripes, &test); + if (test == stripe_index) break; } stripes = stripe_nr_end - 1 - j; @@ -3153,11 +3159,19 @@ again: int j; int factor = map->num_stripes / map->sub_stripes; - int last_stripe = (stripe_nr_end - 1) % factor; + u32 last_stripe = 0; + + div_u64_rem(stripe_nr_end - 1, + factor, &last_stripe); last_stripe *= map->sub_stripes; for (j = 0; j < factor; j++) { - if ((stripe_nr_end - 1 - j) % factor == + u32 test; + + div_u64_rem(stripe_nr_end - 1 - j, + factor, &test); + + if (test == stripe_index / map->sub_stripes) break; } |