]> git.hungrycats.org Git - linux/commitdiff
btrfs: Use direct way to determine raid56 write/recover mode
authorZhao Lei <zhaolei@cn.fujitsu.com>
Tue, 15 Dec 2015 10:18:09 +0000 (18:18 +0800)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Sun, 24 Jan 2016 04:09:49 +0000 (23:09 -0500)
Old code used bbio->raid_map to determine whether in raid56
write/recover operation, because we didn't't have bbio->map_type.

Now we have direct way for this condition, rid of using
the function-relative data, and make the code more readable.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit ad1ba2a0c453db255f04b17101db6d05c44d8467)

fs/btrfs/volumes.c

index 8693e6acb79b78b8e2deb00ef4cbe3b741923a03..f445e7d385fab98278fe5f2fa47922a35db3c380 100644 (file)
@@ -6010,7 +6010,8 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
        bbio->fs_info = root->fs_info;
        atomic_set(&bbio->stripes_pending, bbio->num_stripes);
 
-       if (bbio->raid_map) {
+       if ((bbio->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) &&
+           ((rw & WRITE) || (mirror_num > 1))) {
                /* In this case, map_length has been set to the length of
                   a single stripe; not the whole write */
                if (rw & WRITE) {