Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
btrfs: reada: bypass adding extent when all zone failed
Browse files Browse the repository at this point in the history
When failed adding all dev_zones for a reada_extent, the extent
will have no chance to be selected to run, and keep in memory
for ever.

We should bypass this extent to avoid above case.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
zhaoleidd authored and kdave committed Feb 18, 2016
1 parent 6a159d2 commit 3194502
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/btrfs/reada.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
int nzones = 0;
unsigned long index = logical >> PAGE_CACHE_SHIFT;
int dev_replace_is_ongoing;
int have_zone = 0;

spin_lock(&fs_info->reada_lock);
re = radix_tree_lookup(&fs_info->reada_tree, index);
Expand Down Expand Up @@ -456,10 +457,14 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
btrfs_dev_replace_unlock(&fs_info->dev_replace);
goto error;
}
have_zone = 1;
}
spin_unlock(&fs_info->reada_lock);
btrfs_dev_replace_unlock(&fs_info->dev_replace);

if (!have_zone)
goto error;

btrfs_put_bbio(bbio);
return re;

Expand Down

0 comments on commit 3194502

Please sign in to comment.