summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaohiro Aota <naohiro.aota@wdc.com>2019-06-06 16:54:44 +0900
committerBen Hutchings <ben@decadent.org.uk>2019-10-05 16:20:00 +0100
commit2b1395f3251c5b91f7519674fecee523aa9af8f8 (patch)
treeb265d3be6f2e88f590d961c5a35bac3845266014
parent328891dc96feb6139438bd5b02fcad2dd4168844 (diff)
downloadlinux-2b1395f3251c5b91f7519674fecee523aa9af8f8.tar.gz
linux-2b1395f3251c5b91f7519674fecee523aa9af8f8.tar.bz2
linux-2b1395f3251c5b91f7519674fecee523aa9af8f8.zip
btrfs: start readahead also in seed devices
commit c4e0540d0ad49c8ceab06cceed1de27c4fe29f6e upstream. Currently, btrfs does not consult seed devices to start readahead. As a result, if readahead zone is added to the seed devices, btrfs_reada_wait() indefinitely wait for the reada_ctl to finish. You can reproduce the hung by modifying btrfs/163 to have larger initial file size (e.g. xfs_io pwrite 4M instead of current 256K). Fixes: 7414a03fbf9e ("btrfs: initial readahead code and prototypes") Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/reada.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index 74873e0cd1d1..c22ce1a337be 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -764,6 +764,7 @@ static void __reada_start_machine(struct btrfs_fs_info *fs_info)
u64 total = 0;
int i;
+again:
do {
enqueued = 0;
mutex_lock(&fs_devices->device_list_mutex);
@@ -776,6 +777,10 @@ static void __reada_start_machine(struct btrfs_fs_info *fs_info)
mutex_unlock(&fs_devices->device_list_mutex);
total += enqueued;
} while (enqueued && total < 10000);
+ if (fs_devices->seed) {
+ fs_devices = fs_devices->seed;
+ goto again;
+ }
if (enqueued == 0)
return;