Btrfs: RAID5 and RAID6
[linux-2.6-block.git] / fs / btrfs / scrub.c
index bdbb94f245c9070802c65acb6eba392ba1a4c932..bc35ed4238b829c2aeb6ffa16ef3b95119a2c582 100644 (file)
@@ -28,6 +28,7 @@
 #include "dev-replace.h"
 #include "check-integrity.h"
 #include "rcu-string.h"
+#include "raid56.h"
 
 /*
  * This is only the first step towards a full-features scrub. It reads all
@@ -2246,6 +2247,13 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
        struct btrfs_device *extent_dev;
        int extent_mirror_num;
 
+       if (map->type & (BTRFS_BLOCK_GROUP_RAID5 |
+                        BTRFS_BLOCK_GROUP_RAID6)) {
+               if (num >= nr_data_stripes(map)) {
+                       return 0;
+               }
+       }
+
        nstripes = length;
        offset = 0;
        do_div(nstripes, map->stripe_len);