diff mbox

btrfs: modify path->reada in btrfs_shrink_device to READA_BACK

Message ID 1524817327-32038-1-git-send-email-gujx@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gu Jinxiang April 27, 2018, 8:22 a.m. UTC
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 correct one.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
---
 fs/btrfs/volumes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nikolay Borisov April 27, 2018, 8:28 a.m. UTC | #1
On 27.04.2018 11:22, Gu Jinxiang wrote:
> 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 correct one.

My analysis arrives at the same conclusions so:

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> 
> Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
> ---
>  fs/btrfs/volumes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 292266f6ab9c..1a3506a3003d 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -4473,7 +4473,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);
>  
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba May 1, 2018, 1:44 p.m. UTC | #2
On Fri, Apr 27, 2018 at 04:22:07PM +0800, Gu Jinxiang wrote:
> 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 correct one.
> 
> Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>

Added to next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 292266f6ab9c..1a3506a3003d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4473,7 +4473,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);