Skip to content

Commit

Permalink
Btrfs: fix repair code for RAID10
Browse files Browse the repository at this point in the history
btrfs_map_block sets mirror_num, so that the repair code knows eventually
which device gave us the read error. For RAID10, mirror_num must be 1 or 2.
Before this fix mirror_num was incorrectly related to our stripe index.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Jan Schmidt authored and Chris Mason committed Apr 27, 2012
1 parent 996d282 commit 3e74317
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -3807,10 +3807,11 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
else if (mirror_num)
stripe_index += mirror_num - 1;
else {
int old_stripe_index = stripe_index;
stripe_index = find_live_mirror(map, stripe_index,
map->sub_stripes, stripe_index +
current->pid % map->sub_stripes);
mirror_num = stripe_index + 1;
mirror_num = stripe_index - old_stripe_index + 1;
}
} else {
/*
Expand Down

0 comments on commit 3e74317

Please sign in to comment.