Message ID | 20180830174225.2200-26-josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | My current patch queue | expand |
On 30.08.2018 20:42, Josef Bacik wrote: > We have this open coded in btrfs_destroy_delayed_refs, use the helper > instead. > > Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> > --- > fs/btrfs/disk-io.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > index 11ea2ea7439e..c72ab2ca7627 100644 > --- a/fs/btrfs/disk-io.c > +++ b/fs/btrfs/disk-io.c > @@ -4214,16 +4214,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(&head->ref_tree)) != NULL) { > ref = rb_entry(n, struct btrfs_delayed_ref_node, >
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 11ea2ea7439e..c72ab2ca7627 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -4214,16 +4214,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(&head->ref_tree)) != NULL) { ref = rb_entry(n, struct btrfs_delayed_ref_node,
We have this open coded in btrfs_destroy_delayed_refs, use the helper instead. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/disk-io.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)