Commit 8e9aa51f authored by Zhao Lei's avatar Zhao Lei Committed by David Sterba

btrfs: reada: Add missed segment checking in reada_find_zone

In rechecking zone-in-tree, we still need to check zone include
our logical address.
Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c37f49c7
...@@ -303,8 +303,10 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info, ...@@ -303,8 +303,10 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info,
kfree(zone); kfree(zone);
ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone, ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone,
logical >> PAGE_CACHE_SHIFT, 1); logical >> PAGE_CACHE_SHIFT, 1);
if (ret == 1) if (ret == 1 && logical >= zone->start && logical <= zone->end)
kref_get(&zone->refcnt); kref_get(&zone->refcnt);
else
zone = NULL;
} }
spin_unlock(&fs_info->reada_lock); spin_unlock(&fs_info->reada_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment