Commit d9d04879 authored by Chris Mason's avatar Chris Mason Committed by root

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: default avatarChris Mason <chris.mason@oracle.com>
parent 1561deda
...@@ -3126,13 +3126,19 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, ...@@ -3126,13 +3126,19 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
if (map->type & BTRFS_BLOCK_GROUP_RAID0) { if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
u64 stripes; u64 stripes;
int last_stripe = (stripe_nr_end - 1) % u32 last_stripe = 0;
map->num_stripes;
int j; int j;
div_u64_rem(stripe_nr_end - 1,
map->num_stripes,
&last_stripe);
for (j = 0; j < map->num_stripes; j++) { for (j = 0; j < map->num_stripes; j++) {
if ((stripe_nr_end - 1 - j) % u32 test;
map->num_stripes == stripe_index)
div_u64_rem(stripe_nr_end - 1 - j,
map->num_stripes, &test);
if (test == stripe_index)
break; break;
} }
stripes = stripe_nr_end - 1 - j; stripes = stripe_nr_end - 1 - j;
...@@ -3153,11 +3159,19 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, ...@@ -3153,11 +3159,19 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
int j; int j;
int factor = map->num_stripes / int factor = map->num_stripes /
map->sub_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; last_stripe *= map->sub_stripes;
for (j = 0; j < factor; j++) { 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) stripe_index / map->sub_stripes)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment