aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2011-03-27 21:23:21 -0400
committerroot <Chris Mason chris.mason@oracle.com>2011-03-28 05:37:59 -0400
commitd9d04879321af570ea7285c6dad92d9c3cd108a1 (patch)
tree5a861897ca626d7bfa95ffc82a8448da2987533d /fs
parent1561deda687eef0e95065f1268d680ddc5976ee7 (diff)
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.c26
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:
3126 3126
3127 if (map->type & BTRFS_BLOCK_GROUP_RAID0) { 3127 if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
3128 u64 stripes; 3128 u64 stripes;
3129 int last_stripe = (stripe_nr_end - 1) % 3129 u32 last_stripe = 0;
3130 map->num_stripes;
3131 int j; 3130 int j;
3132 3131
3132 div_u64_rem(stripe_nr_end - 1,
3133 map->num_stripes,
3134 &last_stripe);
3135
3133 for (j = 0; j < map->num_stripes; j++) { 3136 for (j = 0; j < map->num_stripes; j++) {
3134 if ((stripe_nr_end - 1 - j) % 3137 u32 test;
3135 map->num_stripes == stripe_index) 3138
3139 div_u64_rem(stripe_nr_end - 1 - j,
3140 map->num_stripes, &test);
3141 if (test == stripe_index)
3136 break; 3142 break;
3137 } 3143 }
3138 stripes = stripe_nr_end - 1 - j; 3144 stripes = stripe_nr_end - 1 - j;
@@ -3153,11 +3159,19 @@ again:
3153 int j; 3159 int j;
3154 int factor = map->num_stripes / 3160 int factor = map->num_stripes /
3155 map->sub_stripes; 3161 map->sub_stripes;
3156 int last_stripe = (stripe_nr_end - 1) % factor; 3162 u32 last_stripe = 0;
3163
3164 div_u64_rem(stripe_nr_end - 1,
3165 factor, &last_stripe);
3157 last_stripe *= map->sub_stripes; 3166 last_stripe *= map->sub_stripes;
3158 3167
3159 for (j = 0; j < factor; j++) { 3168 for (j = 0; j < factor; j++) {
3160 if ((stripe_nr_end - 1 - j) % factor == 3169 u32 test;
3170
3171 div_u64_rem(stripe_nr_end - 1 - j,
3172 factor, &test);
3173
3174 if (test ==
3161 stripe_index / map->sub_stripes) 3175 stripe_index / map->sub_stripes)
3162 break; 3176 break;
3163 } 3177 }