diff mbox series

[1/2] btrfs: do not use READA for running delayed refs

Message ID 20200313210954.148686-2-josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series Drop some mis-uses of READA | expand

Commit Message

Josef Bacik March 13, 2020, 9:09 p.m. UTC
READA will generate a lot of extra reads for adjacent nodes, but when
running delayed refs we have no idea if the next ref is going to be
adjacent or not, so this potentially just generates a lot of extra IO.
To make matters worse each ref is truly just looking for one item, it
doesn't generally search forward, so we simply don't need it here.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/extent-tree.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Qu Wenruo March 14, 2020, 12:18 a.m. UTC | #1
On 2020/3/14 上午5:09, Josef Bacik wrote:
> READA will generate a lot of extra reads for adjacent nodes, but when
> running delayed refs we have no idea if the next ref is going to be
> adjacent or not, so this potentially just generates a lot of extra IO.
> To make matters worse each ref is truly just looking for one item, it
> doesn't generally search forward, so we simply don't need it here.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>  fs/btrfs/extent-tree.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index a24ef1cef9fa..8e5b49baad98 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -1469,7 +1469,6 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
>  	if (!path)
>  		return -ENOMEM;
>  
> -	path->reada = READA_FORWARD;
>  	path->leave_spinning = 1;
>  	/* this will setup the path even if it fails to insert the back ref */
>  	ret = insert_inline_extent_backref(trans, path, bytenr, num_bytes,
> @@ -1494,7 +1493,6 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
>  	btrfs_mark_buffer_dirty(leaf);
>  	btrfs_release_path(path);
>  
> -	path->reada = READA_FORWARD;
>  	path->leave_spinning = 1;
>  	/* now insert the actual backref */
>  	ret = insert_extent_backref(trans, path, bytenr, parent, root_objectid,
> @@ -1604,7 +1602,6 @@ static int run_delayed_extent_op(struct btrfs_trans_handle *trans,
>  	}
>  
>  again:
> -	path->reada = READA_FORWARD;
>  	path->leave_spinning = 1;
>  	ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 1);
>  	if (ret < 0) {
> @@ -2999,7 +2996,6 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
>  	if (!path)
>  		return -ENOMEM;
>  
> -	path->reada = READA_FORWARD;
>  	path->leave_spinning = 1;
>  
>  	is_data = owner_objectid >= BTRFS_FIRST_FREE_OBJECTID;
>
diff mbox series

Patch

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index a24ef1cef9fa..8e5b49baad98 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1469,7 +1469,6 @@  static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
 	if (!path)
 		return -ENOMEM;
 
-	path->reada = READA_FORWARD;
 	path->leave_spinning = 1;
 	/* this will setup the path even if it fails to insert the back ref */
 	ret = insert_inline_extent_backref(trans, path, bytenr, num_bytes,
@@ -1494,7 +1493,6 @@  static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
 	btrfs_mark_buffer_dirty(leaf);
 	btrfs_release_path(path);
 
-	path->reada = READA_FORWARD;
 	path->leave_spinning = 1;
 	/* now insert the actual backref */
 	ret = insert_extent_backref(trans, path, bytenr, parent, root_objectid,
@@ -1604,7 +1602,6 @@  static int run_delayed_extent_op(struct btrfs_trans_handle *trans,
 	}
 
 again:
-	path->reada = READA_FORWARD;
 	path->leave_spinning = 1;
 	ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 1);
 	if (ret < 0) {
@@ -2999,7 +2996,6 @@  static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
 	if (!path)
 		return -ENOMEM;
 
-	path->reada = READA_FORWARD;
 	path->leave_spinning = 1;
 
 	is_data = owner_objectid >= BTRFS_FIRST_FREE_OBJECTID;