btrfs: do reverse path readahead in btrfs_shrink_device
authorGu Jinxiang <gujx@cn.fujitsu.com>
Fri, 27 Apr 2018 08:22:07 +0000 (16:22 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:07:28 +0000 (18:07 +0200)
In btrfs_shrink_device, before btrfs_search_slot, path->reada is set to
READA_FORWARD. But I think READA_BACK is correct.

Since:

 1. key.offset is set to (u64)-1
 2. after btrfs_search_slot, btrfs_previous_item is called

So, for readahead previous items, READA_BACK is the correct one.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index 7b3b235cf2144b4df053f621ca45862c53a5e8c0..78f6cd1de33aca95a555ca19961f3da39fb6f3d7 100644 (file)
@@ -4414,7 +4414,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
        if (!path)
                return -ENOMEM;
 
-       path->reada = READA_FORWARD;
+       path->reada = READA_BACK;
 
        mutex_lock(&fs_info->chunk_mutex);