]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Btrfs: pass delayed_refs directly to btrfs_find_delayed_ref_head
authorLiu Bo <bo.li.liu@oracle.com>
Mon, 30 Jan 2017 20:24:37 +0000 (12:24 -0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 14 Feb 2017 14:50:59 +0000 (15:50 +0100)
All we need is @delayed_refs, all callers have get it ahead of calling
btrfs_find_delayed_ref_head since lock needs to be acquired firstly,
there is no reason to deference it again inside the function.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/backref.c
fs/btrfs/delayed-ref.c
fs/btrfs/delayed-ref.h
fs/btrfs/extent-tree.c

index 8299601a35493b28f137cce3074dec455efbb3bf..db706595e63114b94111519e42a0672ffc83d079 100644 (file)
@@ -1284,7 +1284,7 @@ again:
                 */
                delayed_refs = &trans->transaction->delayed_refs;
                spin_lock(&delayed_refs->lock);
-               head = btrfs_find_delayed_ref_head(trans, bytenr);
+               head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
                if (head) {
                        if (!mutex_trylock(&head->mutex)) {
                                atomic_inc(&head->node.refs);
index c66f487b76a703d79d87ad8df94cb96698e9ee31..a1b9ef2dfc4a9e55ee13bdcf0c67af2e73d21472 100644 (file)
@@ -909,11 +909,8 @@ int btrfs_add_delayed_extent_op(struct btrfs_fs_info *fs_info,
  * the head node if any where found, or NULL if not.
  */
 struct btrfs_delayed_ref_head *
-btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr)
+btrfs_find_delayed_ref_head(struct btrfs_delayed_ref_root *delayed_refs, u64 bytenr)
 {
-       struct btrfs_delayed_ref_root *delayed_refs;
-
-       delayed_refs = &trans->transaction->delayed_refs;
        return find_ref_head(&delayed_refs->href_root, bytenr, 0);
 }
 
index 8a0220fb703cb0533559547adc08d524def1616b..0e537f98f1a1c63c529c118baed1cac26efa194e 100644 (file)
@@ -261,7 +261,8 @@ void btrfs_merge_delayed_refs(struct btrfs_trans_handle *trans,
                              struct btrfs_delayed_ref_head *head);
 
 struct btrfs_delayed_ref_head *
-btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr);
+btrfs_find_delayed_ref_head(struct btrfs_delayed_ref_root *delayed_refs,
+                           u64 bytenr);
 int btrfs_delayed_ref_lock(struct btrfs_trans_handle *trans,
                           struct btrfs_delayed_ref_head *head);
 static inline void btrfs_delayed_ref_unlock(struct btrfs_delayed_ref_head *head)
index 7dd71fcc1051e045b89ac86a8d2d126627349ff3..be235b30a7985cf0323fee235dc0037ba3a5ec84 100644 (file)
@@ -888,7 +888,7 @@ search_again:
 
        delayed_refs = &trans->transaction->delayed_refs;
        spin_lock(&delayed_refs->lock);
-       head = btrfs_find_delayed_ref_head(trans, bytenr);
+       head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
        if (head) {
                if (!mutex_trylock(&head->mutex)) {
                        atomic_inc(&head->node.refs);
@@ -3041,7 +3041,7 @@ static noinline int check_delayed_ref(struct btrfs_trans_handle *trans,
 
        delayed_refs = &trans->transaction->delayed_refs;
        spin_lock(&delayed_refs->lock);
-       head = btrfs_find_delayed_ref_head(trans, bytenr);
+       head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
        if (!head) {
                spin_unlock(&delayed_refs->lock);
                return 0;
@@ -7091,7 +7091,7 @@ static noinline int check_ref_cleanup(struct btrfs_trans_handle *trans,
 
        delayed_refs = &trans->transaction->delayed_refs;
        spin_lock(&delayed_refs->lock);
-       head = btrfs_find_delayed_ref_head(trans, bytenr);
+       head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
        if (!head)
                goto out_delayed_unlock;