• Home
  • Raw
  • Download

Lines Matching refs:head

119 	struct btrfs_delayed_ref_head *head;  in btrfs_lookup_extent_info()  local
203 head = btrfs_find_delayed_ref_head(delayed_refs, bytenr); in btrfs_lookup_extent_info()
204 if (head) { in btrfs_lookup_extent_info()
205 if (!mutex_trylock(&head->mutex)) { in btrfs_lookup_extent_info()
206 refcount_inc(&head->refs); in btrfs_lookup_extent_info()
215 mutex_lock(&head->mutex); in btrfs_lookup_extent_info()
216 mutex_unlock(&head->mutex); in btrfs_lookup_extent_info()
217 btrfs_put_delayed_ref_head(head); in btrfs_lookup_extent_info()
220 spin_lock(&head->lock); in btrfs_lookup_extent_info()
221 if (head->extent_op && head->extent_op->update_flags) in btrfs_lookup_extent_info()
222 extent_flags |= head->extent_op->flags_to_set; in btrfs_lookup_extent_info()
226 num_refs += head->ref_mod; in btrfs_lookup_extent_info()
227 spin_unlock(&head->lock); in btrfs_lookup_extent_info()
228 mutex_unlock(&head->mutex); in btrfs_lookup_extent_info()
1577 struct btrfs_delayed_ref_head *head, in run_delayed_extent_op() argument
1600 key.objectid = head->bytenr; in run_delayed_extent_op()
1607 key.offset = head->num_bytes; in run_delayed_extent_op()
1622 if (key.objectid == head->bytenr && in run_delayed_extent_op()
1624 key.offset == head->num_bytes) in run_delayed_extent_op()
1631 key.objectid = head->bytenr; in run_delayed_extent_op()
1632 key.offset = head->num_bytes; in run_delayed_extent_op()
1735 select_delayed_ref(struct btrfs_delayed_ref_head *head) in select_delayed_ref() argument
1739 if (RB_EMPTY_ROOT(&head->ref_tree.rb_root)) in select_delayed_ref()
1748 if (!list_empty(&head->ref_add_list)) in select_delayed_ref()
1749 return list_first_entry(&head->ref_add_list, in select_delayed_ref()
1752 ref = rb_entry(rb_first_cached(&head->ref_tree), in select_delayed_ref()
1759 struct btrfs_delayed_ref_head *head) in unselect_delayed_ref_head() argument
1762 head->processing = 0; in unselect_delayed_ref_head()
1765 btrfs_delayed_ref_unlock(head); in unselect_delayed_ref_head()
1769 struct btrfs_delayed_ref_head *head) in cleanup_extent_op() argument
1771 struct btrfs_delayed_extent_op *extent_op = head->extent_op; in cleanup_extent_op()
1776 if (head->must_insert_reserved) { in cleanup_extent_op()
1777 head->extent_op = NULL; in cleanup_extent_op()
1785 struct btrfs_delayed_ref_head *head) in run_and_cleanup_extent_op() argument
1790 extent_op = cleanup_extent_op(head); in run_and_cleanup_extent_op()
1793 head->extent_op = NULL; in run_and_cleanup_extent_op()
1794 spin_unlock(&head->lock); in run_and_cleanup_extent_op()
1795 ret = run_delayed_extent_op(trans, head, extent_op); in run_and_cleanup_extent_op()
1802 struct btrfs_delayed_ref_head *head) in btrfs_cleanup_ref_head_accounting() argument
1810 if (head->total_ref_mod < 0 && head->is_data) { in btrfs_cleanup_ref_head_accounting()
1812 delayed_refs->pending_csums -= head->num_bytes; in btrfs_cleanup_ref_head_accounting()
1814 nr_items += btrfs_csum_bytes_to_leaves(fs_info, head->num_bytes); in btrfs_cleanup_ref_head_accounting()
1821 struct btrfs_delayed_ref_head *head) in cleanup_ref_head() argument
1830 ret = run_and_cleanup_extent_op(trans, head); in cleanup_ref_head()
1832 unselect_delayed_ref_head(delayed_refs, head); in cleanup_ref_head()
1843 spin_unlock(&head->lock); in cleanup_ref_head()
1845 spin_lock(&head->lock); in cleanup_ref_head()
1846 if (!RB_EMPTY_ROOT(&head->ref_tree.rb_root) || head->extent_op) { in cleanup_ref_head()
1847 spin_unlock(&head->lock); in cleanup_ref_head()
1851 btrfs_delete_ref_head(delayed_refs, head); in cleanup_ref_head()
1852 spin_unlock(&head->lock); in cleanup_ref_head()
1855 if (head->must_insert_reserved) { in cleanup_ref_head()
1856 btrfs_pin_extent(trans, head->bytenr, head->num_bytes, 1); in cleanup_ref_head()
1857 if (head->is_data) { in cleanup_ref_head()
1859 head->bytenr, head->num_bytes); in cleanup_ref_head()
1863 btrfs_cleanup_ref_head_accounting(fs_info, delayed_refs, head); in cleanup_ref_head()
1865 trace_run_delayed_ref_head(fs_info, head, 0); in cleanup_ref_head()
1866 btrfs_delayed_ref_unlock(head); in cleanup_ref_head()
1867 btrfs_put_delayed_ref_head(head); in cleanup_ref_head()
1876 struct btrfs_delayed_ref_head *head = NULL; in btrfs_obtain_ref_head() local
1880 head = btrfs_select_ref_head(delayed_refs); in btrfs_obtain_ref_head()
1881 if (!head) { in btrfs_obtain_ref_head()
1883 return head; in btrfs_obtain_ref_head()
1890 ret = btrfs_delayed_ref_lock(delayed_refs, head); in btrfs_obtain_ref_head()
1899 head = ERR_PTR(-EAGAIN); in btrfs_obtain_ref_head()
1901 return head; in btrfs_obtain_ref_head()
2137 struct btrfs_delayed_ref_head *head; in btrfs_run_delayed_refs() local
2171 head = rb_entry(node, struct btrfs_delayed_ref_head, in btrfs_run_delayed_refs()
2173 refcount_inc(&head->refs); in btrfs_run_delayed_refs()
2177 mutex_lock(&head->mutex); in btrfs_run_delayed_refs()
2178 mutex_unlock(&head->mutex); in btrfs_run_delayed_refs()
2180 btrfs_put_delayed_ref_head(head); in btrfs_run_delayed_refs()
2215 struct btrfs_delayed_ref_head *head; in check_delayed_ref() local
2233 head = btrfs_find_delayed_ref_head(delayed_refs, bytenr); in check_delayed_ref()
2234 if (!head) { in check_delayed_ref()
2240 if (!mutex_trylock(&head->mutex)) { in check_delayed_ref()
2241 refcount_inc(&head->refs); in check_delayed_ref()
2250 mutex_lock(&head->mutex); in check_delayed_ref()
2251 mutex_unlock(&head->mutex); in check_delayed_ref()
2252 btrfs_put_delayed_ref_head(head); in check_delayed_ref()
2258 spin_lock(&head->lock); in check_delayed_ref()
2263 for (node = rb_first_cached(&head->ref_tree); node; in check_delayed_ref()
2285 spin_unlock(&head->lock); in check_delayed_ref()
2286 mutex_unlock(&head->mutex); in check_delayed_ref()
3232 struct btrfs_delayed_ref_head *head; in check_ref_cleanup() local
3238 head = btrfs_find_delayed_ref_head(delayed_refs, bytenr); in check_ref_cleanup()
3239 if (!head) in check_ref_cleanup()
3242 spin_lock(&head->lock); in check_ref_cleanup()
3243 if (!RB_EMPTY_ROOT(&head->ref_tree.rb_root)) in check_ref_cleanup()
3246 if (cleanup_extent_op(head) != NULL) in check_ref_cleanup()
3253 if (!mutex_trylock(&head->mutex)) in check_ref_cleanup()
3256 btrfs_delete_ref_head(delayed_refs, head); in check_ref_cleanup()
3257 head->processing = 0; in check_ref_cleanup()
3259 spin_unlock(&head->lock); in check_ref_cleanup()
3262 BUG_ON(head->extent_op); in check_ref_cleanup()
3263 if (head->must_insert_reserved) in check_ref_cleanup()
3266 btrfs_cleanup_ref_head_accounting(trans->fs_info, delayed_refs, head); in check_ref_cleanup()
3267 mutex_unlock(&head->mutex); in check_ref_cleanup()
3268 btrfs_put_delayed_ref_head(head); in check_ref_cleanup()
3271 spin_unlock(&head->lock); in check_ref_cleanup()