diff mbox

[07/10] btrfs: remove type argument from comp_tree_refs

Message ID 1505164356-13474-8-git-send-email-jbacik@fb.com (mailing list archive)
State New, archived
Headers show

Commit Message

Josef Bacik Sept. 11, 2017, 9:12 p.m. UTC
From: Josef Bacik <jbacik@fb.com>

We can get this from the ref we've passed in.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 fs/btrfs/delayed-ref.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Timofey Titovets Sept. 12, 2017, 4:08 p.m. UTC | #1
2017-09-12 0:12 GMT+03:00  <josef@toxicpanda.com>:
> From: Josef Bacik <jbacik@fb.com>
>
> We can get this from the ref we've passed in.
>
> Signed-off-by: Josef Bacik <jbacik@fb.com>
> ---
>  fs/btrfs/delayed-ref.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
> index 7cb1172..7374710 100644
> --- a/fs/btrfs/delayed-ref.c
> +++ b/fs/btrfs/delayed-ref.c
> @@ -41,9 +41,9 @@ struct kmem_cache *btrfs_delayed_extent_op_cachep;
>   * compare two delayed tree backrefs with same bytenr and type
>   */
>  static int comp_tree_refs(struct btrfs_delayed_tree_ref *ref2,
> -                         struct btrfs_delayed_tree_ref *ref1, int type)
> +                         struct btrfs_delayed_tree_ref *ref1)
>  {
> -       if (type == BTRFS_TREE_BLOCK_REF_KEY) {
> +       if (ref1->node.type == BTRFS_TREE_BLOCK_REF_KEY) {
>                 if (ref1->root < ref2->root)
>                         return -1;
>                 if (ref1->root > ref2->root)
> @@ -223,8 +223,7 @@ static bool merge_ref(struct btrfs_trans_handle *trans,
>                 if ((ref->type == BTRFS_TREE_BLOCK_REF_KEY ||
>                      ref->type == BTRFS_SHARED_BLOCK_REF_KEY) &&
>                     comp_tree_refs(btrfs_delayed_node_to_tree_ref(ref),
> -                                  btrfs_delayed_node_to_tree_ref(next),
> -                                  ref->type))
> +                                  btrfs_delayed_node_to_tree_ref(next)))
>                         goto next;
>                 if ((ref->type == BTRFS_EXTENT_DATA_REF_KEY ||
>                      ref->type == BTRFS_SHARED_DATA_REF_KEY) &&
> @@ -409,8 +408,7 @@ add_delayed_ref_tail_merge(struct btrfs_trans_handle *trans,
>         if ((exist->type == BTRFS_TREE_BLOCK_REF_KEY ||
>              exist->type == BTRFS_SHARED_BLOCK_REF_KEY) &&
>             comp_tree_refs(btrfs_delayed_node_to_tree_ref(exist),
> -                          btrfs_delayed_node_to_tree_ref(ref),
> -                          ref->type))
> +                          btrfs_delayed_node_to_tree_ref(ref)))
>                 goto add_tail;
>         if ((exist->type == BTRFS_EXTENT_DATA_REF_KEY ||
>              exist->type == BTRFS_SHARED_DATA_REF_KEY) &&
> --
> 2.7.4
>
> --
> 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

Reviewed-by: Timofey Titovets <nefelim4ag@gmail.com>
diff mbox

Patch

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 7cb1172..7374710 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -41,9 +41,9 @@  struct kmem_cache *btrfs_delayed_extent_op_cachep;
  * compare two delayed tree backrefs with same bytenr and type
  */
 static int comp_tree_refs(struct btrfs_delayed_tree_ref *ref2,
-			  struct btrfs_delayed_tree_ref *ref1, int type)
+			  struct btrfs_delayed_tree_ref *ref1)
 {
-	if (type == BTRFS_TREE_BLOCK_REF_KEY) {
+	if (ref1->node.type == BTRFS_TREE_BLOCK_REF_KEY) {
 		if (ref1->root < ref2->root)
 			return -1;
 		if (ref1->root > ref2->root)
@@ -223,8 +223,7 @@  static bool merge_ref(struct btrfs_trans_handle *trans,
 		if ((ref->type == BTRFS_TREE_BLOCK_REF_KEY ||
 		     ref->type == BTRFS_SHARED_BLOCK_REF_KEY) &&
 		    comp_tree_refs(btrfs_delayed_node_to_tree_ref(ref),
-				   btrfs_delayed_node_to_tree_ref(next),
-				   ref->type))
+				   btrfs_delayed_node_to_tree_ref(next)))
 			goto next;
 		if ((ref->type == BTRFS_EXTENT_DATA_REF_KEY ||
 		     ref->type == BTRFS_SHARED_DATA_REF_KEY) &&
@@ -409,8 +408,7 @@  add_delayed_ref_tail_merge(struct btrfs_trans_handle *trans,
 	if ((exist->type == BTRFS_TREE_BLOCK_REF_KEY ||
 	     exist->type == BTRFS_SHARED_BLOCK_REF_KEY) &&
 	    comp_tree_refs(btrfs_delayed_node_to_tree_ref(exist),
-			   btrfs_delayed_node_to_tree_ref(ref),
-			   ref->type))
+			   btrfs_delayed_node_to_tree_ref(ref)))
 		goto add_tail;
 	if ((exist->type == BTRFS_EXTENT_DATA_REF_KEY ||
 	     exist->type == BTRFS_SHARED_DATA_REF_KEY) &&