diff mbox

[v3,1/2] btrfs: use enum instead of constant value

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

Commit Message

Gu Jinxiang Jan. 11, 2018, 8:12 a.m. UTC
populate_free_space_tree calls function btrfs_search_slot_for_read with
parameter int find_higher = 1, it means that, if no exact match is found,
then use the next higher item.
So in function populate_free_space_tree, use READA_FORWARD to read
forward ahead.

Changelog:
v2->v1: change enum from READA_BACK to READA_FORWARD, since according
to the logic of the source, it should reada_for_search forward, not
backward.
And, Reference:
commit e4058b54d1e4 ("btrfs: cleanup, use enum values for btrfs_path reada")

v3->v2: add commit message to make it easy to understand. And split it
to two patch.

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

Comments

Nikolay Borisov Jan. 11, 2018, 8:14 a.m. UTC | #1
On 11.01.2018 10:12, Gu Jinxiang wrote:
> populate_free_space_tree calls function btrfs_search_slot_for_read with
> parameter int find_higher = 1, it means that, if no exact match is found,
> then use the next higher item.
> So in function populate_free_space_tree, use READA_FORWARD to read
> forward ahead.
> 
> Changelog:
> v2->v1: change enum from READA_BACK to READA_FORWARD, since according
> to the logic of the source, it should reada_for_search forward, not
> backward.
> And, Reference:
> commit e4058b54d1e4 ("btrfs: cleanup, use enum values for btrfs_path reada")
> 
> v3->v2: add commit message to make it easy to understand. And split it
> to two patch.
> 
> Signed-off-by: Gu JinXiang <gujx@cn.fujitsu.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  fs/btrfs/free-space-tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
> index fe5e0324dca9..d7b6c0017143 100644
> --- a/fs/btrfs/free-space-tree.c
> +++ b/fs/btrfs/free-space-tree.c
> @@ -1071,7 +1071,7 @@ static int populate_free_space_tree(struct btrfs_trans_handle *trans,
>  	path = btrfs_alloc_path();
>  	if (!path)
>  		return -ENOMEM;
> -	path->reada = 1;
> +	path->reada = READA_FORWARD;
>  
>  	path2 = btrfs_alloc_path();
>  	if (!path2) {
> 
--
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 Feb. 6, 2018, 2:54 p.m. UTC | #2
On Thu, Jan 11, 2018 at 04:12:17PM +0800, Gu Jinxiang wrote:
> populate_free_space_tree calls function btrfs_search_slot_for_read with
> parameter int find_higher = 1, it means that, if no exact match is found,
> then use the next higher item.
> So in function populate_free_space_tree, use READA_FORWARD to read
> forward ahead.
> 
> Changelog:
> v2->v1: change enum from READA_BACK to READA_FORWARD, since according
> to the logic of the source, it should reada_for_search forward, not
> backward.
> And, Reference:
> commit e4058b54d1e4 ("btrfs: cleanup, use enum values for btrfs_path reada")
> 
> v3->v2: add commit message to make it easy to understand. And split it
> to two patch.
> 
> Signed-off-by: Gu JinXiang <gujx@cn.fujitsu.com>

For some reason I have the two mails tagged as applied but don't see
them in any branch. Anyway, now added, 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/free-space-tree.c b/fs/btrfs/free-space-tree.c
index fe5e0324dca9..d7b6c0017143 100644
--- a/fs/btrfs/free-space-tree.c
+++ b/fs/btrfs/free-space-tree.c
@@ -1071,7 +1071,7 @@  static int populate_free_space_tree(struct btrfs_trans_handle *trans,
 	path = btrfs_alloc_path();
 	if (!path)
 		return -ENOMEM;
-	path->reada = 1;
+	path->reada = READA_FORWARD;
 
 	path2 = btrfs_alloc_path();
 	if (!path2) {