btrfs: reada: Ignore creating reada_extent for non-exist device
diff mbox

Message ID 0b625fb1b1bef88f7c6c953ce8972c9aee33c9a1.1453966709.git.zhaolei@cn.fujitsu.com
State New
Headers show

Commit Message

Zhaolei Jan. 28, 2016, 7:38 a.m. UTC
For a non-exist device, old code bypass adding it in dev's reada
queue.

And to solve problem of unfinished waitting in raid5/6,
commit 5fbc7c59fd22 ("Btrfs: fix unfinished readahead thread for
raid5/6 degraded mounting")
adding a exception for the first strip, in short, the first
strip will always be processed whether the device exist or not.

Actually we have a better way for above request: just bypass
creation of the reada_extent for non-exist device, it will make
code simple and effective.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 fs/btrfs/reada.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

Patch
diff mbox

diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index 12a9c9c..5b5187e 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -371,6 +371,11 @@  static struct reada_extent *reada_find_extent(struct btrfs_root *root,
 		struct reada_zone *zone;
 
 		dev = bbio->stripes[nzones].dev;
+
+		/* cannot read ahead on missing device. */
+		 if (!dev->bdev)
+			continue;
+
 		zone = reada_find_zone(fs_info, dev, logical, bbio);
 		if (!zone)
 			continue;
@@ -423,15 +428,9 @@  static struct reada_extent *reada_find_extent(struct btrfs_root *root,
 			 */
 			continue;
 		}
-		if (!dev->bdev) {
-			/*
-			 * cannot read ahead on missing device, but for RAID5/6,
-			 * REQ_GET_READ_MIRRORS return 1. So don't skip missing
-			 * device for such case.
-			 */
-			if (nzones > 1)
-				continue;
-		}
+		if (!dev->bdev)
+			continue;
+
 		if (dev_replace_is_ongoing &&
 		    dev == fs_info->dev_replace.tgtdev) {
 			/*