Lines Matching refs:path
279 struct btrfs_path *path; in btrfs_check_file()
291 path = btrfs_alloc_path(); in btrfs_check_file()
292 ret = btrfs_lookup_file_extent(NULL, root, path, inode->i_ino, in btrfs_check_file()
295 nritems = btrfs_header_nritems(path->nodes[0]); in btrfs_check_file()
296 if (path->slots[0] >= nritems) { in btrfs_check_file()
297 ret = btrfs_next_leaf(root, path); in btrfs_check_file()
300 nritems = btrfs_header_nritems(path->nodes[0]); in btrfs_check_file()
302 slot = path->slots[0]; in btrfs_check_file()
303 leaf = path->nodes[0]; in btrfs_check_file()
335 path->slots[0]++; in btrfs_check_file()
347 btrfs_free_path(path); in btrfs_check_file()
382 struct btrfs_path *path; in btrfs_drop_extents() local
397 path = btrfs_alloc_path(); in btrfs_drop_extents()
398 if (!path) in btrfs_drop_extents()
402 btrfs_release_path(root, path); in btrfs_drop_extents()
403 ret = btrfs_lookup_file_extent(trans, root, path, inode->i_ino, in btrfs_drop_extents()
408 if (path->slots[0] == 0) { in btrfs_drop_extents()
412 path->slots[0]--; in btrfs_drop_extents()
425 leaf = path->nodes[0]; in btrfs_drop_extents()
426 slot = path->slots[0]; in btrfs_drop_extents()
480 nextret = btrfs_next_leaf(root, path); in btrfs_drop_extents()
485 path->slots[0]++; in btrfs_drop_extents()
513 btrfs_release_path(root, path); in btrfs_drop_extents()
522 orig_parent = path->nodes[0]->start; in btrfs_drop_extents()
572 btrfs_truncate_item(trans, root, path, in btrfs_drop_extents()
582 ret = btrfs_del_item(trans, root, path); in btrfs_drop_extents()
586 btrfs_release_path(root, path); in btrfs_drop_extents()
597 ret = btrfs_truncate_item(trans, root, path, in btrfs_drop_extents()
608 btrfs_release_path(root, path); in btrfs_drop_extents()
609 ret = btrfs_insert_empty_item(trans, root, path, &ins, in btrfs_drop_extents()
613 leaf = path->nodes[0]; in btrfs_drop_extents()
614 extent = btrfs_item_ptr(leaf, path->slots[0], in btrfs_drop_extents()
642 btrfs_mark_buffer_dirty(path->nodes[0]); in btrfs_drop_extents()
653 btrfs_release_path(root, path); in btrfs_drop_extents()
680 btrfs_free_path(path); in btrfs_drop_extents()
732 struct btrfs_path *path; in btrfs_mark_extent_written() local
750 path = btrfs_alloc_path(); in btrfs_mark_extent_written()
751 BUG_ON(!path); in btrfs_mark_extent_written()
760 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_mark_extent_written()
761 if (ret > 0 && path->slots[0] > 0) in btrfs_mark_extent_written()
762 path->slots[0]--; in btrfs_mark_extent_written()
764 leaf = path->nodes[0]; in btrfs_mark_extent_written()
765 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_mark_extent_written()
768 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_mark_extent_written()
789 if (extent_mergeable(leaf, path->slots[0] + 1, inode->i_ino, in btrfs_mark_extent_written()
792 del_slot = path->slots[0] + 1; in btrfs_mark_extent_written()
801 if (extent_mergeable(leaf, path->slots[0] - 1, inode->i_ino, in btrfs_mark_extent_written()
804 del_slot = path->slots[0]; in btrfs_mark_extent_written()
825 ret = btrfs_del_items(trans, root, path, del_slot, del_nr); in btrfs_mark_extent_written()
833 btrfs_release_path(root, path); in btrfs_mark_extent_written()
849 btrfs_set_item_key_safe(trans, root, path, &key); in btrfs_mark_extent_written()
860 if (extent_mergeable(leaf, path->slots[0] + 1, inode->i_ino, in btrfs_mark_extent_written()
862 path->slots[0]++; in btrfs_mark_extent_written()
863 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_mark_extent_written()
866 btrfs_set_item_key_safe(trans, root, path, &key); in btrfs_mark_extent_written()
876 if (extent_mergeable(leaf, path->slots[0] - 1 , inode->i_ino, in btrfs_mark_extent_written()
878 path->slots[0]--; in btrfs_mark_extent_written()
879 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_mark_extent_written()
894 btrfs_release_path(root, path); in btrfs_mark_extent_written()
897 ret = btrfs_insert_empty_item(trans, root, path, &key, sizeof(*fi)); in btrfs_mark_extent_written()
900 leaf = path->nodes[0]; in btrfs_mark_extent_written()
901 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_mark_extent_written()
923 btrfs_release_path(root, path); in btrfs_mark_extent_written()
932 btrfs_free_path(path); in btrfs_mark_extent_written()