Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 243184
b: refs/heads/master
c: d9d0487
h: refs/heads/master
v: v3
  • Loading branch information
Chris Mason authored and root committed Mar 28, 2011
1 parent 5e3f72e commit 1886422
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1561deda687eef0e95065f1268d680ddc5976ee7
refs/heads/master: d9d04879321af570ea7285c6dad92d9c3cd108a1
26 changes: 20 additions & 6 deletions trunk/fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -3126,13 +3126,19 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,

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;
Expand All @@ -3153,11 +3159,19 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
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;
}
Expand Down

0 comments on commit 1886422

Please sign in to comment.