Lines Matching refs:path
225 struct btrfs_path *path = args->path;
230 /* Must always have a path if ->replace_extent is true */
231 ASSERT(!(args->replace_extent && !args->path));
233 if (!path) {
234 path = btrfs_alloc_path();
235 if (!path) {
250 ret = btrfs_lookup_file_extent(trans, root, path, ino,
254 if (ret > 0 && path->slots[0] > 0 && search_start == args->start) {
255 leaf = path->nodes[0];
256 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1);
259 path->slots[0]--;
263 leaf = path->nodes[0];
264 if (path->slots[0] >= btrfs_header_nritems(leaf)) {
266 ret = btrfs_next_leaf(root, path);
273 leaf = path->nodes[0];
277 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
284 path->slots[0]++;
290 fi = btrfs_item_ptr(leaf, path->slots[0],
324 path->slots[0]++;
332 btrfs_release_path(path);
349 ret = btrfs_duplicate_item(trans, root, path,
352 btrfs_release_path(path);
358 leaf = path->nodes[0];
359 fi = btrfs_item_ptr(leaf, path->slots[0] - 1,
364 fi = btrfs_item_ptr(leaf, path->slots[0],
408 btrfs_set_item_key_safe(trans, path, &new_key);
440 path->slots[0]++;
451 del_slot = path->slots[0];
454 BUG_ON(del_slot + del_nr != path->slots[0]);
483 if (path->slots[0] + 1 < btrfs_header_nritems(leaf)) {
484 path->slots[0]++;
488 ret = btrfs_del_items(trans, root, path, del_slot,
498 btrfs_release_path(path);
507 * Set path->slots[0] to first slot, so that after the delete
510 * path->slots[0] for our insertion (if args->replace_extent).
512 path->slots[0] = del_slot;
513 ret = btrfs_del_items(trans, root, path, del_slot, del_nr);
518 leaf = path->nodes[0];
521 * which case it unlocked our path, so check path->locks[0] matches a
525 path->locks[0] == BTRFS_WRITE_LOCK &&
532 if (!del_nr && path->slots[0] < btrfs_header_nritems(leaf)) {
535 btrfs_item_key_to_cpu(leaf, &slot_key, path->slots[0]);
537 path->slots[0]++;
539 btrfs_setup_item_for_insert(trans, root, path, &key,
544 if (!args->path)
545 btrfs_free_path(path);
547 btrfs_release_path(path);
599 struct btrfs_path *path;
617 path = btrfs_alloc_path();
618 if (!path)
627 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
630 if (ret > 0 && path->slots[0] > 0)
631 path->slots[0]--;
633 leaf = path->nodes[0];
634 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
641 fi = btrfs_item_ptr(leaf, path->slots[0],
663 if (extent_mergeable(leaf, path->slots[0] - 1,
667 btrfs_set_item_key_safe(trans, path, &new_key);
668 fi = btrfs_item_ptr(leaf, path->slots[0],
676 fi = btrfs_item_ptr(leaf, path->slots[0] - 1,
690 if (extent_mergeable(leaf, path->slots[0] + 1,
693 fi = btrfs_item_ptr(leaf, path->slots[0],
699 path->slots[0]++;
701 btrfs_set_item_key_safe(trans, path, &new_key);
703 fi = btrfs_item_ptr(leaf, path->slots[0],
721 ret = btrfs_duplicate_item(trans, root, path, &new_key);
723 btrfs_release_path(path);
731 leaf = path->nodes[0];
732 fi = btrfs_item_ptr(leaf, path->slots[0] - 1,
738 fi = btrfs_item_ptr(leaf, path->slots[0],
765 path->slots[0]--;
777 if (extent_mergeable(leaf, path->slots[0] + 1,
781 btrfs_release_path(path);
785 del_slot = path->slots[0] + 1;
795 if (extent_mergeable(leaf, path->slots[0] - 1,
799 btrfs_release_path(path);
803 del_slot = path->slots[0];
812 fi = btrfs_item_ptr(leaf, path->slots[0],
828 ret = btrfs_del_items(trans, root, path, del_slot, del_nr);
835 btrfs_free_path(path);
1912 * example checking cross references in the nocow path). If we use join
2066 struct btrfs_path *path, u64 offset, u64 end)
2083 ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
2094 leaf = path->nodes[0];
2095 if (hole_mergeable(inode, leaf, path->slots[0] - 1, offset, end)) {
2098 path->slots[0]--;
2099 fi = btrfs_item_ptr(leaf, path->slots[0],
2111 if (hole_mergeable(inode, leaf, path->slots[0], offset, end)) {
2115 btrfs_set_item_key_safe(trans, path, &key);
2116 fi = btrfs_item_ptr(leaf, path->slots[0],
2127 btrfs_release_path(path);
2135 btrfs_release_path(path);
2235 struct btrfs_path *path,
2261 ret = btrfs_insert_empty_item(trans, root, path, &key,
2265 leaf = path->nodes[0];
2266 slot = path->slots[0];
2277 btrfs_release_path(path);
2328 struct btrfs_path *path, const u64 start,
2381 drop_args.path = path;
2411 ret = fill_holes(trans, inode, path, cur_offset,
2449 ret = btrfs_insert_replace_extent(trans, inode, path,
2531 * map representing the existing hole), otherwise the fast fsync path
2544 ret = fill_holes(trans, inode, path, cur_offset,
2562 ret = btrfs_insert_replace_extent(trans, inode, path,
2592 struct btrfs_path *path;
2703 path = btrfs_alloc_path();
2704 if (!path) {
2709 ret = btrfs_replace_file_extents(BTRFS_I(inode), path, lockstart,
2711 btrfs_free_path(path);
3464 struct btrfs_path *path;
3477 * Quick path. If the inode has no prealloc extents and its number of
3513 path = btrfs_alloc_path();
3514 if (!path)
3516 path->reada = READA_FORWARD;
3526 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
3529 } else if (ret > 0 && path->slots[0] > 0) {
3530 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0] - 1);
3532 path->slots[0]--;
3536 struct extent_buffer *leaf = path->nodes[0];
3541 if (path->slots[0] >= btrfs_header_nritems(leaf)) {
3542 ret = btrfs_next_leaf(root, path);
3548 leaf = path->nodes[0];
3551 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
3555 extent_end = btrfs_file_extent_end(path);
3562 path->slots[0]++;
3593 extent = btrfs_item_ptr(leaf, path->slots[0],
3652 path->slots[0]++;
3671 btrfs_free_path(path);