__btrfs_map_block() should return all mirror on WRITE,
REQ_GET_READ_MIRRORS, and RECOVERY case, whether need_raid_map set
or not.

need_raid_map only used to control is to set bbio->raid_map.

Current code works right because there is only one caller can
trigger above bug, which is readahead, and this function happened
to bypass on less mirror.

Signed-off-by: Zhao Lei <[email protected]>
---
 fs/btrfs/volumes.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index a6df8fd..4ee429b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5464,9 +5464,8 @@ static int __btrfs_map_block(struct btrfs_fs_info 
*fs_info, int rw,
                }
 
        } else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
-               if (need_raid_map &&
-                   ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) ||
-                    mirror_num > 1)) {
+               if ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) ||
+                   mirror_num > 1) {
                        /* push stripe_nr back to the start of the full stripe 
*/
                        stripe_nr = div_u64(raid56_full_stripe_start,
                                        stripe_len * nr_data_stripes(map));
-- 
1.8.5.1



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to