• Home
  • Raw
  • Download

Lines Matching refs:node

92 	struct btrfs_delayed_node *node;  in btrfs_get_delayed_node()  local
94 node = ACCESS_ONCE(btrfs_inode->delayed_node); in btrfs_get_delayed_node()
95 if (node) { in btrfs_get_delayed_node()
96 atomic_inc(&node->refs); in btrfs_get_delayed_node()
97 return node; in btrfs_get_delayed_node()
101 node = radix_tree_lookup(&root->delayed_nodes_tree, ino); in btrfs_get_delayed_node()
102 if (node) { in btrfs_get_delayed_node()
104 atomic_inc(&node->refs); /* can be accessed */ in btrfs_get_delayed_node()
105 BUG_ON(btrfs_inode->delayed_node != node); in btrfs_get_delayed_node()
107 return node; in btrfs_get_delayed_node()
109 btrfs_inode->delayed_node = node; in btrfs_get_delayed_node()
110 atomic_inc(&node->refs); /* can be accessed */ in btrfs_get_delayed_node()
111 atomic_inc(&node->refs); /* cached in the inode */ in btrfs_get_delayed_node()
113 return node; in btrfs_get_delayed_node()
124 struct btrfs_delayed_node *node; in btrfs_get_or_create_delayed_node() local
131 node = btrfs_get_delayed_node(inode); in btrfs_get_or_create_delayed_node()
132 if (node) in btrfs_get_or_create_delayed_node()
133 return node; in btrfs_get_or_create_delayed_node()
135 node = kmem_cache_alloc(delayed_node_cache, GFP_NOFS); in btrfs_get_or_create_delayed_node()
136 if (!node) in btrfs_get_or_create_delayed_node()
138 btrfs_init_delayed_node(node, root, ino); in btrfs_get_or_create_delayed_node()
140 atomic_inc(&node->refs); /* cached in the btrfs inode */ in btrfs_get_or_create_delayed_node()
141 atomic_inc(&node->refs); /* can be accessed */ in btrfs_get_or_create_delayed_node()
145 kmem_cache_free(delayed_node_cache, node); in btrfs_get_or_create_delayed_node()
150 ret = radix_tree_insert(&root->delayed_nodes_tree, ino, node); in btrfs_get_or_create_delayed_node()
152 kmem_cache_free(delayed_node_cache, node); in btrfs_get_or_create_delayed_node()
157 btrfs_inode->delayed_node = node; in btrfs_get_or_create_delayed_node()
161 return node; in btrfs_get_or_create_delayed_node()
170 struct btrfs_delayed_node *node, in btrfs_queue_delayed_node() argument
174 if (node->in_list) { in btrfs_queue_delayed_node()
175 if (!list_empty(&node->p_list)) in btrfs_queue_delayed_node()
176 list_move_tail(&node->p_list, &root->prepare_list); in btrfs_queue_delayed_node()
178 list_add_tail(&node->p_list, &root->prepare_list); in btrfs_queue_delayed_node()
180 list_add_tail(&node->n_list, &root->node_list); in btrfs_queue_delayed_node()
181 list_add_tail(&node->p_list, &root->prepare_list); in btrfs_queue_delayed_node()
182 atomic_inc(&node->refs); /* inserted into list */ in btrfs_queue_delayed_node()
184 node->in_list = 1; in btrfs_queue_delayed_node()
191 struct btrfs_delayed_node *node) in btrfs_dequeue_delayed_node() argument
194 if (node->in_list) { in btrfs_dequeue_delayed_node()
196 atomic_dec(&node->refs); /* not in the list */ in btrfs_dequeue_delayed_node()
197 list_del_init(&node->n_list); in btrfs_dequeue_delayed_node()
198 if (!list_empty(&node->p_list)) in btrfs_dequeue_delayed_node()
199 list_del_init(&node->p_list); in btrfs_dequeue_delayed_node()
200 node->in_list = 0; in btrfs_dequeue_delayed_node()
209 struct btrfs_delayed_node *node = NULL; in btrfs_first_delayed_node() local
216 node = list_entry(p, struct btrfs_delayed_node, n_list); in btrfs_first_delayed_node()
217 atomic_inc(&node->refs); in btrfs_first_delayed_node()
221 return node; in btrfs_first_delayed_node()
225 struct btrfs_delayed_node *node) in btrfs_next_delayed_node() argument
231 delayed_root = node->root->fs_info->delayed_root; in btrfs_next_delayed_node()
233 if (!node->in_list) { /* not in the list */ in btrfs_next_delayed_node()
237 } else if (list_is_last(&node->n_list, &delayed_root->node_list)) in btrfs_next_delayed_node()
240 p = node->n_list.next; in btrfs_next_delayed_node()
280 static inline void btrfs_release_delayed_node(struct btrfs_delayed_node *node) in btrfs_release_delayed_node() argument
282 __btrfs_release_delayed_node(node, 0); in btrfs_release_delayed_node()
289 struct btrfs_delayed_node *node = NULL; in btrfs_first_prepared_delayed_node() local
297 node = list_entry(p, struct btrfs_delayed_node, p_list); in btrfs_first_prepared_delayed_node()
298 atomic_inc(&node->refs); in btrfs_first_prepared_delayed_node()
302 return node; in btrfs_first_prepared_delayed_node()
306 struct btrfs_delayed_node *node) in btrfs_release_prepared_delayed_node() argument
308 __btrfs_release_delayed_node(node, 1); in btrfs_release_prepared_delayed_node()
341 struct rb_node *node, *prev_node = NULL; in __btrfs_lookup_delayed_item() local
345 node = root->rb_node; in __btrfs_lookup_delayed_item()
347 while (node) { in __btrfs_lookup_delayed_item()
348 delayed_item = rb_entry(node, struct btrfs_delayed_item, in __btrfs_lookup_delayed_item()
350 prev_node = node; in __btrfs_lookup_delayed_item()
353 node = node->rb_right; in __btrfs_lookup_delayed_item()
355 node = node->rb_left; in __btrfs_lookup_delayed_item()
365 else if ((node = rb_prev(prev_node)) != NULL) { in __btrfs_lookup_delayed_item()
366 *prev = rb_entry(node, struct btrfs_delayed_item, in __btrfs_lookup_delayed_item()
377 else if ((node = rb_next(prev_node)) != NULL) { in __btrfs_lookup_delayed_item()
378 *next = rb_entry(node, struct btrfs_delayed_item, in __btrfs_lookup_delayed_item()
401 struct rb_node **p, *node; in __btrfs_add_delayed_item() local
414 node = &ins->rb_node; in __btrfs_add_delayed_item()
430 rb_link_node(node, parent_node, p); in __btrfs_add_delayed_item()
431 rb_insert_color(node, root); in __btrfs_add_delayed_item()
445 static int __btrfs_add_delayed_insertion_item(struct btrfs_delayed_node *node, in __btrfs_add_delayed_insertion_item() argument
448 return __btrfs_add_delayed_item(node, item, in __btrfs_add_delayed_insertion_item()
452 static int __btrfs_add_delayed_deletion_item(struct btrfs_delayed_node *node, in __btrfs_add_delayed_deletion_item() argument
455 return __btrfs_add_delayed_item(node, item, in __btrfs_add_delayed_deletion_item()
599 struct btrfs_delayed_node *node) in btrfs_delayed_inode_reserve_metadata() argument
634 node->bytes_reserved = num_bytes; in btrfs_delayed_inode_reserve_metadata()
698 node->bytes_reserved = num_bytes; in btrfs_delayed_inode_reserve_metadata()
711 struct btrfs_delayed_node *node) in btrfs_delayed_inode_release_metadata() argument
715 if (!node->bytes_reserved) in btrfs_delayed_inode_release_metadata()
720 node->inode_id, node->bytes_reserved, 0); in btrfs_delayed_inode_release_metadata()
722 node->bytes_reserved); in btrfs_delayed_inode_release_metadata()
723 node->bytes_reserved = 0; in btrfs_delayed_inode_release_metadata()
873 struct btrfs_delayed_node *node) in btrfs_insert_delayed_items() argument
879 mutex_lock(&node->mutex); in btrfs_insert_delayed_items()
880 curr = __btrfs_first_delayed_insertion_item(node); in btrfs_insert_delayed_items()
901 mutex_unlock(&node->mutex); in btrfs_insert_delayed_items()
905 mutex_unlock(&node->mutex); in btrfs_insert_delayed_items()
975 struct btrfs_delayed_node *node) in btrfs_delete_delayed_items() argument
981 mutex_lock(&node->mutex); in btrfs_delete_delayed_items()
982 curr = __btrfs_first_delayed_deletion_item(node); in btrfs_delete_delayed_items()
1000 mutex_unlock(&node->mutex); in btrfs_delete_delayed_items()
1008 mutex_unlock(&node->mutex); in btrfs_delete_delayed_items()
1013 mutex_unlock(&node->mutex); in btrfs_delete_delayed_items()
1034 struct btrfs_delayed_node *node) in __btrfs_update_delayed_inode() argument
1041 key.objectid = node->inode_id; in __btrfs_update_delayed_inode()
1057 write_extent_buffer(leaf, &node->inode_item, (unsigned long)inode_item, in __btrfs_update_delayed_inode()
1062 btrfs_delayed_inode_release_metadata(root, node); in __btrfs_update_delayed_inode()
1063 btrfs_release_delayed_inode(node); in __btrfs_update_delayed_inode()
1071 struct btrfs_delayed_node *node) in btrfs_update_delayed_inode() argument
1075 mutex_lock(&node->mutex); in btrfs_update_delayed_inode()
1076 if (!node->inode_dirty) { in btrfs_update_delayed_inode()
1077 mutex_unlock(&node->mutex); in btrfs_update_delayed_inode()
1081 ret = __btrfs_update_delayed_inode(trans, root, path, node); in btrfs_update_delayed_inode()
1082 mutex_unlock(&node->mutex); in btrfs_update_delayed_inode()
1089 struct btrfs_delayed_node *node) in __btrfs_commit_inode_delayed_items() argument
1093 ret = btrfs_insert_delayed_items(trans, path, node->root, node); in __btrfs_commit_inode_delayed_items()
1097 ret = btrfs_delete_delayed_items(trans, path, node->root, node); in __btrfs_commit_inode_delayed_items()
1101 ret = btrfs_update_delayed_inode(trans, node->root, path, node); in __btrfs_commit_inode_delayed_items()
1504 struct btrfs_delayed_node *node, in btrfs_delete_delayed_insertion_item() argument
1509 mutex_lock(&node->mutex); in btrfs_delete_delayed_insertion_item()
1510 item = __btrfs_lookup_delayed_insertion_item(node, key); in btrfs_delete_delayed_insertion_item()
1512 mutex_unlock(&node->mutex); in btrfs_delete_delayed_insertion_item()
1518 mutex_unlock(&node->mutex); in btrfs_delete_delayed_insertion_item()
1526 struct btrfs_delayed_node *node; in btrfs_delete_delayed_dir_index() local
1531 node = btrfs_get_or_create_delayed_node(dir); in btrfs_delete_delayed_dir_index()
1532 if (IS_ERR(node)) in btrfs_delete_delayed_dir_index()
1533 return PTR_ERR(node); in btrfs_delete_delayed_dir_index()
1539 ret = btrfs_delete_delayed_insertion_item(root, node, &item_key); in btrfs_delete_delayed_dir_index()
1558 mutex_lock(&node->mutex); in btrfs_delete_delayed_dir_index()
1559 ret = __btrfs_add_delayed_deletion_item(node, item); in btrfs_delete_delayed_dir_index()
1565 (unsigned long long)node->root->objectid, in btrfs_delete_delayed_dir_index()
1566 (unsigned long long)node->inode_id, in btrfs_delete_delayed_dir_index()
1570 mutex_unlock(&node->mutex); in btrfs_delete_delayed_dir_index()
1572 btrfs_release_delayed_node(node); in btrfs_delete_delayed_dir_index()