Lines Matching refs:path
102 struct btrfs_path *path, u64 objectid);
106 struct btrfs_path *path,
344 struct btrfs_path *path, in overwrite_item() argument
364 ret = btrfs_search_slot(NULL, root, key, path, 0, 0); in overwrite_item()
371 u32 dst_size = btrfs_item_size_nr(path->nodes[0], in overwrite_item()
372 path->slots[0]); in overwrite_item()
377 btrfs_release_path(path); in overwrite_item()
383 btrfs_release_path(path); in overwrite_item()
391 dst_ptr = btrfs_item_ptr_offset(path->nodes[0], path->slots[0]); in overwrite_item()
392 read_extent_buffer(path->nodes[0], dst_copy, dst_ptr, in overwrite_item()
405 btrfs_release_path(path); in overwrite_item()
418 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in overwrite_item()
420 nbytes = btrfs_inode_nbytes(path->nodes[0], item); in overwrite_item()
455 btrfs_release_path(path); in overwrite_item()
457 path->skip_release_on_error = 1; in overwrite_item()
458 ret = btrfs_insert_empty_item(trans, root, path, in overwrite_item()
460 path->skip_release_on_error = 0; in overwrite_item()
465 found_size = btrfs_item_size_nr(path->nodes[0], in overwrite_item()
466 path->slots[0]); in overwrite_item()
468 btrfs_truncate_item(path, item_size, 1); in overwrite_item()
470 btrfs_extend_item(path, item_size - found_size); in overwrite_item()
474 dst_ptr = btrfs_item_ptr_offset(path->nodes[0], in overwrite_item()
475 path->slots[0]); in overwrite_item()
494 struct extent_buffer *dst_eb = path->nodes[0]; in overwrite_item()
518 S_ISDIR(btrfs_inode_mode(path->nodes[0], dst_item))) { in overwrite_item()
520 saved_i_size = btrfs_inode_size(path->nodes[0], in overwrite_item()
525 copy_extent_buffer(path->nodes[0], eb, dst_ptr, in overwrite_item()
531 btrfs_set_inode_size(path->nodes[0], dst_item, saved_i_size); in overwrite_item()
538 if (btrfs_inode_generation(path->nodes[0], dst_item) == 0) { in overwrite_item()
539 btrfs_set_inode_generation(path->nodes[0], dst_item, in overwrite_item()
544 btrfs_mark_buffer_dirty(path->nodes[0]); in overwrite_item()
545 btrfs_release_path(path); in overwrite_item()
582 struct btrfs_path *path, in replay_one_extent() argument
631 ret = btrfs_lookup_file_extent(trans, root, path, in replay_one_extent()
642 leaf = path->nodes[0]; in replay_one_extent()
643 existing = btrfs_item_ptr(leaf, path->slots[0], in replay_one_extent()
656 btrfs_release_path(path); in replay_one_extent()
660 btrfs_release_path(path); in replay_one_extent()
677 ret = btrfs_insert_empty_item(trans, root, path, key, in replay_one_extent()
681 dest_offset = btrfs_item_ptr_offset(path->nodes[0], in replay_one_extent()
682 path->slots[0]); in replay_one_extent()
683 copy_extent_buffer(path->nodes[0], eb, dest_offset, in replay_one_extent()
739 btrfs_release_path(path); in replay_one_extent()
823 btrfs_release_path(path); in replay_one_extent()
827 ret = overwrite_item(trans, root, path, eb, slot, key); in replay_one_extent()
851 struct btrfs_path *path, in drop_one_dir_item() argument
862 leaf = path->nodes[0]; in drop_one_dir_item()
871 btrfs_release_path(path); in drop_one_dir_item()
879 ret = link_to_fixup_dir(trans, root, path, location.objectid); in drop_one_dir_item()
901 struct btrfs_path *path, in inode_in_dir() argument
909 di = btrfs_lookup_dir_index_item(NULL, root, path, dirid, in inode_in_dir()
912 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &location); in inode_in_dir()
917 btrfs_release_path(path); in inode_in_dir()
919 di = btrfs_lookup_dir_item(NULL, root, path, dirid, name, name_len, 0); in inode_in_dir()
921 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &location); in inode_in_dir()
928 btrfs_release_path(path); in inode_in_dir()
947 struct btrfs_path *path; in backref_in_log() local
957 path = btrfs_alloc_path(); in backref_in_log()
958 if (!path) in backref_in_log()
961 ret = btrfs_search_slot(NULL, log, key, path, 0, 0); in backref_in_log()
965 ptr = btrfs_item_ptr_offset(path->nodes[0], path->slots[0]); in backref_in_log()
968 if (btrfs_find_name_in_ext_backref(path->nodes[0], in backref_in_log()
969 path->slots[0], in backref_in_log()
977 item_size = btrfs_item_size_nr(path->nodes[0], path->slots[0]); in backref_in_log()
981 found_name_len = btrfs_inode_ref_name_len(path->nodes[0], ref); in backref_in_log()
984 ret = memcmp_extent_buffer(path->nodes[0], name, in backref_in_log()
994 btrfs_free_path(path); in backref_in_log()
1000 struct btrfs_path *path, in __add_inode_ref() argument
1021 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in __add_inode_ref()
1027 leaf = path->nodes[0]; in __add_inode_ref()
1039 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in __add_inode_ref()
1040 ptr_end = ptr + btrfs_item_size_nr(leaf, path->slots[0]); in __add_inode_ref()
1058 btrfs_release_path(path); in __add_inode_ref()
1082 btrfs_release_path(path); in __add_inode_ref()
1085 extref = btrfs_lookup_inode_extref(NULL, root, path, name, namelen, in __add_inode_ref()
1094 leaf = path->nodes[0]; in __add_inode_ref()
1096 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in __add_inode_ref()
1097 base = btrfs_item_ptr_offset(leaf, path->slots[0]); in __add_inode_ref()
1127 btrfs_release_path(path); in __add_inode_ref()
1151 btrfs_release_path(path); in __add_inode_ref()
1154 di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir), in __add_inode_ref()
1157 ret = drop_one_dir_item(trans, root, path, dir, di); in __add_inode_ref()
1161 btrfs_release_path(path); in __add_inode_ref()
1164 di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir), in __add_inode_ref()
1167 ret = drop_one_dir_item(trans, root, path, dir, di); in __add_inode_ref()
1171 btrfs_release_path(path); in __add_inode_ref()
1229 struct btrfs_path *path, in unlink_old_inode_refs() argument
1241 btrfs_release_path(path); in unlink_old_inode_refs()
1242 ret = btrfs_search_slot(NULL, root, key, path, 0, 0); in unlink_old_inode_refs()
1250 eb = path->nodes[0]; in unlink_old_inode_refs()
1251 ref_ptr = btrfs_item_ptr_offset(eb, path->slots[0]); in unlink_old_inode_refs()
1252 ref_end = ref_ptr + btrfs_item_size_nr(eb, path->slots[0]); in unlink_old_inode_refs()
1280 btrfs_release_path(path); in unlink_old_inode_refs()
1305 btrfs_release_path(path); in unlink_old_inode_refs()
1314 struct btrfs_path *path; in btrfs_inode_ref_exists() local
1318 path = btrfs_alloc_path(); in btrfs_inode_ref_exists()
1319 if (!path) in btrfs_inode_ref_exists()
1329 ret = btrfs_search_slot(NULL, BTRFS_I(inode)->root, &key, path, 0, 0); in btrfs_inode_ref_exists()
1337 ret = !!btrfs_find_name_in_ext_backref(path->nodes[0], in btrfs_inode_ref_exists()
1338 path->slots[0], parent_id, name, namelen); in btrfs_inode_ref_exists()
1340 ret = !!btrfs_find_name_in_backref(path->nodes[0], path->slots[0], in btrfs_inode_ref_exists()
1344 btrfs_free_path(path); in btrfs_inode_ref_exists()
1354 struct btrfs_path *path; in add_link() local
1358 path = btrfs_alloc_path(); in add_link()
1359 if (!path) in add_link()
1362 dir_item = btrfs_lookup_dir_item(NULL, root, path, in add_link()
1366 btrfs_release_path(path); in add_link()
1378 btrfs_dir_item_key_to_cpu(path->nodes[0], dir_item, &key); in add_link()
1379 btrfs_release_path(path); in add_link()
1404 btrfs_free_path(path); in add_link()
1418 struct btrfs_path *path, in add_inode_ref() argument
1492 if (!inode_in_dir(root, path, btrfs_ino(BTRFS_I(dir)), in add_inode_ref()
1504 ret = __add_inode_ref(trans, root, path, log, in add_inode_ref()
1570 ret = unlink_old_inode_refs(trans, root, path, BTRFS_I(inode), eb, slot, in add_inode_ref()
1576 ret = overwrite_item(trans, root, path, eb, slot, key); in add_inode_ref()
1578 btrfs_release_path(path); in add_inode_ref()
1598 struct btrfs_inode *inode, struct btrfs_path *path) in count_inode_extrefs() argument
1612 ret = btrfs_find_one_extref(root, inode_objectid, offset, path, in count_inode_extrefs()
1617 leaf = path->nodes[0]; in count_inode_extrefs()
1618 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in count_inode_extrefs()
1619 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in count_inode_extrefs()
1632 btrfs_release_path(path); in count_inode_extrefs()
1634 btrfs_release_path(path); in count_inode_extrefs()
1642 struct btrfs_inode *inode, struct btrfs_path *path) in count_inode_refs() argument
1657 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in count_inode_refs()
1661 if (path->slots[0] == 0) in count_inode_refs()
1663 path->slots[0]--; in count_inode_refs()
1666 btrfs_item_key_to_cpu(path->nodes[0], &key, in count_inode_refs()
1667 path->slots[0]); in count_inode_refs()
1671 ptr = btrfs_item_ptr_offset(path->nodes[0], path->slots[0]); in count_inode_refs()
1672 ptr_end = ptr + btrfs_item_size_nr(path->nodes[0], in count_inode_refs()
1673 path->slots[0]); in count_inode_refs()
1678 name_len = btrfs_inode_ref_name_len(path->nodes[0], in count_inode_refs()
1686 if (path->slots[0] > 0) { in count_inode_refs()
1687 path->slots[0]--; in count_inode_refs()
1691 btrfs_release_path(path); in count_inode_refs()
1693 btrfs_release_path(path); in count_inode_refs()
1712 struct btrfs_path *path; in fixup_inode_link_count() local
1717 path = btrfs_alloc_path(); in fixup_inode_link_count()
1718 if (!path) in fixup_inode_link_count()
1721 ret = count_inode_refs(root, BTRFS_I(inode), path); in fixup_inode_link_count()
1727 ret = count_inode_extrefs(root, BTRFS_I(inode), path); in fixup_inode_link_count()
1743 ret = replay_dir_deletes(trans, root, NULL, path, in fixup_inode_link_count()
1752 btrfs_free_path(path); in fixup_inode_link_count()
1758 struct btrfs_path *path) in fixup_inode_link_counts() argument
1768 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in fixup_inode_link_counts()
1773 if (path->slots[0] == 0) in fixup_inode_link_counts()
1775 path->slots[0]--; in fixup_inode_link_counts()
1778 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in fixup_inode_link_counts()
1783 ret = btrfs_del_item(trans, root, path); in fixup_inode_link_counts()
1787 btrfs_release_path(path); in fixup_inode_link_counts()
1806 btrfs_release_path(path); in fixup_inode_link_counts()
1818 struct btrfs_path *path, in link_to_fixup_dir() argument
1833 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in link_to_fixup_dir()
1835 btrfs_release_path(path); in link_to_fixup_dir()
1929 struct btrfs_path *path, in replay_one_name() argument
1962 exists = btrfs_lookup_inode(trans, root, path, &log_key, 0); in replay_one_name()
1967 btrfs_release_path(path); in replay_one_name()
1970 dst_di = btrfs_lookup_dir_item(trans, root, path, key->objectid, in replay_one_name()
1973 dst_di = btrfs_lookup_dir_index_item(trans, root, path, in replay_one_name()
1991 btrfs_dir_item_key_to_cpu(path->nodes[0], dst_di, &found_key); in replay_one_name()
1996 btrfs_dir_type(path->nodes[0], dst_di) == log_type) { in replay_one_name()
2008 ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), dst_di); in replay_one_name()
2015 btrfs_release_path(path); in replay_one_name()
2034 btrfs_release_path(path); in replay_one_name()
2054 struct btrfs_path *path, in replay_one_dir_item() argument
2071 ret = replay_one_name(trans, root, path, eb, di, key); in replay_one_dir_item()
2139 struct btrfs_path *path, in find_dir_range() argument
2156 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in find_dir_range()
2160 if (path->slots[0] == 0) in find_dir_range()
2162 path->slots[0]--; in find_dir_range()
2165 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in find_dir_range()
2171 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in find_dir_range()
2173 found_end = btrfs_dir_log_end(path->nodes[0], item); in find_dir_range()
2184 nritems = btrfs_header_nritems(path->nodes[0]); in find_dir_range()
2185 path->slots[0]++; in find_dir_range()
2186 if (path->slots[0] >= nritems) { in find_dir_range()
2187 ret = btrfs_next_leaf(root, path); in find_dir_range()
2192 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in find_dir_range()
2198 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in find_dir_range()
2200 found_end = btrfs_dir_log_end(path->nodes[0], item); in find_dir_range()
2205 btrfs_release_path(path); in find_dir_range()
2217 struct btrfs_path *path, in check_item_in_log() argument
2236 eb = path->nodes[0]; in check_item_in_log()
2237 slot = path->slots[0]; in check_item_in_log()
2265 btrfs_release_path(path); in check_item_in_log()
2274 path, location.objectid); in check_item_in_log()
2294 ret = btrfs_search_slot(NULL, root, dir_key, path, in check_item_in_log()
2312 btrfs_release_path(path); in check_item_in_log()
2320 struct btrfs_path *path, in replay_xattr_deletes() argument
2337 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in replay_xattr_deletes()
2341 nritems = btrfs_header_nritems(path->nodes[0]); in replay_xattr_deletes()
2342 for (i = path->slots[0]; i < nritems; i++) { in replay_xattr_deletes()
2349 btrfs_item_key_to_cpu(path->nodes[0], &key, i); in replay_xattr_deletes()
2355 di = btrfs_item_ptr(path->nodes[0], i, struct btrfs_dir_item); in replay_xattr_deletes()
2356 total_size = btrfs_item_size_nr(path->nodes[0], i); in replay_xattr_deletes()
2359 u16 name_len = btrfs_dir_name_len(path->nodes[0], di); in replay_xattr_deletes()
2360 u16 data_len = btrfs_dir_data_len(path->nodes[0], di); in replay_xattr_deletes()
2369 read_extent_buffer(path->nodes[0], name, in replay_xattr_deletes()
2377 btrfs_release_path(path); in replay_xattr_deletes()
2378 di = btrfs_lookup_xattr(trans, root, path, ino, in replay_xattr_deletes()
2387 path, di); in replay_xattr_deletes()
2390 btrfs_release_path(path); in replay_xattr_deletes()
2403 ret = btrfs_next_leaf(root, path); in replay_xattr_deletes()
2410 btrfs_release_path(path); in replay_xattr_deletes()
2428 struct btrfs_path *path, in replay_dir_deletes() argument
2462 ret = find_dir_range(log, path, dirid, key_type, in replay_dir_deletes()
2471 ret = btrfs_search_slot(NULL, root, &dir_key, path, in replay_dir_deletes()
2476 nritems = btrfs_header_nritems(path->nodes[0]); in replay_dir_deletes()
2477 if (path->slots[0] >= nritems) { in replay_dir_deletes()
2478 ret = btrfs_next_leaf(root, path); in replay_dir_deletes()
2484 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in replay_dir_deletes()
2485 path->slots[0]); in replay_dir_deletes()
2493 ret = check_item_in_log(trans, root, log, path, in replay_dir_deletes()
2502 btrfs_release_path(path); in replay_dir_deletes()
2513 btrfs_release_path(path); in replay_dir_deletes()
2517 btrfs_release_path(path); in replay_dir_deletes()
2538 struct btrfs_path *path; in replay_one_buffer() local
2553 path = btrfs_alloc_path(); in replay_one_buffer()
2554 if (!path) in replay_one_buffer()
2584 path, key.objectid); in replay_one_buffer()
2590 root, log, path, key.objectid, 0); in replay_one_buffer()
2594 ret = overwrite_item(wc->trans, root, path, in replay_one_buffer()
2631 path, key.objectid); in replay_one_buffer()
2641 ret = replay_one_dir_item(wc->trans, root, path, in replay_one_buffer()
2652 ret = overwrite_item(wc->trans, root, path, in replay_one_buffer()
2658 ret = add_inode_ref(wc->trans, root, log, path, in replay_one_buffer()
2664 ret = replay_one_extent(wc->trans, root, path, in replay_one_buffer()
2669 ret = replay_one_dir_item(wc->trans, root, path, in replay_one_buffer()
2675 btrfs_free_path(path); in replay_one_buffer()
2681 struct btrfs_path *path, int *level, in walk_down_log_tree() argument
2702 cur = path->nodes[*level]; in walk_down_log_tree()
2706 if (path->slots[*level] >= in walk_down_log_tree()
2710 bytenr = btrfs_node_blockptr(cur, path->slots[*level]); in walk_down_log_tree()
2711 ptr_gen = btrfs_node_ptr_generation(cur, path->slots[*level]); in walk_down_log_tree()
2712 btrfs_node_key_to_cpu(cur, &first_key, path->slots[*level]); in walk_down_log_tree()
2715 parent = path->nodes[*level]; in walk_down_log_tree()
2730 path->slots[*level]++; in walk_down_log_tree()
2770 if (path->nodes[*level-1]) in walk_down_log_tree()
2771 free_extent_buffer(path->nodes[*level-1]); in walk_down_log_tree()
2772 path->nodes[*level-1] = next; in walk_down_log_tree()
2774 path->slots[*level] = 0; in walk_down_log_tree()
2780 path->slots[*level] = btrfs_header_nritems(path->nodes[*level]); in walk_down_log_tree()
2788 struct btrfs_path *path, int *level, in walk_up_log_tree() argument
2797 for (i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) { in walk_up_log_tree()
2798 slot = path->slots[i]; in walk_up_log_tree()
2799 if (slot + 1 < btrfs_header_nritems(path->nodes[i])) { in walk_up_log_tree()
2800 path->slots[i]++; in walk_up_log_tree()
2806 if (path->nodes[*level] == root->node) in walk_up_log_tree()
2807 parent = path->nodes[*level]; in walk_up_log_tree()
2809 parent = path->nodes[*level + 1]; in walk_up_log_tree()
2812 ret = wc->process_func(root, path->nodes[*level], wc, in walk_up_log_tree()
2813 btrfs_header_generation(path->nodes[*level]), in walk_up_log_tree()
2821 next = path->nodes[*level]; in walk_up_log_tree()
2837 path->nodes[*level]->start, in walk_up_log_tree()
2838 path->nodes[*level]->len); in walk_up_log_tree()
2842 free_extent_buffer(path->nodes[*level]); in walk_up_log_tree()
2843 path->nodes[*level] = NULL; in walk_up_log_tree()
2862 struct btrfs_path *path; in walk_log_tree() local
2865 path = btrfs_alloc_path(); in walk_log_tree()
2866 if (!path) in walk_log_tree()
2871 path->nodes[level] = log->node; in walk_log_tree()
2873 path->slots[level] = 0; in walk_log_tree()
2876 wret = walk_down_log_tree(trans, log, path, &level, wc); in walk_log_tree()
2884 wret = walk_up_log_tree(trans, log, path, &level, wc); in walk_log_tree()
2894 if (path->nodes[orig_level]) { in walk_log_tree()
2895 ret = wc->process_func(log, path->nodes[orig_level], wc, in walk_log_tree()
2896 btrfs_header_generation(path->nodes[orig_level]), in walk_log_tree()
2903 next = path->nodes[orig_level]; in walk_log_tree()
2926 btrfs_free_path(path); in walk_log_tree()
3395 struct btrfs_path *path; in btrfs_del_dir_entries_in_log() local
3411 path = btrfs_alloc_path(); in btrfs_del_dir_entries_in_log()
3412 if (!path) { in btrfs_del_dir_entries_in_log()
3417 di = btrfs_lookup_dir_item(trans, log, path, dir_ino, in btrfs_del_dir_entries_in_log()
3424 ret = btrfs_delete_one_dir_name(trans, log, path, di); in btrfs_del_dir_entries_in_log()
3431 btrfs_release_path(path); in btrfs_del_dir_entries_in_log()
3432 di = btrfs_lookup_dir_index_item(trans, log, path, dir_ino, in btrfs_del_dir_entries_in_log()
3439 ret = btrfs_delete_one_dir_name(trans, log, path, di); in btrfs_del_dir_entries_in_log()
3456 btrfs_release_path(path); in btrfs_del_dir_entries_in_log()
3458 ret = btrfs_search_slot(trans, log, &key, path, 0, 1); in btrfs_del_dir_entries_in_log()
3467 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_del_dir_entries_in_log()
3469 i_size = btrfs_inode_size(path->nodes[0], item); in btrfs_del_dir_entries_in_log()
3474 btrfs_set_inode_size(path->nodes[0], item, i_size); in btrfs_del_dir_entries_in_log()
3475 btrfs_mark_buffer_dirty(path->nodes[0]); in btrfs_del_dir_entries_in_log()
3478 btrfs_release_path(path); in btrfs_del_dir_entries_in_log()
3481 btrfs_free_path(path); in btrfs_del_dir_entries_in_log()
3534 struct btrfs_path *path, in insert_dir_log_key() argument
3548 ret = btrfs_insert_empty_item(trans, log, path, &key, sizeof(*item)); in insert_dir_log_key()
3552 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in insert_dir_log_key()
3554 btrfs_set_dir_log_end(path->nodes[0], item, last_offset); in insert_dir_log_key()
3555 btrfs_mark_buffer_dirty(path->nodes[0]); in insert_dir_log_key()
3556 btrfs_release_path(path); in insert_dir_log_key()
3567 struct btrfs_path *path, in log_dir_items() argument
3589 ret = btrfs_search_forward(root, &min_key, path, trans->transid); in log_dir_items()
3599 btrfs_release_path(path); in log_dir_items()
3600 ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0); in log_dir_items()
3602 btrfs_release_path(path); in log_dir_items()
3605 ret = btrfs_previous_item(root, path, ino, key_type); in log_dir_items()
3614 btrfs_item_key_to_cpu(path->nodes[0], &tmp, in log_dir_items()
3615 path->slots[0]); in log_dir_items()
3623 ret = btrfs_previous_item(root, path, ino, key_type); in log_dir_items()
3626 btrfs_item_key_to_cpu(path->nodes[0], &tmp, path->slots[0]); in log_dir_items()
3630 path->nodes[0], path->slots[0], in log_dir_items()
3638 btrfs_release_path(path); in log_dir_items()
3648 ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0); in log_dir_items()
3658 src = path->nodes[0]; in log_dir_items()
3660 for (i = path->slots[0]; i < nritems; i++) { in log_dir_items()
3705 path->slots[0] = nritems; in log_dir_items()
3711 ret = btrfs_next_leaf(root, path); in log_dir_items()
3719 btrfs_item_key_to_cpu(path->nodes[0], &tmp, path->slots[0]); in log_dir_items()
3724 if (btrfs_header_generation(path->nodes[0]) != trans->transid) { in log_dir_items()
3726 path->nodes[0], path->slots[0], in log_dir_items()
3736 btrfs_release_path(path); in log_dir_items()
3745 ret = insert_dir_log_key(trans, log, path, key_type, in log_dir_items()
3767 struct btrfs_path *path, in log_directory_changes() argument
3780 ret = log_dir_items(trans, root, inode, path, dst_path, key_type, in log_directory_changes()
3804 struct btrfs_path *path, in drop_objectid_items() argument
3817 ret = btrfs_search_slot(trans, log, &key, path, -1, 1); in drop_objectid_items()
3822 if (path->slots[0] == 0) in drop_objectid_items()
3825 path->slots[0]--; in drop_objectid_items()
3826 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in drop_objectid_items()
3827 path->slots[0]); in drop_objectid_items()
3834 ret = btrfs_bin_search(path->nodes[0], &found_key, 0, in drop_objectid_items()
3839 ret = btrfs_del_items(trans, log, path, start_slot, in drop_objectid_items()
3840 path->slots[0] - start_slot + 1); in drop_objectid_items()
3847 btrfs_release_path(path); in drop_objectid_items()
3849 btrfs_release_path(path); in drop_objectid_items()
3912 struct btrfs_root *log, struct btrfs_path *path, in log_inode_item() argument
3918 ret = btrfs_insert_empty_item(trans, log, path, in log_inode_item()
3922 inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0], in log_inode_item()
3924 fill_inode_item(trans, path->nodes[0], inode_item, &inode->vfs_inode, in log_inode_item()
3926 btrfs_release_path(path); in log_inode_item()
4306 struct btrfs_path *path, in log_one_extent() argument
4323 ret = __btrfs_drop_extents(trans, log, &inode->vfs_inode, path, em->start, in log_one_extent()
4334 ret = btrfs_insert_empty_item(trans, log, path, &key, in log_one_extent()
4339 leaf = path->nodes[0]; in log_one_extent()
4341 fi = btrfs_item_ptr(leaf, path->slots[0], in log_one_extent()
4383 btrfs_release_path(path); in log_one_extent()
4398 struct btrfs_path *path) in btrfs_log_prealloc_extents() argument
4416 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_prealloc_extents()
4421 struct extent_buffer *leaf = path->nodes[0]; in btrfs_log_prealloc_extents()
4422 int slot = path->slots[0]; in btrfs_log_prealloc_extents()
4426 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_prealloc_extents()
4433 ret = btrfs_next_leaf(root, path); in btrfs_log_prealloc_extents()
4449 path->slots[0]++; in btrfs_log_prealloc_extents()
4471 path->slots[0]++; in btrfs_log_prealloc_extents()
4481 ret = copy_items(trans, inode, dst_path, path, &last_extent, in btrfs_log_prealloc_extents()
4487 btrfs_release_path(path); in btrfs_log_prealloc_extents()
4495 struct btrfs_path *path, in btrfs_log_changed_extents() argument
4577 ret = log_one_extent(trans, inode, root, em, path, ctx); in btrfs_log_changed_extents()
4585 btrfs_release_path(path); in btrfs_log_changed_extents()
4587 ret = btrfs_log_prealloc_extents(trans, inode, path); in btrfs_log_changed_extents()
4593 struct btrfs_path *path, u64 *size_ret) in logged_inode_size() argument
4602 ret = btrfs_search_slot(NULL, log, &key, path, 0, 0); in logged_inode_size()
4610 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in logged_inode_size()
4612 *size_ret = btrfs_inode_size(path->nodes[0], item); in logged_inode_size()
4628 btrfs_release_path(path); in logged_inode_size()
4644 struct btrfs_path *path, in btrfs_log_all_xattrs() argument
4657 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_all_xattrs()
4662 int slot = path->slots[0]; in btrfs_log_all_xattrs()
4663 struct extent_buffer *leaf = path->nodes[0]; in btrfs_log_all_xattrs()
4670 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_all_xattrs()
4679 ret = btrfs_next_leaf(root, path); in btrfs_log_all_xattrs()
4694 path->slots[0]++; in btrfs_log_all_xattrs()
4700 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_all_xattrs()
4739 struct btrfs_path *path) in btrfs_log_trailing_hole() argument
4758 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_trailing_hole()
4763 ASSERT(path->slots[0] > 0); in btrfs_log_trailing_hole()
4764 path->slots[0]--; in btrfs_log_trailing_hole()
4765 leaf = path->nodes[0]; in btrfs_log_trailing_hole()
4766 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_log_trailing_hole()
4783 extent = btrfs_item_ptr(leaf, path->slots[0], in btrfs_log_trailing_hole()
4797 btrfs_release_path(path); in btrfs_log_trailing_hole()
4952 struct btrfs_path *path, in log_conflicting_inodes() argument
4981 btrfs_release_path(path); in log_conflicting_inodes()
5027 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in log_conflicting_inodes()
5034 struct extent_buffer *leaf = path->nodes[0]; in log_conflicting_inodes()
5035 int slot = path->slots[0]; in log_conflicting_inodes()
5040 ret = btrfs_next_leaf(root, path); in log_conflicting_inodes()
5074 path->slots[0]++; in log_conflicting_inodes()
5104 struct btrfs_path *path; in btrfs_log_inode() local
5123 path = btrfs_alloc_path(); in btrfs_log_inode()
5124 if (!path) in btrfs_log_inode()
5128 btrfs_free_path(path); in btrfs_log_inode()
5162 btrfs_free_path(path); in btrfs_log_inode()
5187 ret = drop_objectid_items(trans, log, path, ino, max_key_type); in btrfs_log_inode()
5203 err = logged_inode_size(log, inode, path, &logged_isize); in btrfs_log_inode()
5211 ret = drop_objectid_items(trans, log, path, ino, in btrfs_log_inode()
5231 ret = drop_objectid_items(trans, log, path, ino, in btrfs_log_inode()
5248 path, trans->transid); in btrfs_log_inode()
5272 ret = btrfs_check_ref_name_override(path->nodes[0], in btrfs_log_inode()
5273 path->slots[0], &min_key, inode, in btrfs_log_inode()
5284 ins_start_slot = path->slots[0]; in btrfs_log_inode()
5286 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_inode()
5296 err = log_conflicting_inodes(trans, root, path, in btrfs_log_inode()
5300 btrfs_release_path(path); in btrfs_log_inode()
5309 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_inode()
5318 btrfs_release_path(path); in btrfs_log_inode()
5324 if (ins_nr && ins_start_slot + ins_nr == path->slots[0]) { in btrfs_log_inode()
5328 ins_start_slot = path->slots[0]; in btrfs_log_inode()
5333 ret = copy_items(trans, inode, dst_path, path, &last_extent, in btrfs_log_inode()
5342 btrfs_release_path(path); in btrfs_log_inode()
5346 ins_start_slot = path->slots[0]; in btrfs_log_inode()
5349 nritems = btrfs_header_nritems(path->nodes[0]); in btrfs_log_inode()
5350 path->slots[0]++; in btrfs_log_inode()
5351 if (path->slots[0] < nritems) { in btrfs_log_inode()
5352 btrfs_item_key_to_cpu(path->nodes[0], &min_key, in btrfs_log_inode()
5353 path->slots[0]); in btrfs_log_inode()
5357 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_inode()
5367 btrfs_release_path(path); in btrfs_log_inode()
5379 ret = copy_items(trans, inode, dst_path, path, &last_extent, in btrfs_log_inode()
5390 btrfs_release_path(path); in btrfs_log_inode()
5392 err = btrfs_log_all_xattrs(trans, root, inode, path, dst_path); in btrfs_log_inode()
5397 btrfs_release_path(path); in btrfs_log_inode()
5399 err = btrfs_log_trailing_hole(trans, root, inode, path); in btrfs_log_inode()
5404 btrfs_release_path(path); in btrfs_log_inode()
5409 err = btrfs_log_all_xattrs(trans, root, inode, path, in btrfs_log_inode()
5411 btrfs_release_path(path); in btrfs_log_inode()
5456 ret = log_directory_changes(trans, root, inode, path, dst_path, in btrfs_log_inode()
5481 btrfs_free_path(path); in btrfs_log_inode()
5635 struct btrfs_path *path; in log_new_dir_dentries() local
5640 path = btrfs_alloc_path(); in log_new_dir_dentries()
5641 if (!path) in log_new_dir_dentries()
5646 btrfs_free_path(path); in log_new_dir_dentries()
5667 btrfs_release_path(path); in log_new_dir_dentries()
5668 ret = btrfs_search_forward(log, &min_key, path, trans->transid); in log_new_dir_dentries()
5677 leaf = path->nodes[0]; in log_new_dir_dentries()
5679 for (i = path->slots[0]; i < nritems; i++) { in log_new_dir_dentries()
5701 btrfs_release_path(path); in log_new_dir_dentries()
5737 ret = btrfs_next_leaf(log, path); in log_new_dir_dentries()
5755 btrfs_free_path(path); in log_new_dir_dentries()
5765 struct btrfs_path *path; in btrfs_log_all_parents() local
5770 path = btrfs_alloc_path(); in btrfs_log_all_parents()
5771 if (!path) in btrfs_log_all_parents()
5773 path->skip_locking = 1; in btrfs_log_all_parents()
5774 path->search_commit_root = 1; in btrfs_log_all_parents()
5779 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_all_parents()
5784 struct extent_buffer *leaf = path->nodes[0]; in btrfs_log_all_parents()
5785 int slot = path->slots[0]; in btrfs_log_all_parents()
5791 ret = btrfs_next_leaf(root, path); in btrfs_log_all_parents()
5872 path->slots[0]++; in btrfs_log_all_parents()
5876 btrfs_free_path(path); in btrfs_log_all_parents()
5882 struct btrfs_path *path, in log_new_ancestors() argument
5887 btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); in log_new_ancestors()
5892 struct extent_buffer *leaf = path->nodes[0]; in log_new_ancestors()
5893 int slot = path->slots[0]; in log_new_ancestors()
5898 btrfs_release_path(path); in log_new_ancestors()
5919 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in log_new_ancestors()
5923 leaf = path->nodes[0]; in log_new_ancestors()
5924 slot = path->slots[0]; in log_new_ancestors()
5926 ret = btrfs_next_leaf(root, path); in log_new_ancestors()
5931 leaf = path->nodes[0]; in log_new_ancestors()
5932 slot = path->slots[0]; in log_new_ancestors()
5988 struct btrfs_path *path; in log_all_new_ancestors() local
5999 path = btrfs_alloc_path(); in log_all_new_ancestors()
6000 if (!path) in log_all_new_ancestors()
6007 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in log_all_new_ancestors()
6011 path->slots[0]++; in log_all_new_ancestors()
6014 struct extent_buffer *leaf = path->nodes[0]; in log_all_new_ancestors()
6015 int slot = path->slots[0]; in log_all_new_ancestors()
6019 ret = btrfs_next_leaf(root, path); in log_all_new_ancestors()
6052 ret = log_new_ancestors(trans, root, path, ctx); in log_all_new_ancestors()
6055 btrfs_release_path(path); in log_all_new_ancestors()
6060 btrfs_free_path(path); in log_all_new_ancestors()
6244 struct btrfs_path *path; in btrfs_recover_log_trees() local
6256 path = btrfs_alloc_path(); in btrfs_recover_log_trees()
6257 if (!path) in btrfs_recover_log_trees()
6284 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0); in btrfs_recover_log_trees()
6292 if (path->slots[0] == 0) in btrfs_recover_log_trees()
6294 path->slots[0]--; in btrfs_recover_log_trees()
6296 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in btrfs_recover_log_trees()
6297 path->slots[0]); in btrfs_recover_log_trees()
6298 btrfs_release_path(path); in btrfs_recover_log_trees()
6331 path); in btrfs_recover_log_trees()
6337 btrfs_release_path(path); in btrfs_recover_log_trees()
6363 btrfs_release_path(path); in btrfs_recover_log_trees()
6378 btrfs_free_path(path); in btrfs_recover_log_trees()
6394 btrfs_free_path(path); in btrfs_recover_log_trees()