Lines Matching refs:path
85 struct btrfs_path *path,
97 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
102 return btrfs_find_name_in_ext_backref(path->nodes[0], path->slots[0],
113 struct btrfs_path *path;
127 path = btrfs_alloc_path();
128 if (!path)
131 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
142 extref = btrfs_find_name_in_ext_backref(path->nodes[0], path->slots[0],
150 leaf = path->nodes[0];
151 item_size = btrfs_item_size(leaf, path->slots[0]);
160 ret = btrfs_del_item(trans, root, path);
165 item_start = btrfs_item_ptr_offset(leaf, path->slots[0]);
170 btrfs_truncate_item(trans, path, item_size - del_len, 1);
173 btrfs_free_path(path);
182 struct btrfs_path *path;
198 path = btrfs_alloc_path();
199 if (!path)
202 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
211 ref = btrfs_find_name_in_backref(path->nodes[0], path->slots[0], name);
217 leaf = path->nodes[0];
218 item_size = btrfs_item_size(leaf, path->slots[0]);
224 ret = btrfs_del_item(trans, root, path);
229 item_start = btrfs_item_ptr_offset(leaf, path->slots[0]);
232 btrfs_truncate_item(trans, path, item_size - sub_item_len, 1);
234 btrfs_free_path(path);
264 struct btrfs_path *path;
272 path = btrfs_alloc_path();
273 if (!path)
276 ret = btrfs_insert_empty_item(trans, root, path, &key,
279 if (btrfs_find_name_in_ext_backref(path->nodes[0],
280 path->slots[0],
285 btrfs_extend_item(trans, path, ins_len);
291 leaf = path->nodes[0];
292 ptr = (unsigned long)btrfs_item_ptr(leaf, path->slots[0], char);
293 ptr += btrfs_item_size(leaf, path->slots[0]) - ins_len;
296 btrfs_set_inode_extref_name_len(path->nodes[0], extref, name->len);
297 btrfs_set_inode_extref_index(path->nodes[0], extref, index);
298 btrfs_set_inode_extref_parent(path->nodes[0], extref, ref_objectid);
301 write_extent_buffer(path->nodes[0], name->name, ptr, name->len);
302 btrfs_mark_buffer_dirty(trans, path->nodes[0]);
305 btrfs_free_path(path);
309 /* Will return 0, -ENOMEM, -EMLINK, or -EEXIST or anything from the CoW path */
315 struct btrfs_path *path;
326 path = btrfs_alloc_path();
327 if (!path)
330 path->skip_release_on_error = 1;
331 ret = btrfs_insert_empty_item(trans, root, path, &key,
335 ref = btrfs_find_name_in_backref(path->nodes[0], path->slots[0],
340 old_size = btrfs_item_size(path->nodes[0], path->slots[0]);
341 btrfs_extend_item(trans, path, ins_len);
342 ref = btrfs_item_ptr(path->nodes[0], path->slots[0],
345 btrfs_set_inode_ref_name_len(path->nodes[0], ref, name->len);
346 btrfs_set_inode_ref_index(path->nodes[0], ref, index);
351 if (btrfs_find_name_in_backref(path->nodes[0],
352 path->slots[0],
360 ref = btrfs_item_ptr(path->nodes[0], path->slots[0],
362 btrfs_set_inode_ref_name_len(path->nodes[0], ref, name->len);
363 btrfs_set_inode_ref_index(path->nodes[0], ref, index);
366 write_extent_buffer(path->nodes[0], name->name, ptr, name->len);
367 btrfs_mark_buffer_dirty(trans, path->nodes[0]);
370 btrfs_free_path(path);
388 struct btrfs_path *path, u64 objectid)
396 ret = btrfs_insert_empty_item(trans, root, path, &key,
402 *root, struct btrfs_path *path,
412 ret = btrfs_search_slot(trans, root, location, path, ins_len, cow);
414 location->offset == (u64)-1 && path->slots[0] != 0) {
415 slot = path->slots[0] - 1;
416 leaf = path->nodes[0];
420 path->slots[0]--;
464 struct btrfs_path *path;
495 path = btrfs_alloc_path();
496 if (!path)
498 path->reada = READA_BACK;
516 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
523 if (path->slots[0] == 0)
525 path->slots[0]--;
533 leaf = path->nodes[0];
534 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
545 fi = btrfs_item_ptr(leaf, path->slots[0],
556 path->slots[0]);
620 btrfs_truncate_item(trans, path, size, 1);
643 * normal truncate path.
656 ((path->slots[0] + 1) == pending_del_slot));
661 pending_del_slot = path->slots[0];
663 } else if (path->slots[0] + 1 == pending_del_slot) {
666 pending_del_slot = path->slots[0];
695 if (path->slots[0] == 0 ||
696 path->slots[0] != pending_del_slot ||
699 ret = btrfs_del_items(trans, root, path,
708 btrfs_release_path(path);
730 path->slots[0]--;
737 err = btrfs_del_items(trans, root, path, pending_del_slot,
749 btrfs_free_path(path);