From: Jan Schmidt Date: Fri, 27 Apr 2012 16:41:45 +0000 (-0400) Subject: Btrfs: fix repair code for RAID10 X-Git-Tag: accepted/tizen/common/20141203.182822~4703^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e74317ad773ba9df36db1fa32848cba41ac4d1a;p=platform%2Fkernel%2Flinux-arm64.git Btrfs: fix repair code for RAID10 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 Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 3b98417..1411b99 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -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 { /*