Lines Matching refs:head
412 struct btrfs_delayed_ref_head *head) in btrfs_delayed_ref_lock() argument
415 if (mutex_trylock(&head->mutex)) in btrfs_delayed_ref_lock()
418 refcount_inc(&head->refs); in btrfs_delayed_ref_lock()
421 mutex_lock(&head->mutex); in btrfs_delayed_ref_lock()
423 if (RB_EMPTY_NODE(&head->href_node)) { in btrfs_delayed_ref_lock()
424 mutex_unlock(&head->mutex); in btrfs_delayed_ref_lock()
425 btrfs_put_delayed_ref_head(head); in btrfs_delayed_ref_lock()
428 btrfs_put_delayed_ref_head(head); in btrfs_delayed_ref_lock()
434 struct btrfs_delayed_ref_head *head, in drop_delayed_ref() argument
437 lockdep_assert_held(&head->lock); in drop_delayed_ref()
438 rb_erase_cached(&ref->ref_node, &head->ref_tree); in drop_delayed_ref()
449 struct btrfs_delayed_ref_head *head, in merge_ref() argument
477 drop_delayed_ref(trans, delayed_refs, head, next); in merge_ref()
480 drop_delayed_ref(trans, delayed_refs, head, ref); in merge_ref()
496 struct btrfs_delayed_ref_head *head) in btrfs_merge_delayed_refs() argument
503 lockdep_assert_held(&head->lock); in btrfs_merge_delayed_refs()
505 if (RB_EMPTY_ROOT(&head->ref_tree.rb_root)) in btrfs_merge_delayed_refs()
509 if (head->is_data) in btrfs_merge_delayed_refs()
514 for (node = rb_first_cached(&head->ref_tree); node; in btrfs_merge_delayed_refs()
519 if (merge_ref(trans, delayed_refs, head, ref, seq)) in btrfs_merge_delayed_refs()
542 struct btrfs_delayed_ref_head *head; in btrfs_select_ref_head() local
545 head = find_ref_head(delayed_refs, delayed_refs->run_delayed_start, in btrfs_select_ref_head()
547 if (!head && delayed_refs->run_delayed_start != 0) { in btrfs_select_ref_head()
549 head = find_first_ref_head(delayed_refs); in btrfs_select_ref_head()
551 if (!head) in btrfs_select_ref_head()
554 while (head->processing) { in btrfs_select_ref_head()
557 node = rb_next(&head->href_node); in btrfs_select_ref_head()
564 head = rb_entry(node, struct btrfs_delayed_ref_head, in btrfs_select_ref_head()
568 head->processing = 1; in btrfs_select_ref_head()
571 delayed_refs->run_delayed_start = head->bytenr + in btrfs_select_ref_head()
572 head->num_bytes; in btrfs_select_ref_head()
573 return head; in btrfs_select_ref_head()
577 struct btrfs_delayed_ref_head *head) in btrfs_delete_ref_head() argument
580 lockdep_assert_held(&head->lock); in btrfs_delete_ref_head()
582 rb_erase_cached(&head->href_node, &delayed_refs->href_root); in btrfs_delete_ref_head()
583 RB_CLEAR_NODE(&head->href_node); in btrfs_delete_ref_head()
586 if (head->processing == 0) in btrfs_delete_ref_head()