Lines Matching refs:path

102 			     struct btrfs_path *path, u64 objectid);
106 struct btrfs_path *path,
373 struct btrfs_path *path, in do_overwrite_item() argument
393 ASSERT(path->nodes[0] != NULL); in do_overwrite_item()
399 if (path->slots[0] < btrfs_header_nritems(path->nodes[0])) { in do_overwrite_item()
402 btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); in do_overwrite_item()
412 u32 dst_size = btrfs_item_size_nr(path->nodes[0], in do_overwrite_item()
413 path->slots[0]); in do_overwrite_item()
418 btrfs_release_path(path); in do_overwrite_item()
424 btrfs_release_path(path); in do_overwrite_item()
432 dst_ptr = btrfs_item_ptr_offset(path->nodes[0], path->slots[0]); in do_overwrite_item()
433 read_extent_buffer(path->nodes[0], dst_copy, dst_ptr, in do_overwrite_item()
446 btrfs_release_path(path); in do_overwrite_item()
459 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in do_overwrite_item()
461 nbytes = btrfs_inode_nbytes(path->nodes[0], item); in do_overwrite_item()
496 btrfs_release_path(path); in do_overwrite_item()
498 path->skip_release_on_error = 1; in do_overwrite_item()
499 ret = btrfs_insert_empty_item(trans, root, path, in do_overwrite_item()
501 path->skip_release_on_error = 0; in do_overwrite_item()
506 found_size = btrfs_item_size_nr(path->nodes[0], in do_overwrite_item()
507 path->slots[0]); in do_overwrite_item()
509 btrfs_truncate_item(path, item_size, 1); in do_overwrite_item()
511 btrfs_extend_item(path, item_size - found_size); in do_overwrite_item()
515 dst_ptr = btrfs_item_ptr_offset(path->nodes[0], in do_overwrite_item()
516 path->slots[0]); in do_overwrite_item()
535 struct extent_buffer *dst_eb = path->nodes[0]; in do_overwrite_item()
554 S_ISDIR(btrfs_inode_mode(path->nodes[0], dst_item))) { in do_overwrite_item()
556 saved_i_size = btrfs_inode_size(path->nodes[0], in do_overwrite_item()
561 copy_extent_buffer(path->nodes[0], eb, dst_ptr, in do_overwrite_item()
567 btrfs_set_inode_size(path->nodes[0], dst_item, saved_i_size); in do_overwrite_item()
574 if (btrfs_inode_generation(path->nodes[0], dst_item) == 0) { in do_overwrite_item()
575 btrfs_set_inode_generation(path->nodes[0], dst_item, in do_overwrite_item()
580 btrfs_mark_buffer_dirty(path->nodes[0]); in do_overwrite_item()
581 btrfs_release_path(path); in do_overwrite_item()
601 struct btrfs_path *path, in overwrite_item() argument
608 ret = btrfs_search_slot(NULL, root, key, path, 0, 0); in overwrite_item()
612 return do_overwrite_item(trans, root, path, eb, slot, key); in overwrite_item()
644 struct btrfs_path *path, in replay_one_extent() argument
694 ret = btrfs_lookup_file_extent(trans, root, path, in replay_one_extent()
705 leaf = path->nodes[0]; in replay_one_extent()
706 existing = btrfs_item_ptr(leaf, path->slots[0], in replay_one_extent()
719 btrfs_release_path(path); in replay_one_extent()
723 btrfs_release_path(path); in replay_one_extent()
743 ret = btrfs_insert_empty_item(trans, root, path, key, in replay_one_extent()
747 dest_offset = btrfs_item_ptr_offset(path->nodes[0], in replay_one_extent()
748 path->slots[0]); in replay_one_extent()
749 copy_extent_buffer(path->nodes[0], eb, dest_offset, in replay_one_extent()
807 btrfs_release_path(path); in replay_one_extent()
892 btrfs_release_path(path); in replay_one_extent()
896 ret = overwrite_item(trans, root, path, eb, slot, key); in replay_one_extent()
924 struct btrfs_path *path, in drop_one_dir_item() argument
936 leaf = path->nodes[0]; in drop_one_dir_item()
945 btrfs_release_path(path); in drop_one_dir_item()
953 ret = link_to_fixup_dir(trans, root, path, location.objectid); in drop_one_dir_item()
977 struct btrfs_path *path, in inode_in_dir() argument
985 di = btrfs_lookup_dir_index_item(NULL, root, path, dirid, in inode_in_dir()
991 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &location); in inode_in_dir()
998 btrfs_release_path(path); in inode_in_dir()
999 di = btrfs_lookup_dir_item(NULL, root, path, dirid, name, name_len, 0); in inode_in_dir()
1004 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &location); in inode_in_dir()
1009 btrfs_release_path(path); in inode_in_dir()
1028 struct btrfs_path *path; in backref_in_log() local
1031 path = btrfs_alloc_path(); in backref_in_log()
1032 if (!path) in backref_in_log()
1035 ret = btrfs_search_slot(NULL, log, key, path, 0, 0); in backref_in_log()
1044 ret = !!btrfs_find_name_in_ext_backref(path->nodes[0], in backref_in_log()
1045 path->slots[0], in backref_in_log()
1049 ret = !!btrfs_find_name_in_backref(path->nodes[0], in backref_in_log()
1050 path->slots[0], in backref_in_log()
1053 btrfs_free_path(path); in backref_in_log()
1059 struct btrfs_path *path, in __add_inode_ref() argument
1080 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in __add_inode_ref()
1086 leaf = path->nodes[0]; in __add_inode_ref()
1098 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in __add_inode_ref()
1099 ptr_end = ptr + btrfs_item_size_nr(leaf, path->slots[0]); in __add_inode_ref()
1120 btrfs_release_path(path); in __add_inode_ref()
1144 btrfs_release_path(path); in __add_inode_ref()
1147 extref = btrfs_lookup_inode_extref(NULL, root, path, name, namelen, in __add_inode_ref()
1156 leaf = path->nodes[0]; in __add_inode_ref()
1158 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in __add_inode_ref()
1159 base = btrfs_item_ptr_offset(leaf, path->slots[0]); in __add_inode_ref()
1192 btrfs_release_path(path); in __add_inode_ref()
1216 btrfs_release_path(path); in __add_inode_ref()
1219 di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir), in __add_inode_ref()
1224 ret = drop_one_dir_item(trans, path, dir, di); in __add_inode_ref()
1228 btrfs_release_path(path); in __add_inode_ref()
1231 di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir), in __add_inode_ref()
1236 ret = drop_one_dir_item(trans, path, dir, di); in __add_inode_ref()
1240 btrfs_release_path(path); in __add_inode_ref()
1298 struct btrfs_path *path, in unlink_old_inode_refs() argument
1310 btrfs_release_path(path); in unlink_old_inode_refs()
1311 ret = btrfs_search_slot(NULL, root, key, path, 0, 0); in unlink_old_inode_refs()
1319 eb = path->nodes[0]; in unlink_old_inode_refs()
1320 ref_ptr = btrfs_item_ptr_offset(eb, path->slots[0]); in unlink_old_inode_refs()
1321 ref_end = ref_ptr + btrfs_item_size_nr(eb, path->slots[0]); in unlink_old_inode_refs()
1349 btrfs_release_path(path); in unlink_old_inode_refs()
1374 btrfs_release_path(path); in unlink_old_inode_refs()
1383 struct btrfs_path *path; in btrfs_inode_ref_exists() local
1387 path = btrfs_alloc_path(); in btrfs_inode_ref_exists()
1388 if (!path) in btrfs_inode_ref_exists()
1398 ret = btrfs_search_slot(NULL, BTRFS_I(inode)->root, &key, path, 0, 0); in btrfs_inode_ref_exists()
1406 ret = !!btrfs_find_name_in_ext_backref(path->nodes[0], in btrfs_inode_ref_exists()
1407 path->slots[0], parent_id, name, namelen); in btrfs_inode_ref_exists()
1409 ret = !!btrfs_find_name_in_backref(path->nodes[0], path->slots[0], in btrfs_inode_ref_exists()
1413 btrfs_free_path(path); in btrfs_inode_ref_exists()
1424 struct btrfs_path *path; in add_link() local
1428 path = btrfs_alloc_path(); in add_link()
1429 if (!path) in add_link()
1432 dir_item = btrfs_lookup_dir_item(NULL, root, path, in add_link()
1436 btrfs_release_path(path); in add_link()
1448 btrfs_dir_item_key_to_cpu(path->nodes[0], dir_item, &key); in add_link()
1449 btrfs_release_path(path); in add_link()
1474 btrfs_free_path(path); in add_link()
1488 struct btrfs_path *path, in add_inode_ref() argument
1561 ret = inode_in_dir(root, path, btrfs_ino(BTRFS_I(dir)), in add_inode_ref()
1576 ret = __add_inode_ref(trans, root, path, log, in add_inode_ref()
1645 ret = unlink_old_inode_refs(trans, root, path, BTRFS_I(inode), eb, slot, in add_inode_ref()
1651 ret = overwrite_item(trans, root, path, eb, slot, key); in add_inode_ref()
1653 btrfs_release_path(path); in add_inode_ref()
1661 struct btrfs_inode *inode, struct btrfs_path *path) in count_inode_extrefs() argument
1675 ret = btrfs_find_one_extref(root, inode_objectid, offset, path, in count_inode_extrefs()
1680 leaf = path->nodes[0]; in count_inode_extrefs()
1681 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in count_inode_extrefs()
1682 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in count_inode_extrefs()
1695 btrfs_release_path(path); in count_inode_extrefs()
1697 btrfs_release_path(path); in count_inode_extrefs()
1705 struct btrfs_inode *inode, struct btrfs_path *path) in count_inode_refs() argument
1720 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in count_inode_refs()
1724 if (path->slots[0] == 0) in count_inode_refs()
1726 path->slots[0]--; in count_inode_refs()
1729 btrfs_item_key_to_cpu(path->nodes[0], &key, in count_inode_refs()
1730 path->slots[0]); in count_inode_refs()
1734 ptr = btrfs_item_ptr_offset(path->nodes[0], path->slots[0]); in count_inode_refs()
1735 ptr_end = ptr + btrfs_item_size_nr(path->nodes[0], in count_inode_refs()
1736 path->slots[0]); in count_inode_refs()
1741 name_len = btrfs_inode_ref_name_len(path->nodes[0], in count_inode_refs()
1749 if (path->slots[0] > 0) { in count_inode_refs()
1750 path->slots[0]--; in count_inode_refs()
1754 btrfs_release_path(path); in count_inode_refs()
1756 btrfs_release_path(path); in count_inode_refs()
1775 struct btrfs_path *path; in fixup_inode_link_count() local
1780 path = btrfs_alloc_path(); in fixup_inode_link_count()
1781 if (!path) in fixup_inode_link_count()
1784 ret = count_inode_refs(root, BTRFS_I(inode), path); in fixup_inode_link_count()
1790 ret = count_inode_extrefs(root, BTRFS_I(inode), path); in fixup_inode_link_count()
1808 ret = replay_dir_deletes(trans, root, NULL, path, in fixup_inode_link_count()
1819 btrfs_free_path(path); in fixup_inode_link_count()
1825 struct btrfs_path *path) in fixup_inode_link_counts() argument
1835 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in fixup_inode_link_counts()
1841 if (path->slots[0] == 0) in fixup_inode_link_counts()
1843 path->slots[0]--; in fixup_inode_link_counts()
1846 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in fixup_inode_link_counts()
1851 ret = btrfs_del_item(trans, root, path); in fixup_inode_link_counts()
1855 btrfs_release_path(path); in fixup_inode_link_counts()
1874 btrfs_release_path(path); in fixup_inode_link_counts()
1886 struct btrfs_path *path, in link_to_fixup_dir() argument
1901 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in link_to_fixup_dir()
1903 btrfs_release_path(path); in link_to_fixup_dir()
1971 struct btrfs_path *path, in replay_one_name() argument
2004 ret = btrfs_lookup_inode(trans, root, path, &log_key, 0); in replay_one_name()
2005 btrfs_release_path(path); in replay_one_name()
2012 dst_di = btrfs_lookup_dir_item(trans, root, path, key->objectid, in replay_one_name()
2015 dst_di = btrfs_lookup_dir_index_item(trans, root, path, in replay_one_name()
2037 btrfs_dir_item_key_to_cpu(path->nodes[0], dst_di, &found_key); in replay_one_name()
2042 btrfs_dir_type(path->nodes[0], dst_di) == log_type) { in replay_one_name()
2054 ret = drop_one_dir_item(trans, path, BTRFS_I(dir), dst_di); in replay_one_name()
2061 btrfs_release_path(path); in replay_one_name()
2103 btrfs_release_path(path); in replay_one_name()
2123 struct btrfs_path *path, in replay_one_dir_item() argument
2140 ret = replay_one_name(trans, root, path, eb, di, key); in replay_one_dir_item()
2208 struct btrfs_path *path, in find_dir_range() argument
2225 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in find_dir_range()
2229 if (path->slots[0] == 0) in find_dir_range()
2231 path->slots[0]--; in find_dir_range()
2234 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in find_dir_range()
2240 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in find_dir_range()
2242 found_end = btrfs_dir_log_end(path->nodes[0], item); in find_dir_range()
2253 nritems = btrfs_header_nritems(path->nodes[0]); in find_dir_range()
2254 path->slots[0]++; in find_dir_range()
2255 if (path->slots[0] >= nritems) { in find_dir_range()
2256 ret = btrfs_next_leaf(root, path); in find_dir_range()
2261 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in find_dir_range()
2267 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in find_dir_range()
2269 found_end = btrfs_dir_log_end(path->nodes[0], item); in find_dir_range()
2274 btrfs_release_path(path); in find_dir_range()
2285 struct btrfs_path *path, in check_item_in_log() argument
2305 eb = path->nodes[0]; in check_item_in_log()
2306 slot = path->slots[0]; in check_item_in_log()
2334 btrfs_release_path(path); in check_item_in_log()
2343 path, location.objectid); in check_item_in_log()
2363 ret = btrfs_search_slot(NULL, root, dir_key, path, in check_item_in_log()
2381 btrfs_release_path(path); in check_item_in_log()
2389 struct btrfs_path *path, in replay_xattr_deletes() argument
2406 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in replay_xattr_deletes()
2410 nritems = btrfs_header_nritems(path->nodes[0]); in replay_xattr_deletes()
2411 for (i = path->slots[0]; i < nritems; i++) { in replay_xattr_deletes()
2418 btrfs_item_key_to_cpu(path->nodes[0], &key, i); in replay_xattr_deletes()
2424 di = btrfs_item_ptr(path->nodes[0], i, struct btrfs_dir_item); in replay_xattr_deletes()
2425 total_size = btrfs_item_size_nr(path->nodes[0], i); in replay_xattr_deletes()
2428 u16 name_len = btrfs_dir_name_len(path->nodes[0], di); in replay_xattr_deletes()
2429 u16 data_len = btrfs_dir_data_len(path->nodes[0], di); in replay_xattr_deletes()
2438 read_extent_buffer(path->nodes[0], name, in replay_xattr_deletes()
2446 btrfs_release_path(path); in replay_xattr_deletes()
2447 di = btrfs_lookup_xattr(trans, root, path, ino, in replay_xattr_deletes()
2456 path, di); in replay_xattr_deletes()
2459 btrfs_release_path(path); in replay_xattr_deletes()
2472 ret = btrfs_next_leaf(root, path); in replay_xattr_deletes()
2479 btrfs_release_path(path); in replay_xattr_deletes()
2497 struct btrfs_path *path, in replay_dir_deletes() argument
2531 ret = find_dir_range(log, path, dirid, key_type, in replay_dir_deletes()
2542 ret = btrfs_search_slot(NULL, root, &dir_key, path, in replay_dir_deletes()
2547 nritems = btrfs_header_nritems(path->nodes[0]); in replay_dir_deletes()
2548 if (path->slots[0] >= nritems) { in replay_dir_deletes()
2549 ret = btrfs_next_leaf(root, path); in replay_dir_deletes()
2555 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in replay_dir_deletes()
2556 path->slots[0]); in replay_dir_deletes()
2564 ret = check_item_in_log(trans, log, path, in replay_dir_deletes()
2573 btrfs_release_path(path); in replay_dir_deletes()
2584 btrfs_release_path(path); in replay_dir_deletes()
2588 btrfs_release_path(path); in replay_dir_deletes()
2609 struct btrfs_path *path; in replay_one_buffer() local
2624 path = btrfs_alloc_path(); in replay_one_buffer()
2625 if (!path) in replay_one_buffer()
2655 path, key.objectid); in replay_one_buffer()
2661 root, log, path, key.objectid, 0); in replay_one_buffer()
2665 ret = overwrite_item(wc->trans, root, path, in replay_one_buffer()
2709 path, key.objectid); in replay_one_buffer()
2719 ret = replay_one_dir_item(wc->trans, root, path, in replay_one_buffer()
2730 ret = overwrite_item(wc->trans, root, path, in replay_one_buffer()
2736 ret = add_inode_ref(wc->trans, root, log, path, in replay_one_buffer()
2742 ret = replay_one_extent(wc->trans, root, path, in replay_one_buffer()
2747 ret = replay_one_dir_item(wc->trans, root, path, in replay_one_buffer()
2753 btrfs_free_path(path); in replay_one_buffer()
2782 struct btrfs_path *path, int *level, in walk_down_log_tree() argument
2796 cur = path->nodes[*level]; in walk_down_log_tree()
2800 if (path->slots[*level] >= in walk_down_log_tree()
2804 bytenr = btrfs_node_blockptr(cur, path->slots[*level]); in walk_down_log_tree()
2805 ptr_gen = btrfs_node_ptr_generation(cur, path->slots[*level]); in walk_down_log_tree()
2806 btrfs_node_key_to_cpu(cur, &first_key, path->slots[*level]); in walk_down_log_tree()
2823 path->slots[*level]++; in walk_down_log_tree()
2860 if (path->nodes[*level-1]) in walk_down_log_tree()
2861 free_extent_buffer(path->nodes[*level-1]); in walk_down_log_tree()
2862 path->nodes[*level-1] = next; in walk_down_log_tree()
2864 path->slots[*level] = 0; in walk_down_log_tree()
2867 path->slots[*level] = btrfs_header_nritems(path->nodes[*level]); in walk_down_log_tree()
2875 struct btrfs_path *path, int *level, in walk_up_log_tree() argument
2883 for (i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) { in walk_up_log_tree()
2884 slot = path->slots[i]; in walk_up_log_tree()
2885 if (slot + 1 < btrfs_header_nritems(path->nodes[i])) { in walk_up_log_tree()
2886 path->slots[i]++; in walk_up_log_tree()
2891 ret = wc->process_func(root, path->nodes[*level], wc, in walk_up_log_tree()
2892 btrfs_header_generation(path->nodes[*level]), in walk_up_log_tree()
2900 next = path->nodes[*level]; in walk_up_log_tree()
2908 path->nodes[*level]->start, in walk_up_log_tree()
2909 path->nodes[*level]->len); in walk_up_log_tree()
2919 path->nodes[*level]->start); in walk_up_log_tree()
2922 free_extent_buffer(path->nodes[*level]); in walk_up_log_tree()
2923 path->nodes[*level] = NULL; in walk_up_log_tree()
2942 struct btrfs_path *path; in walk_log_tree() local
2945 path = btrfs_alloc_path(); in walk_log_tree()
2946 if (!path) in walk_log_tree()
2951 path->nodes[level] = log->node; in walk_log_tree()
2953 path->slots[level] = 0; in walk_log_tree()
2956 wret = walk_down_log_tree(trans, log, path, &level, wc); in walk_log_tree()
2964 wret = walk_up_log_tree(trans, log, path, &level, wc); in walk_log_tree()
2974 if (path->nodes[orig_level]) { in walk_log_tree()
2975 ret = wc->process_func(log, path->nodes[orig_level], wc, in walk_log_tree()
2976 btrfs_header_generation(path->nodes[orig_level]), in walk_log_tree()
2983 next = path->nodes[orig_level]; in walk_log_tree()
3004 btrfs_free_path(path); in walk_log_tree()
3533 struct btrfs_path *path; in btrfs_del_dir_entries_in_log() local
3548 path = btrfs_alloc_path(); in btrfs_del_dir_entries_in_log()
3549 if (!path) { in btrfs_del_dir_entries_in_log()
3554 di = btrfs_lookup_dir_item(trans, log, path, dir_ino, in btrfs_del_dir_entries_in_log()
3561 ret = btrfs_delete_one_dir_name(trans, log, path, di); in btrfs_del_dir_entries_in_log()
3567 btrfs_release_path(path); in btrfs_del_dir_entries_in_log()
3568 di = btrfs_lookup_dir_index_item(trans, log, path, dir_ino, in btrfs_del_dir_entries_in_log()
3575 ret = btrfs_delete_one_dir_name(trans, log, path, di); in btrfs_del_dir_entries_in_log()
3588 btrfs_free_path(path); in btrfs_del_dir_entries_in_log()
3630 struct btrfs_path *path, in insert_dir_log_key() argument
3644 ret = btrfs_insert_empty_item(trans, log, path, &key, sizeof(*item)); in insert_dir_log_key()
3648 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in insert_dir_log_key()
3650 btrfs_set_dir_log_end(path->nodes[0], item, last_offset); in insert_dir_log_key()
3651 btrfs_mark_buffer_dirty(path->nodes[0]); in insert_dir_log_key()
3652 btrfs_release_path(path); in insert_dir_log_key()
3733 struct btrfs_path *path, in process_dir_items_leaf() argument
3739 struct extent_buffer *src = path->nodes[0]; in process_dir_items_leaf()
3754 for (i = path->slots[0]; i < nritems; i++) { in process_dir_items_leaf()
3867 struct btrfs_path *path, in log_dir_items() argument
3885 ret = btrfs_search_forward(root, &min_key, path, trans->transid); in log_dir_items()
3895 btrfs_release_path(path); in log_dir_items()
3896 ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0); in log_dir_items()
3898 btrfs_release_path(path); in log_dir_items()
3901 ret = btrfs_previous_item(root, path, ino, key_type); in log_dir_items()
3910 btrfs_item_key_to_cpu(path->nodes[0], &tmp, in log_dir_items()
3911 path->slots[0]); in log_dir_items()
3919 ret = btrfs_previous_item(root, path, ino, key_type); in log_dir_items()
3922 btrfs_item_key_to_cpu(path->nodes[0], &tmp, path->slots[0]); in log_dir_items()
3926 path->nodes[0], path->slots[0], in log_dir_items()
3934 btrfs_release_path(path); in log_dir_items()
3945 ret = btrfs_search_slot(NULL, root, &min_key, path, 0, 0); in log_dir_items()
3954 ret = process_dir_items_leaf(trans, inode, path, dst_path, in log_dir_items()
3961 path->slots[0] = btrfs_header_nritems(path->nodes[0]); in log_dir_items()
3967 ret = btrfs_next_leaf(root, path); in log_dir_items()
3975 btrfs_item_key_to_cpu(path->nodes[0], &min_key, path->slots[0]); in log_dir_items()
3980 if (btrfs_header_generation(path->nodes[0]) != trans->transid) { in log_dir_items()
3983 path->nodes[0], path->slots[0], in log_dir_items()
3992 btrfs_release_path(path); in log_dir_items()
3998 btrfs_release_path(path); in log_dir_items()
4007 ret = insert_dir_log_key(trans, log, path, key_type, in log_dir_items()
4029 struct btrfs_path *path, in log_directory_changes() argument
4064 ret = log_dir_items(trans, inode, path, dst_path, key_type, in log_directory_changes()
4091 struct btrfs_path *path, in drop_inode_items() argument
4108 ret = btrfs_search_slot(trans, log, &key, path, -1, 1); in drop_inode_items()
4113 if (path->slots[0] == 0) in drop_inode_items()
4116 path->slots[0]--; in drop_inode_items()
4117 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in drop_inode_items()
4118 path->slots[0]); in drop_inode_items()
4125 ret = btrfs_bin_search(path->nodes[0], &found_key, &start_slot); in drop_inode_items()
4129 ret = btrfs_del_items(trans, log, path, start_slot, in drop_inode_items()
4130 path->slots[0] - start_slot + 1); in drop_inode_items()
4137 btrfs_release_path(path); in drop_inode_items()
4139 btrfs_release_path(path); in drop_inode_items()
4224 struct btrfs_root *log, struct btrfs_path *path, in log_inode_item() argument
4241 ret = btrfs_search_slot(trans, log, &inode->location, path, 0, 1); in log_inode_item()
4255 ret = btrfs_insert_empty_item(trans, log, path, &inode->location, in log_inode_item()
4261 inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0], in log_inode_item()
4263 fill_inode_item(trans, path->nodes[0], inode_item, &inode->vfs_inode, in log_inode_item()
4265 btrfs_release_path(path); in log_inode_item()
4571 struct btrfs_path *path, in log_one_extent() argument
4598 drop_args.path = path; in log_one_extent()
4613 ret = btrfs_insert_empty_item(trans, log, path, &key, in log_one_extent()
4618 leaf = path->nodes[0]; in log_one_extent()
4620 fi = btrfs_item_ptr(leaf, path->slots[0], in log_one_extent()
4654 btrfs_release_path(path); in log_one_extent()
4669 struct btrfs_path *path) in btrfs_log_prealloc_extents() argument
4690 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_prealloc_extents()
4702 ret = btrfs_previous_item(root, path, ino, BTRFS_EXTENT_DATA_KEY); in btrfs_log_prealloc_extents()
4709 leaf = path->nodes[0]; in btrfs_log_prealloc_extents()
4710 slot = path->slots[0]; in btrfs_log_prealloc_extents()
4729 leaf = path->nodes[0]; in btrfs_log_prealloc_extents()
4730 slot = path->slots[0]; in btrfs_log_prealloc_extents()
4734 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_prealloc_extents()
4740 ret = btrfs_next_leaf(root, path); in btrfs_log_prealloc_extents()
4756 path->slots[0]++; in btrfs_log_prealloc_extents()
4774 path->slots[0]++; in btrfs_log_prealloc_extents()
4784 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_prealloc_extents()
4787 btrfs_release_path(path); in btrfs_log_prealloc_extents()
4794 struct btrfs_path *path, in btrfs_log_changed_extents() argument
4857 ret = log_one_extent(trans, inode, em, path, ctx); in btrfs_log_changed_extents()
4865 btrfs_release_path(path); in btrfs_log_changed_extents()
4867 ret = btrfs_log_prealloc_extents(trans, inode, path); in btrfs_log_changed_extents()
4897 struct btrfs_path *path, u64 *size_ret) in logged_inode_size() argument
4906 ret = btrfs_search_slot(NULL, log, &key, path, 0, 0); in logged_inode_size()
4914 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in logged_inode_size()
4916 *size_ret = btrfs_inode_size(path->nodes[0], item); in logged_inode_size()
4932 btrfs_release_path(path); in logged_inode_size()
4947 struct btrfs_path *path, in btrfs_log_all_xattrs() argument
4965 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_all_xattrs()
4970 int slot = path->slots[0]; in btrfs_log_all_xattrs()
4971 struct extent_buffer *leaf = path->nodes[0]; in btrfs_log_all_xattrs()
4976 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_all_xattrs()
4982 ret = btrfs_next_leaf(root, path); in btrfs_log_all_xattrs()
4997 path->slots[0]++; in btrfs_log_all_xattrs()
5002 ret = copy_items(trans, inode, dst_path, path, in btrfs_log_all_xattrs()
5025 struct btrfs_path *path) in btrfs_log_holes() argument
5042 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_holes()
5047 struct extent_buffer *leaf = path->nodes[0]; in btrfs_log_holes()
5049 if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) { in btrfs_log_holes()
5050 ret = btrfs_next_leaf(root, path); in btrfs_log_holes()
5057 leaf = path->nodes[0]; in btrfs_log_holes()
5060 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_log_holes()
5073 btrfs_release_path(path); in btrfs_log_holes()
5088 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_holes()
5093 leaf = path->nodes[0]; in btrfs_log_holes()
5096 prev_extent_end = btrfs_file_extent_end(path); in btrfs_log_holes()
5097 path->slots[0]++; in btrfs_log_holes()
5104 btrfs_release_path(path); in btrfs_log_holes()
5260 struct btrfs_path *path, in log_conflicting_inodes() argument
5289 btrfs_release_path(path); in log_conflicting_inodes()
5373 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in log_conflicting_inodes()
5380 struct extent_buffer *leaf = path->nodes[0]; in log_conflicting_inodes()
5381 int slot = path->slots[0]; in log_conflicting_inodes()
5386 ret = btrfs_next_leaf(root, path); in log_conflicting_inodes()
5420 path->slots[0]++; in log_conflicting_inodes()
5432 struct btrfs_path *path, in copy_inode_items_to_log() argument
5446 ret = btrfs_search_forward(root, min_key, path, trans->transid); in copy_inode_items_to_log()
5470 ret = btrfs_check_ref_name_override(path->nodes[0], in copy_inode_items_to_log()
5471 path->slots[0], min_key, inode, in copy_inode_items_to_log()
5481 ins_start_slot = path->slots[0]; in copy_inode_items_to_log()
5483 ret = copy_items(trans, inode, dst_path, path, in copy_inode_items_to_log()
5490 ret = log_conflicting_inodes(trans, root, path, in copy_inode_items_to_log()
5494 btrfs_release_path(path); in copy_inode_items_to_log()
5503 ret = copy_items(trans, inode, dst_path, path, in copy_inode_items_to_log()
5512 if (ins_nr && ins_start_slot + ins_nr == path->slots[0]) { in copy_inode_items_to_log()
5516 ins_start_slot = path->slots[0]; in copy_inode_items_to_log()
5521 ret = copy_items(trans, inode, dst_path, path, ins_start_slot, in copy_inode_items_to_log()
5526 ins_start_slot = path->slots[0]; in copy_inode_items_to_log()
5528 path->slots[0]++; in copy_inode_items_to_log()
5529 if (path->slots[0] < btrfs_header_nritems(path->nodes[0])) { in copy_inode_items_to_log()
5530 btrfs_item_key_to_cpu(path->nodes[0], min_key, in copy_inode_items_to_log()
5531 path->slots[0]); in copy_inode_items_to_log()
5535 ret = copy_items(trans, inode, dst_path, path, in copy_inode_items_to_log()
5542 btrfs_release_path(path); in copy_inode_items_to_log()
5554 ret = copy_items(trans, inode, dst_path, path, ins_start_slot, in copy_inode_items_to_log()
5579 struct btrfs_path *path; in btrfs_log_inode() local
5595 path = btrfs_alloc_path(); in btrfs_log_inode()
5596 if (!path) in btrfs_log_inode()
5600 btrfs_free_path(path); in btrfs_log_inode()
5668 ret = drop_inode_items(trans, log, path, inode, max_key_type); in btrfs_log_inode()
5684 err = logged_inode_size(log, inode, path, &logged_isize); in btrfs_log_inode()
5692 ret = drop_inode_items(trans, log, path, inode, in btrfs_log_inode()
5709 ret = drop_inode_items(trans, log, path, inode, in btrfs_log_inode()
5725 path, dst_path, logged_isize, in btrfs_log_inode()
5731 btrfs_release_path(path); in btrfs_log_inode()
5733 err = btrfs_log_all_xattrs(trans, inode, path, dst_path); in btrfs_log_inode()
5738 btrfs_release_path(path); in btrfs_log_inode()
5740 err = btrfs_log_holes(trans, inode, path); in btrfs_log_inode()
5745 btrfs_release_path(path); in btrfs_log_inode()
5760 err = btrfs_log_all_xattrs(trans, inode, path, dst_path); in btrfs_log_inode()
5763 btrfs_release_path(path); in btrfs_log_inode()
5782 ret = log_directory_changes(trans, inode, path, dst_path, ctx); in btrfs_log_inode()
5828 btrfs_free_path(path); in btrfs_log_inode()
5922 struct btrfs_path *path; in log_new_dir_dentries() local
5935 path = btrfs_alloc_path(); in log_new_dir_dentries()
5936 if (!path) in log_new_dir_dentries()
5941 btrfs_free_path(path); in log_new_dir_dentries()
5962 btrfs_release_path(path); in log_new_dir_dentries()
5963 ret = btrfs_search_forward(log, &min_key, path, trans->transid); in log_new_dir_dentries()
5972 leaf = path->nodes[0]; in log_new_dir_dentries()
5974 for (i = path->slots[0]; i < nritems; i++) { in log_new_dir_dentries()
5996 btrfs_release_path(path); in log_new_dir_dentries()
6029 ret = btrfs_next_leaf(log, path); in log_new_dir_dentries()
6047 btrfs_free_path(path); in log_new_dir_dentries()
6057 struct btrfs_path *path; in btrfs_log_all_parents() local
6062 path = btrfs_alloc_path(); in btrfs_log_all_parents()
6063 if (!path) in btrfs_log_all_parents()
6065 path->skip_locking = 1; in btrfs_log_all_parents()
6066 path->search_commit_root = 1; in btrfs_log_all_parents()
6071 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_all_parents()
6076 struct extent_buffer *leaf = path->nodes[0]; in btrfs_log_all_parents()
6077 int slot = path->slots[0]; in btrfs_log_all_parents()
6083 ret = btrfs_next_leaf(root, path); in btrfs_log_all_parents()
6165 path->slots[0]++; in btrfs_log_all_parents()
6169 btrfs_free_path(path); in btrfs_log_all_parents()
6175 struct btrfs_path *path, in log_new_ancestors() argument
6180 btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); in log_new_ancestors()
6184 struct extent_buffer *leaf = path->nodes[0]; in log_new_ancestors()
6185 int slot = path->slots[0]; in log_new_ancestors()
6191 btrfs_release_path(path); in log_new_ancestors()
6214 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in log_new_ancestors()
6218 leaf = path->nodes[0]; in log_new_ancestors()
6219 slot = path->slots[0]; in log_new_ancestors()
6221 ret = btrfs_next_leaf(root, path); in log_new_ancestors()
6226 leaf = path->nodes[0]; in log_new_ancestors()
6227 slot = path->slots[0]; in log_new_ancestors()
6283 struct btrfs_path *path; in log_all_new_ancestors() local
6294 path = btrfs_alloc_path(); in log_all_new_ancestors()
6295 if (!path) in log_all_new_ancestors()
6302 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); in log_all_new_ancestors()
6306 path->slots[0]++; in log_all_new_ancestors()
6309 struct extent_buffer *leaf = path->nodes[0]; in log_all_new_ancestors()
6310 int slot = path->slots[0]; in log_all_new_ancestors()
6314 ret = btrfs_next_leaf(root, path); in log_all_new_ancestors()
6347 ret = log_new_ancestors(trans, root, path, ctx); in log_all_new_ancestors()
6350 btrfs_release_path(path); in log_all_new_ancestors()
6355 btrfs_free_path(path); in log_all_new_ancestors()
6517 struct btrfs_path *path; in btrfs_recover_log_trees() local
6528 path = btrfs_alloc_path(); in btrfs_recover_log_trees()
6529 if (!path) in btrfs_recover_log_trees()
6555 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0); in btrfs_recover_log_trees()
6562 if (path->slots[0] == 0) in btrfs_recover_log_trees()
6564 path->slots[0]--; in btrfs_recover_log_trees()
6566 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in btrfs_recover_log_trees()
6567 path->slots[0]); in btrfs_recover_log_trees()
6568 btrfs_release_path(path); in btrfs_recover_log_trees()
6617 path); in btrfs_recover_log_trees()
6625 btrfs_release_path(path); in btrfs_recover_log_trees()
6651 btrfs_release_path(path); in btrfs_recover_log_trees()
6666 btrfs_free_path(path); in btrfs_recover_log_trees()
6682 btrfs_free_path(path); in btrfs_recover_log_trees()