[2/4] btrfs: return all mirror whether need_raid_map set or not
diff mbox

Message ID 77a0296e8261fa89dba93cc2d9bc39ebf3a19770.1450177455.git.zhaolei@cn.fujitsu.com
State New
Headers show

Commit Message

Zhaolei Dec. 15, 2015, 11:09 a.m. UTC
__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 <zhaolei@cn.fujitsu.com>
---
 fs/btrfs/volumes.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Patch
diff mbox

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));