Lines Matching full:path
84 struct btrfs_path *path, in btrfs_lookup_inode_extref() argument
96 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow); in btrfs_lookup_inode_extref()
101 return btrfs_find_name_in_ext_backref(path->nodes[0], path->slots[0], in btrfs_lookup_inode_extref()
112 struct btrfs_path *path; in btrfs_del_inode_extref() local
126 path = btrfs_alloc_path(); in btrfs_del_inode_extref()
127 if (!path) in btrfs_del_inode_extref()
130 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_inode_extref()
141 extref = btrfs_find_name_in_ext_backref(path->nodes[0], path->slots[0], in btrfs_del_inode_extref()
149 leaf = path->nodes[0]; in btrfs_del_inode_extref()
150 item_size = btrfs_item_size(leaf, path->slots[0]); in btrfs_del_inode_extref()
159 ret = btrfs_del_item(trans, root, path); in btrfs_del_inode_extref()
164 item_start = btrfs_item_ptr_offset(leaf, path->slots[0]); in btrfs_del_inode_extref()
169 btrfs_truncate_item(trans, path, item_size - del_len, 1); in btrfs_del_inode_extref()
172 btrfs_free_path(path); in btrfs_del_inode_extref()
181 struct btrfs_path *path; in btrfs_del_inode_ref() local
197 path = btrfs_alloc_path(); in btrfs_del_inode_ref()
198 if (!path) in btrfs_del_inode_ref()
201 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_inode_ref()
210 ref = btrfs_find_name_in_backref(path->nodes[0], path->slots[0], name); in btrfs_del_inode_ref()
216 leaf = path->nodes[0]; in btrfs_del_inode_ref()
217 item_size = btrfs_item_size(leaf, path->slots[0]); in btrfs_del_inode_ref()
223 ret = btrfs_del_item(trans, root, path); in btrfs_del_inode_ref()
228 item_start = btrfs_item_ptr_offset(leaf, path->slots[0]); in btrfs_del_inode_ref()
231 btrfs_truncate_item(trans, path, item_size - sub_item_len, 1); in btrfs_del_inode_ref()
233 btrfs_free_path(path); in btrfs_del_inode_ref()
263 struct btrfs_path *path; in btrfs_insert_inode_extref() local
271 path = btrfs_alloc_path(); in btrfs_insert_inode_extref()
272 if (!path) in btrfs_insert_inode_extref()
275 ret = btrfs_insert_empty_item(trans, root, path, &key, in btrfs_insert_inode_extref()
278 if (btrfs_find_name_in_ext_backref(path->nodes[0], in btrfs_insert_inode_extref()
279 path->slots[0], in btrfs_insert_inode_extref()
284 btrfs_extend_item(trans, path, ins_len); in btrfs_insert_inode_extref()
290 leaf = path->nodes[0]; in btrfs_insert_inode_extref()
291 ptr = (unsigned long)btrfs_item_ptr(leaf, path->slots[0], char); in btrfs_insert_inode_extref()
292 ptr += btrfs_item_size(leaf, path->slots[0]) - ins_len; in btrfs_insert_inode_extref()
295 btrfs_set_inode_extref_name_len(path->nodes[0], extref, name->len); in btrfs_insert_inode_extref()
296 btrfs_set_inode_extref_index(path->nodes[0], extref, index); in btrfs_insert_inode_extref()
297 btrfs_set_inode_extref_parent(path->nodes[0], extref, ref_objectid); in btrfs_insert_inode_extref()
300 write_extent_buffer(path->nodes[0], name->name, ptr, name->len); in btrfs_insert_inode_extref()
301 btrfs_mark_buffer_dirty(trans, path->nodes[0]); in btrfs_insert_inode_extref()
304 btrfs_free_path(path); in btrfs_insert_inode_extref()
308 /* Will return 0, -ENOMEM, -EMLINK, or -EEXIST or anything from the CoW path */
314 struct btrfs_path *path; in btrfs_insert_inode_ref() local
325 path = btrfs_alloc_path(); in btrfs_insert_inode_ref()
326 if (!path) in btrfs_insert_inode_ref()
329 path->skip_release_on_error = 1; in btrfs_insert_inode_ref()
330 ret = btrfs_insert_empty_item(trans, root, path, &key, in btrfs_insert_inode_ref()
334 ref = btrfs_find_name_in_backref(path->nodes[0], path->slots[0], in btrfs_insert_inode_ref()
339 old_size = btrfs_item_size(path->nodes[0], path->slots[0]); in btrfs_insert_inode_ref()
340 btrfs_extend_item(trans, path, ins_len); in btrfs_insert_inode_ref()
341 ref = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_insert_inode_ref()
344 btrfs_set_inode_ref_name_len(path->nodes[0], ref, name->len); in btrfs_insert_inode_ref()
345 btrfs_set_inode_ref_index(path->nodes[0], ref, index); in btrfs_insert_inode_ref()
350 if (btrfs_find_name_in_backref(path->nodes[0], in btrfs_insert_inode_ref()
351 path->slots[0], in btrfs_insert_inode_ref()
359 ref = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_insert_inode_ref()
361 btrfs_set_inode_ref_name_len(path->nodes[0], ref, name->len); in btrfs_insert_inode_ref()
362 btrfs_set_inode_ref_index(path->nodes[0], ref, index); in btrfs_insert_inode_ref()
365 write_extent_buffer(path->nodes[0], name->name, ptr, name->len); in btrfs_insert_inode_ref()
366 btrfs_mark_buffer_dirty(trans, path->nodes[0]); in btrfs_insert_inode_ref()
369 btrfs_free_path(path); in btrfs_insert_inode_ref()
387 struct btrfs_path *path, u64 objectid) in btrfs_insert_empty_inode() argument
395 ret = btrfs_insert_empty_item(trans, root, path, &key, in btrfs_insert_empty_inode()
401 *root, struct btrfs_path *path, in btrfs_lookup_inode() argument
411 ret = btrfs_search_slot(trans, root, location, path, ins_len, cow); in btrfs_lookup_inode()
413 location->offset == (u64)-1 && path->slots[0] != 0) { in btrfs_lookup_inode()
414 slot = path->slots[0] - 1; in btrfs_lookup_inode()
415 leaf = path->nodes[0]; in btrfs_lookup_inode()
419 path->slots[0]--; in btrfs_lookup_inode()
463 struct btrfs_path *path; in btrfs_truncate_inode_items() local
494 path = btrfs_alloc_path(); in btrfs_truncate_inode_items()
495 if (!path) in btrfs_truncate_inode_items()
497 path->reada = READA_BACK; in btrfs_truncate_inode_items()
515 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_truncate_inode_items()
522 if (path->slots[0] == 0) in btrfs_truncate_inode_items()
524 path->slots[0]--; in btrfs_truncate_inode_items()
532 leaf = path->nodes[0]; in btrfs_truncate_inode_items()
533 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_truncate_inode_items()
544 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_truncate_inode_items()
555 path->slots[0]); in btrfs_truncate_inode_items()
619 btrfs_truncate_item(trans, path, size, 1); in btrfs_truncate_inode_items()
642 * normal truncate path. in btrfs_truncate_inode_items()
655 ((path->slots[0] + 1) == pending_del_slot)); in btrfs_truncate_inode_items()
660 pending_del_slot = path->slots[0]; in btrfs_truncate_inode_items()
662 } else if (path->slots[0] + 1 == pending_del_slot) { in btrfs_truncate_inode_items()
665 pending_del_slot = path->slots[0]; in btrfs_truncate_inode_items()
697 if (path->slots[0] == 0 || in btrfs_truncate_inode_items()
698 path->slots[0] != pending_del_slot || in btrfs_truncate_inode_items()
701 ret = btrfs_del_items(trans, root, path, in btrfs_truncate_inode_items()
710 btrfs_release_path(path); in btrfs_truncate_inode_items()
732 path->slots[0]--; in btrfs_truncate_inode_items()
739 err = btrfs_del_items(trans, root, path, pending_del_slot, in btrfs_truncate_inode_items()
751 btrfs_free_path(path); in btrfs_truncate_inode_items()