diff options
author | Josef Bacik <josef@toxicpanda.com> | 2018-11-21 14:05:39 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-02-25 14:13:25 +0100 |
commit | 3069bd26690a01f1e8280dff9cb019fdf216a4f5 (patch) | |
tree | 8c9aab5952e078d047e953241b13dab31145679f /fs/btrfs/disk-io.c | |
parent | d1e144206501050a17dfd9b41753c635f20d9288 (diff) | |
download | lwn-3069bd26690a01f1e8280dff9cb019fdf216a4f5.tar.gz lwn-3069bd26690a01f1e8280dff9cb019fdf216a4f5.zip |
btrfs: make btrfs_destroy_delayed_refs use btrfs_delayed_ref_lock
We have this open coded in btrfs_destroy_delayed_refs, use the helper
instead.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 888d72dda794..b723ad9bd1e6 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -4246,16 +4246,9 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, head = rb_entry(node, struct btrfs_delayed_ref_head, href_node); - if (!mutex_trylock(&head->mutex)) { - refcount_inc(&head->refs); - spin_unlock(&delayed_refs->lock); - - mutex_lock(&head->mutex); - mutex_unlock(&head->mutex); - btrfs_put_delayed_ref_head(head); - spin_lock(&delayed_refs->lock); + if (btrfs_delayed_ref_lock(delayed_refs, head)) continue; - } + spin_lock(&head->lock); while ((n = rb_first_cached(&head->ref_tree)) != NULL) { ref = rb_entry(n, struct btrfs_delayed_ref_node, |