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()
824 btrfs_release_path(path); in replay_one_extent()
828 ret = overwrite_item(trans, root, path, eb, slot, key); in replay_one_extent()
852 struct btrfs_path *path, in drop_one_dir_item() argument
863 leaf = path->nodes[0]; in drop_one_dir_item()
872 btrfs_release_path(path); in drop_one_dir_item()
880 ret = link_to_fixup_dir(trans, root, path, location.objectid); in drop_one_dir_item()
902 struct btrfs_path *path, in inode_in_dir() argument
910 di = btrfs_lookup_dir_index_item(NULL, root, path, dirid, in inode_in_dir()
913 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &location); in inode_in_dir()
918 btrfs_release_path(path); in inode_in_dir()
920 di = btrfs_lookup_dir_item(NULL, root, path, dirid, name, name_len, 0); in inode_in_dir()
922 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &location); in inode_in_dir()
929 btrfs_release_path(path); in inode_in_dir()
948 struct btrfs_path *path; in backref_in_log() local
958 path = btrfs_alloc_path(); in backref_in_log()
959 if (!path) in backref_in_log()
962 ret = btrfs_search_slot(NULL, log, key, path, 0, 0); in backref_in_log()
966 ptr = btrfs_item_ptr_offset(path->nodes[0], path->slots[0]); in backref_in_log()
969 if (btrfs_find_name_in_ext_backref(path->nodes[0], in backref_in_log()
970 path->slots[0], in backref_in_log()
978 item_size = btrfs_item_size_nr(path->nodes[0], path->slots[0]); in backref_in_log()
982 found_name_len = btrfs_inode_ref_name_len(path->nodes[0], ref); in backref_in_log()
985 ret = memcmp_extent_buffer(path->nodes[0], name, in backref_in_log()
995 btrfs_free_path(path); in backref_in_log()
1001 struct btrfs_path *path, in __add_inode_ref() argument
1022 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in __add_inode_ref()
1028 leaf = path->nodes[0]; in __add_inode_ref()
1040 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in __add_inode_ref()
1041 ptr_end = ptr + btrfs_item_size_nr(leaf, path->slots[0]); in __add_inode_ref()
1059 btrfs_release_path(path); in __add_inode_ref()
1083 btrfs_release_path(path); in __add_inode_ref()
1086 extref = btrfs_lookup_inode_extref(NULL, root, path, name, namelen, in __add_inode_ref()
1095 leaf = path->nodes[0]; in __add_inode_ref()
1097 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in __add_inode_ref()
1098 base = btrfs_item_ptr_offset(leaf, path->slots[0]); in __add_inode_ref()
1128 btrfs_release_path(path); in __add_inode_ref()
1152 btrfs_release_path(path); in __add_inode_ref()
1155 di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir), in __add_inode_ref()
1158 ret = drop_one_dir_item(trans, root, path, dir, di); in __add_inode_ref()
1162 btrfs_release_path(path); in __add_inode_ref()
1165 di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir), in __add_inode_ref()
1168 ret = drop_one_dir_item(trans, root, path, dir, di); in __add_inode_ref()
1172 btrfs_release_path(path); in __add_inode_ref()
1230 struct btrfs_path *path, in unlink_old_inode_refs() argument
1242 btrfs_release_path(path); in unlink_old_inode_refs()
1243 ret = btrfs_search_slot(NULL, root, key, path, 0, 0); in unlink_old_inode_refs()
1251 eb = path->nodes[0]; in unlink_old_inode_refs()
1252 ref_ptr = btrfs_item_ptr_offset(eb, path->slots[0]); in unlink_old_inode_refs()
1253 ref_end = ref_ptr + btrfs_item_size_nr(eb, path->slots[0]); in unlink_old_inode_refs()
1281 btrfs_release_path(path); in unlink_old_inode_refs()
1306 btrfs_release_path(path); in unlink_old_inode_refs()
1315 struct btrfs_path *path; in btrfs_inode_ref_exists() local
1319 path = btrfs_alloc_path(); in btrfs_inode_ref_exists()
1320 if (!path) in btrfs_inode_ref_exists()
1330 ret = btrfs_search_slot(NULL, BTRFS_I(inode)->root, &key, path, 0, 0); in btrfs_inode_ref_exists()
1338 ret = !!btrfs_find_name_in_ext_backref(path->nodes[0], in btrfs_inode_ref_exists()
1339 path->slots[0], parent_id, name, namelen); in btrfs_inode_ref_exists()
1341 ret = !!btrfs_find_name_in_backref(path->nodes[0], path->slots[0], in btrfs_inode_ref_exists()
1345 btrfs_free_path(path); in btrfs_inode_ref_exists()
1355 struct btrfs_path *path; in add_link() local
1359 path = btrfs_alloc_path(); in add_link()
1360 if (!path) in add_link()
1363 dir_item = btrfs_lookup_dir_item(NULL, root, path, in add_link()
1367 btrfs_release_path(path); in add_link()
1379 btrfs_dir_item_key_to_cpu(path->nodes[0], dir_item, &key); in add_link()
1380 btrfs_release_path(path); in add_link()
1405 btrfs_free_path(path); in add_link()
1419 struct btrfs_path *path, in add_inode_ref() argument
1493 if (!inode_in_dir(root, path, btrfs_ino(BTRFS_I(dir)), in add_inode_ref()
1505 ret = __add_inode_ref(trans, root, path, log, in add_inode_ref()
1571 ret = unlink_old_inode_refs(trans, root, path, BTRFS_I(inode), eb, slot, in add_inode_ref()
1577 ret = overwrite_item(trans, root, path, eb, slot, key); in add_inode_ref()
1579 btrfs_release_path(path); in add_inode_ref()
1599 struct btrfs_inode *inode, struct btrfs_path *path) in count_inode_extrefs() argument
1613 ret = btrfs_find_one_extref(root, inode_objectid, offset, path, in count_inode_extrefs()
1618 leaf = path->nodes[0]; in count_inode_extrefs()
1619 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in count_inode_extrefs()
1620 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in count_inode_extrefs()
1633 btrfs_release_path(path); in count_inode_extrefs()
1635 btrfs_release_path(path); in count_inode_extrefs()
1643 struct btrfs_inode *inode, struct btrfs_path *path) in count_inode_refs() argument
1658 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in count_inode_refs()
1662 if (path->slots[0] == 0) in count_inode_refs()
1664 path->slots[0]--; in count_inode_refs()
1667 btrfs_item_key_to_cpu(path->nodes[0], &key, in count_inode_refs()
1668 path->slots[0]); in count_inode_refs()
1672 ptr = btrfs_item_ptr_offset(path->nodes[0], path->slots[0]); in count_inode_refs()
1673 ptr_end = ptr + btrfs_item_size_nr(path->nodes[0], in count_inode_refs()
1674 path->slots[0]); in count_inode_refs()
1679 name_len = btrfs_inode_ref_name_len(path->nodes[0], in count_inode_refs()
1687 if (path->slots[0] > 0) { in count_inode_refs()
1688 path->slots[0]--; in count_inode_refs()
1692 btrfs_release_path(path); in count_inode_refs()
1694 btrfs_release_path(path); in count_inode_refs()
1713 struct btrfs_path *path; in fixup_inode_link_count() local
1718 path = btrfs_alloc_path(); in fixup_inode_link_count()
1719 if (!path) in fixup_inode_link_count()
1722 ret = count_inode_refs(root, BTRFS_I(inode), path); in fixup_inode_link_count()
1728 ret = count_inode_extrefs(root, BTRFS_I(inode), path); in fixup_inode_link_count()
1744 ret = replay_dir_deletes(trans, root, NULL, path, in fixup_inode_link_count()
1753 btrfs_free_path(path); in fixup_inode_link_count()
1759 struct btrfs_path *path) in fixup_inode_link_counts() argument
1769 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in fixup_inode_link_counts()
1774 if (path->slots[0] == 0) in fixup_inode_link_counts()
1776 path->slots[0]--; in fixup_inode_link_counts()
1779 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in fixup_inode_link_counts()
1784 ret = btrfs_del_item(trans, root, path); in fixup_inode_link_counts()
1788 btrfs_release_path(path); in fixup_inode_link_counts()
1807 btrfs_release_path(path); in fixup_inode_link_counts()
1819 struct btrfs_path *path, in link_to_fixup_dir() argument
1834 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in link_to_fixup_dir()
1836 btrfs_release_path(path); in link_to_fixup_dir()
1930 struct btrfs_path *path, in replay_one_name() argument
1963 exists = btrfs_lookup_inode(trans, root, path, &log_key, 0); in replay_one_name()
1968 btrfs_release_path(path); in replay_one_name()
1971 dst_di = btrfs_lookup_dir_item(trans, root, path, key->objectid, in replay_one_name()
1974 dst_di = btrfs_lookup_dir_index_item(trans, root, path, in replay_one_name()
1992 btrfs_dir_item_key_to_cpu(path->nodes[0], dst_di, &found_key); in replay_one_name()
1997 btrfs_dir_type(path->nodes[0], dst_di) == log_type) { in replay_one_name()
2009 ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), dst_di); in replay_one_name()
2016 btrfs_release_path(path); in replay_one_name()
2035 btrfs_release_path(path); in replay_one_name()
2055 struct btrfs_path *path, in replay_one_dir_item() argument
2072 ret = replay_one_name(trans, root, path, eb, di, key); in replay_one_dir_item()
2140 struct btrfs_path *path, in find_dir_range() argument
2157 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in find_dir_range()
2161 if (path->slots[0] == 0) in find_dir_range()
2163 path->slots[0]--; in find_dir_range()
2166 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in find_dir_range()
2172 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in find_dir_range()
2174 found_end = btrfs_dir_log_end(path->nodes[0], item); in find_dir_range()
2185 nritems = btrfs_header_nritems(path->nodes[0]); in find_dir_range()
2186 path->slots[0]++; in find_dir_range()
2187 if (path->slots[0] >= nritems) { in find_dir_range()
2188 ret = btrfs_next_leaf(root, path); in find_dir_range()
2193 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in find_dir_range()
2199 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in find_dir_range()
2201 found_end = btrfs_dir_log_end(path->nodes[0], item); in find_dir_range()
2206 btrfs_release_path(path); in find_dir_range()
2218 struct btrfs_path *path, in check_item_in_log() argument
2237 eb = path->nodes[0]; in check_item_in_log()
2238 slot = path->slots[0]; in check_item_in_log()
2266 btrfs_release_path(path); in check_item_in_log()
2275 path, location.objectid); in check_item_in_log()
2295 ret = btrfs_search_slot(NULL, root, dir_key, path, in check_item_in_log()
2313 btrfs_release_path(path); in check_item_in_log()
2321 struct btrfs_path *path, in replay_xattr_deletes() argument
2338 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in replay_xattr_deletes()
2342 nritems = btrfs_header_nritems(path->nodes[0]); in replay_xattr_deletes()
2343 for (i = path->slots[0]; i < nritems; i++) { in replay_xattr_deletes()
2350 btrfs_item_key_to_cpu(path->nodes[0], &key, i); in replay_xattr_deletes()
2356 di = btrfs_item_ptr(path->nodes[0], i, struct btrfs_dir_item); in replay_xattr_deletes()
2357 total_size = btrfs_item_size_nr(path->nodes[0], i); in replay_xattr_deletes()
2360 u16 name_len = btrfs_dir_name_len(path->nodes[0], di); in replay_xattr_deletes()
2361 u16 data_len = btrfs_dir_data_len(path->nodes[0], di); in replay_xattr_deletes()
2370 read_extent_buffer(path->nodes[0], name, in replay_xattr_deletes()
2378 btrfs_release_path(path); in replay_xattr_deletes()
2379 di = btrfs_lookup_xattr(trans, root, path, ino, in replay_xattr_deletes()
2388 path, di); in replay_xattr_deletes()
2391 btrfs_release_path(path); in replay_xattr_deletes()
2404 ret = btrfs_next_leaf(root, path); in replay_xattr_deletes()
2411 btrfs_release_path(path); in replay_xattr_deletes()
2429 struct btrfs_path *path, in replay_dir_deletes() argument
2463 ret = find_dir_range(log, path, dirid, key_type, in replay_dir_deletes()
2472 ret = btrfs_search_slot(NULL, root, &dir_key, path, in replay_dir_deletes()
2477 nritems = btrfs_header_nritems(path->nodes[0]); in replay_dir_deletes()
2478 if (path->slots[0] >= nritems) { in replay_dir_deletes()
2479 ret = btrfs_next_leaf(root, path); in replay_dir_deletes()
2485 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in replay_dir_deletes()
2486 path->slots[0]); in replay_dir_deletes()
2494 ret = check_item_in_log(trans, root, log, path, in replay_dir_deletes()
2503 btrfs_release_path(path); in replay_dir_deletes()
2514 btrfs_release_path(path); in replay_dir_deletes()
2518 btrfs_release_path(path); in replay_dir_deletes()
2539 struct btrfs_path *path; in replay_one_buffer() local
2554 path = btrfs_alloc_path(); in replay_one_buffer()
2555 if (!path) in replay_one_buffer()
2585 path, key.objectid); in replay_one_buffer()
2591 root, log, path, key.objectid, 0); in replay_one_buffer()
2595 ret = overwrite_item(wc->trans, root, path, in replay_one_buffer()
2632 path, key.objectid); in replay_one_buffer()
2642 ret = replay_one_dir_item(wc->trans, root, path, in replay_one_buffer()
2653 ret = overwrite_item(wc->trans, root, path, in replay_one_buffer()
2659 ret = add_inode_ref(wc->trans, root, log, path, in replay_one_buffer()
2665 ret = replay_one_extent(wc->trans, root, path, in replay_one_buffer()
2670 ret = replay_one_dir_item(wc->trans, root, path, in replay_one_buffer()
2676 btrfs_free_path(path); in replay_one_buffer()
2682 struct btrfs_path *path, int *level, in walk_down_log_tree() argument
2703 cur = path->nodes[*level]; in walk_down_log_tree()
2707 if (path->slots[*level] >= in walk_down_log_tree()
2711 bytenr = btrfs_node_blockptr(cur, path->slots[*level]); in walk_down_log_tree()
2712 ptr_gen = btrfs_node_ptr_generation(cur, path->slots[*level]); in walk_down_log_tree()
2713 btrfs_node_key_to_cpu(cur, &first_key, path->slots[*level]); in walk_down_log_tree()
2716 parent = path->nodes[*level]; in walk_down_log_tree()
2731 path->slots[*level]++; in walk_down_log_tree()
2771 if (path->nodes[*level-1]) in walk_down_log_tree()
2772 free_extent_buffer(path->nodes[*level-1]); in walk_down_log_tree()
2773 path->nodes[*level-1] = next; in walk_down_log_tree()
2775 path->slots[*level] = 0; in walk_down_log_tree()
2781 path->slots[*level] = btrfs_header_nritems(path->nodes[*level]); in walk_down_log_tree()
2789 struct btrfs_path *path, int *level, in walk_up_log_tree() argument
2798 for (i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) { in walk_up_log_tree()
2799 slot = path->slots[i]; in walk_up_log_tree()
2800 if (slot + 1 < btrfs_header_nritems(path->nodes[i])) { in walk_up_log_tree()
2801 path->slots[i]++; in walk_up_log_tree()
2807 if (path->nodes[*level] == root->node) in walk_up_log_tree()
2808 parent = path->nodes[*level]; in walk_up_log_tree()
2810 parent = path->nodes[*level + 1]; in walk_up_log_tree()
2813 ret = wc->process_func(root, path->nodes[*level], wc, in walk_up_log_tree()
2814 btrfs_header_generation(path->nodes[*level]), in walk_up_log_tree()
2822 next = path->nodes[*level]; in walk_up_log_tree()
2838 path->nodes[*level]->start, in walk_up_log_tree()
2839 path->nodes[*level]->len); in walk_up_log_tree()
2843 free_extent_buffer(path->nodes[*level]); in walk_up_log_tree()
2844 path->nodes[*level] = NULL; in walk_up_log_tree()
2863 struct btrfs_path *path; in walk_log_tree() local
2866 path = btrfs_alloc_path(); in walk_log_tree()
2867 if (!path) in walk_log_tree()
2872 path->nodes[level] = log->node; in walk_log_tree()
2874 path->slots[level] = 0; in walk_log_tree()
2877 wret = walk_down_log_tree(trans, log, path, &level, wc); in walk_log_tree()
2885 wret = walk_up_log_tree(trans, log, path, &level, wc); in walk_log_tree()
2895 if (path->nodes[orig_level]) { in walk_log_tree()
2896 ret = wc->process_func(log, path->nodes[orig_level], wc, in walk_log_tree()
2897 btrfs_header_generation(path->nodes[orig_level]), in walk_log_tree()
2904 next = path->nodes[orig_level]; in walk_log_tree()
2927 btrfs_free_path(path); in walk_log_tree()
3396 struct btrfs_path *path; in btrfs_del_dir_entries_in_log() local
3412 path = btrfs_alloc_path(); in btrfs_del_dir_entries_in_log()
3413 if (!path) { in btrfs_del_dir_entries_in_log()
3418 di = btrfs_lookup_dir_item(trans, log, path, dir_ino, in btrfs_del_dir_entries_in_log()
3425 ret = btrfs_delete_one_dir_name(trans, log, path, di); in btrfs_del_dir_entries_in_log()
3432 btrfs_release_path(path); in btrfs_del_dir_entries_in_log()
3433 di = btrfs_lookup_dir_index_item(trans, log, path, dir_ino, in btrfs_del_dir_entries_in_log()
3440 ret = btrfs_delete_one_dir_name(trans, log, path, di); in btrfs_del_dir_entries_in_log()
3457 btrfs_release_path(path); in btrfs_del_dir_entries_in_log()
3459 ret = btrfs_search_slot(trans, log, &key, path, 0, 1); in btrfs_del_dir_entries_in_log()
3468 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_del_dir_entries_in_log()
3470 i_size = btrfs_inode_size(path->nodes[0], item); in btrfs_del_dir_entries_in_log()
3475 btrfs_set_inode_size(path->nodes[0], item, i_size); in btrfs_del_dir_entries_in_log()
3476 btrfs_mark_buffer_dirty(path->nodes[0]); in btrfs_del_dir_entries_in_log()
3479 btrfs_release_path(path); in btrfs_del_dir_entries_in_log()
3482 btrfs_free_path(path); in btrfs_del_dir_entries_in_log()
3535 struct btrfs_path *path, in insert_dir_log_key() argument
3549 ret = btrfs_insert_empty_item(trans, log, path, &key, sizeof(*item)); in insert_dir_log_key()
3553 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in insert_dir_log_key()
3555 btrfs_set_dir_log_end(path->nodes[0], item, last_offset); in insert_dir_log_key()
3556 btrfs_mark_buffer_dirty(path->nodes[0]); in insert_dir_log_key()
3557 btrfs_release_path(path); in insert_dir_log_key()
3568 struct btrfs_path *path, in log_dir_items() argument
3590 ret = btrfs_search_forward(root, &min_key, path, trans->transid); in log_dir_items()
3600 btrfs_release_path(path); in log_dir_items()
3601 ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0); in log_dir_items()
3603 btrfs_release_path(path); in log_dir_items()
3606 ret = btrfs_previous_item(root, path, ino, key_type); in log_dir_items()
3615 btrfs_item_key_to_cpu(path->nodes[0], &tmp, in log_dir_items()
3616 path->slots[0]); in log_dir_items()
3624 ret = btrfs_previous_item(root, path, ino, key_type); in log_dir_items()
3627 btrfs_item_key_to_cpu(path->nodes[0], &tmp, path->slots[0]); in log_dir_items()
3631 path->nodes[0], path->slots[0], in log_dir_items()
3639 btrfs_release_path(path); in log_dir_items()
3649 ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0); in log_dir_items()
3659 src = path->nodes[0]; in log_dir_items()
3661 for (i = path->slots[0]; i < nritems; i++) { in log_dir_items()
3706 path->slots[0] = nritems; in log_dir_items()
3712 ret = btrfs_next_leaf(root, path); in log_dir_items()
3720 btrfs_item_key_to_cpu(path->nodes[0], &tmp, path->slots[0]); in log_dir_items()
3725 if (btrfs_header_generation(path->nodes[0]) != trans->transid) { in log_dir_items()
3727 path->nodes[0], path->slots[0], in log_dir_items()
3737 btrfs_release_path(path); in log_dir_items()
3746 ret = insert_dir_log_key(trans, log, path, key_type, in log_dir_items()
3768 struct btrfs_path *path, in log_directory_changes() argument
3781 ret = log_dir_items(trans, root, inode, path, dst_path, key_type, in log_directory_changes()
3805 struct btrfs_path *path, in drop_objectid_items() argument
3818 ret = btrfs_search_slot(trans, log, &key, path, -1, 1); in drop_objectid_items()
3823 if (path->slots[0] == 0) in drop_objectid_items()
3826 path->slots[0]--; in drop_objectid_items()
3827 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in drop_objectid_items()
3828 path->slots[0]); in drop_objectid_items()
3835 ret = btrfs_bin_search(path->nodes[0], &found_key, 0, in drop_objectid_items()
3840 ret = btrfs_del_items(trans, log, path, start_slot, in drop_objectid_items()
3841 path->slots[0] - start_slot + 1); in drop_objectid_items()
3848 btrfs_release_path(path); in drop_objectid_items()
3850 btrfs_release_path(path); in drop_objectid_items()
3913 struct btrfs_root *log, struct btrfs_path *path, in log_inode_item() argument
3919 ret = btrfs_insert_empty_item(trans, log, path, in log_inode_item()
3923 inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0], in log_inode_item()
3925 fill_inode_item(trans, path->nodes[0], inode_item, &inode->vfs_inode, in log_inode_item()
3927 btrfs_release_path(path); in log_inode_item()
4329 struct btrfs_path *path, in log_one_extent() argument
4346 ret = __btrfs_drop_extents(trans, log, &inode->vfs_inode, path, em->start, in log_one_extent()
4357 ret = btrfs_insert_empty_item(trans, log, path, &key, in log_one_extent()
4362 leaf = path->nodes[0]; in log_one_extent()
4364 fi = btrfs_item_ptr(leaf, path->slots[0], in log_one_extent()
4406 btrfs_release_path(path); in log_one_extent()
4421 struct btrfs_path *path) in btrfs_log_prealloc_extents() argument
4439 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_prealloc_extents()
4444 struct extent_buffer *leaf = path->nodes[0]; in btrfs_log_prealloc_extents()
4445 int slot = path->slots[0]; in btrfs_log_prealloc_extents()
4449 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_prealloc_extents()
4456 ret = btrfs_next_leaf(root, path); in btrfs_log_prealloc_extents()
4472 path->slots[0]++; in btrfs_log_prealloc_extents()
4494 path->slots[0]++; in btrfs_log_prealloc_extents()
4504 ret = copy_items(trans, inode, dst_path, path, &last_extent, in btrfs_log_prealloc_extents()
4510 btrfs_release_path(path); in btrfs_log_prealloc_extents()
4518 struct btrfs_path *path, in btrfs_log_changed_extents() argument
4600 ret = log_one_extent(trans, inode, root, em, path, ctx); in btrfs_log_changed_extents()
4608 btrfs_release_path(path); in btrfs_log_changed_extents()
4610 ret = btrfs_log_prealloc_extents(trans, inode, path); in btrfs_log_changed_extents()
4616 struct btrfs_path *path, u64 *size_ret) in logged_inode_size() argument
4625 ret = btrfs_search_slot(NULL, log, &key, path, 0, 0); in logged_inode_size()
4633 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in logged_inode_size()
4635 *size_ret = btrfs_inode_size(path->nodes[0], item); in logged_inode_size()
4651 btrfs_release_path(path); in logged_inode_size()
4667 struct btrfs_path *path, in btrfs_log_all_xattrs() argument
4680 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_all_xattrs()
4685 int slot = path->slots[0]; in btrfs_log_all_xattrs()
4686 struct extent_buffer *leaf = path->nodes[0]; in btrfs_log_all_xattrs()
4693 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_all_xattrs()
4702 ret = btrfs_next_leaf(root, path); in btrfs_log_all_xattrs()
4717 path->slots[0]++; in btrfs_log_all_xattrs()
4723 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_all_xattrs()
4762 struct btrfs_path *path) in btrfs_log_trailing_hole() argument
4781 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_trailing_hole()
4786 ASSERT(path->slots[0] > 0); in btrfs_log_trailing_hole()
4787 path->slots[0]--; in btrfs_log_trailing_hole()
4788 leaf = path->nodes[0]; in btrfs_log_trailing_hole()
4789 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_log_trailing_hole()
4806 extent = btrfs_item_ptr(leaf, path->slots[0], in btrfs_log_trailing_hole()
4820 btrfs_release_path(path); in btrfs_log_trailing_hole()
4975 struct btrfs_path *path, in log_conflicting_inodes() argument
5004 btrfs_release_path(path); in log_conflicting_inodes()
5050 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in log_conflicting_inodes()
5057 struct extent_buffer *leaf = path->nodes[0]; in log_conflicting_inodes()
5058 int slot = path->slots[0]; in log_conflicting_inodes()
5063 ret = btrfs_next_leaf(root, path); in log_conflicting_inodes()
5097 path->slots[0]++; in log_conflicting_inodes()
5127 struct btrfs_path *path; in btrfs_log_inode() local
5146 path = btrfs_alloc_path(); in btrfs_log_inode()
5147 if (!path) in btrfs_log_inode()
5151 btrfs_free_path(path); in btrfs_log_inode()
5185 btrfs_free_path(path); in btrfs_log_inode()
5210 ret = drop_objectid_items(trans, log, path, ino, max_key_type); in btrfs_log_inode()
5226 err = logged_inode_size(log, inode, path, &logged_isize); in btrfs_log_inode()
5234 ret = drop_objectid_items(trans, log, path, ino, in btrfs_log_inode()
5254 ret = drop_objectid_items(trans, log, path, ino, in btrfs_log_inode()
5271 path, trans->transid); in btrfs_log_inode()
5295 ret = btrfs_check_ref_name_override(path->nodes[0], in btrfs_log_inode()
5296 path->slots[0], &min_key, inode, in btrfs_log_inode()
5307 ins_start_slot = path->slots[0]; in btrfs_log_inode()
5309 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_inode()
5319 err = log_conflicting_inodes(trans, root, path, in btrfs_log_inode()
5323 btrfs_release_path(path); in btrfs_log_inode()
5332 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_inode()
5341 btrfs_release_path(path); in btrfs_log_inode()
5347 if (ins_nr && ins_start_slot + ins_nr == path->slots[0]) { in btrfs_log_inode()
5351 ins_start_slot = path->slots[0]; in btrfs_log_inode()
5356 ret = copy_items(trans, inode, dst_path, path, &last_extent, in btrfs_log_inode()
5365 btrfs_release_path(path); in btrfs_log_inode()
5369 ins_start_slot = path->slots[0]; in btrfs_log_inode()
5372 nritems = btrfs_header_nritems(path->nodes[0]); in btrfs_log_inode()
5373 path->slots[0]++; in btrfs_log_inode()
5374 if (path->slots[0] < nritems) { in btrfs_log_inode()
5375 btrfs_item_key_to_cpu(path->nodes[0], &min_key, in btrfs_log_inode()
5376 path->slots[0]); in btrfs_log_inode()
5380 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_inode()
5390 btrfs_release_path(path); in btrfs_log_inode()
5402 ret = copy_items(trans, inode, dst_path, path, &last_extent, in btrfs_log_inode()
5413 btrfs_release_path(path); in btrfs_log_inode()
5415 err = btrfs_log_all_xattrs(trans, root, inode, path, dst_path); in btrfs_log_inode()
5420 btrfs_release_path(path); in btrfs_log_inode()
5422 err = btrfs_log_trailing_hole(trans, root, inode, path); in btrfs_log_inode()
5427 btrfs_release_path(path); in btrfs_log_inode()
5432 err = btrfs_log_all_xattrs(trans, root, inode, path, in btrfs_log_inode()
5434 btrfs_release_path(path); in btrfs_log_inode()
5479 ret = log_directory_changes(trans, root, inode, path, dst_path, in btrfs_log_inode()
5504 btrfs_free_path(path); in btrfs_log_inode()
5658 struct btrfs_path *path; in log_new_dir_dentries() local
5663 path = btrfs_alloc_path(); in log_new_dir_dentries()
5664 if (!path) in log_new_dir_dentries()
5669 btrfs_free_path(path); in log_new_dir_dentries()
5690 btrfs_release_path(path); in log_new_dir_dentries()
5691 ret = btrfs_search_forward(log, &min_key, path, trans->transid); in log_new_dir_dentries()
5700 leaf = path->nodes[0]; in log_new_dir_dentries()
5702 for (i = path->slots[0]; i < nritems; i++) { in log_new_dir_dentries()
5724 btrfs_release_path(path); in log_new_dir_dentries()
5760 ret = btrfs_next_leaf(log, path); in log_new_dir_dentries()
5778 btrfs_free_path(path); in log_new_dir_dentries()
5788 struct btrfs_path *path; in btrfs_log_all_parents() local
5793 path = btrfs_alloc_path(); in btrfs_log_all_parents()
5794 if (!path) in btrfs_log_all_parents()
5796 path->skip_locking = 1; in btrfs_log_all_parents()
5797 path->search_commit_root = 1; in btrfs_log_all_parents()
5802 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_all_parents()
5807 struct extent_buffer *leaf = path->nodes[0]; in btrfs_log_all_parents()
5808 int slot = path->slots[0]; in btrfs_log_all_parents()
5814 ret = btrfs_next_leaf(root, path); in btrfs_log_all_parents()
5895 path->slots[0]++; in btrfs_log_all_parents()
5899 btrfs_free_path(path); in btrfs_log_all_parents()
5905 struct btrfs_path *path, in log_new_ancestors() argument
5910 btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); in log_new_ancestors()
5915 struct extent_buffer *leaf = path->nodes[0]; in log_new_ancestors()
5916 int slot = path->slots[0]; in log_new_ancestors()
5921 btrfs_release_path(path); in log_new_ancestors()
5942 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in log_new_ancestors()
5946 leaf = path->nodes[0]; in log_new_ancestors()
5947 slot = path->slots[0]; in log_new_ancestors()
5949 ret = btrfs_next_leaf(root, path); in log_new_ancestors()
5954 leaf = path->nodes[0]; in log_new_ancestors()
5955 slot = path->slots[0]; in log_new_ancestors()
6011 struct btrfs_path *path; in log_all_new_ancestors() local
6022 path = btrfs_alloc_path(); in log_all_new_ancestors()
6023 if (!path) in log_all_new_ancestors()
6030 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in log_all_new_ancestors()
6034 path->slots[0]++; in log_all_new_ancestors()
6037 struct extent_buffer *leaf = path->nodes[0]; in log_all_new_ancestors()
6038 int slot = path->slots[0]; in log_all_new_ancestors()
6042 ret = btrfs_next_leaf(root, path); in log_all_new_ancestors()
6075 ret = log_new_ancestors(trans, root, path, ctx); in log_all_new_ancestors()
6078 btrfs_release_path(path); in log_all_new_ancestors()
6083 btrfs_free_path(path); in log_all_new_ancestors()
6267 struct btrfs_path *path; in btrfs_recover_log_trees() local
6279 path = btrfs_alloc_path(); in btrfs_recover_log_trees()
6280 if (!path) in btrfs_recover_log_trees()
6307 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0); in btrfs_recover_log_trees()
6315 if (path->slots[0] == 0) in btrfs_recover_log_trees()
6317 path->slots[0]--; in btrfs_recover_log_trees()
6319 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in btrfs_recover_log_trees()
6320 path->slots[0]); in btrfs_recover_log_trees()
6321 btrfs_release_path(path); in btrfs_recover_log_trees()
6373 path); in btrfs_recover_log_trees()
6379 btrfs_release_path(path); in btrfs_recover_log_trees()
6405 btrfs_release_path(path); in btrfs_recover_log_trees()
6420 btrfs_free_path(path); in btrfs_recover_log_trees()
6436 btrfs_free_path(path); in btrfs_recover_log_trees()