Lines Matching refs:key
346 struct btrfs_key *key) in overwrite_item() argument
355 bool inode_item = key->type == BTRFS_INODE_ITEM_KEY; in overwrite_item()
364 ret = btrfs_search_slot(NULL, root, key, path, 0, 0); in overwrite_item()
459 key, item_size); in overwrite_item()
486 if (key->type == BTRFS_INODE_ITEM_KEY && ret == -EEXIST) { in overwrite_item()
535 if (key->type == BTRFS_INODE_ITEM_KEY) { in overwrite_item()
556 struct btrfs_key key; in read_one_inode() local
559 key.objectid = objectid; in read_one_inode()
560 key.type = BTRFS_INODE_ITEM_KEY; in read_one_inode()
561 key.offset = 0; in read_one_inode()
562 inode = btrfs_iget(root->fs_info->sb, &key, root, NULL); in read_one_inode()
584 struct btrfs_key *key) in replay_one_extent() argument
589 u64 start = key->offset; in replay_one_extent()
620 inode = read_one_inode(root, key->objectid); in replay_one_extent()
677 ret = btrfs_insert_empty_item(trans, root, path, key, in replay_one_extent()
689 offset = key->offset - btrfs_file_extent_offset(eb, item); in replay_one_extent()
724 key->objectid, offset); in replay_one_extent()
735 key->objectid, offset, &ins); in replay_one_extent()
828 ret = overwrite_item(trans, root, path, eb, slot, key); in replay_one_extent()
944 struct btrfs_key *key, in backref_in_log() argument
962 ret = btrfs_search_slot(NULL, log, key, path, 0, 0); in backref_in_log()
968 if (key->type == BTRFS_INODE_EXTREF_KEY) { in backref_in_log()
1234 struct btrfs_key *key) in unlink_old_inode_refs() argument
1243 ret = btrfs_search_slot(NULL, root, key, path, 0, 0); in unlink_old_inode_refs()
1259 if (key->type == BTRFS_INODE_EXTREF_KEY) { in unlink_old_inode_refs()
1263 parent_id = key->offset; in unlink_old_inode_refs()
1270 if (key->type == BTRFS_INODE_EXTREF_KEY) in unlink_old_inode_refs()
1299 if (key->type == BTRFS_INODE_EXTREF_KEY) in unlink_old_inode_refs()
1314 struct btrfs_key key; in btrfs_inode_ref_exists() local
1323 key.objectid = btrfs_ino(BTRFS_I(inode)); in btrfs_inode_ref_exists()
1324 key.type = ref_type; in btrfs_inode_ref_exists()
1325 if (key.type == BTRFS_INODE_REF_KEY) in btrfs_inode_ref_exists()
1326 key.offset = parent_id; in btrfs_inode_ref_exists()
1328 key.offset = btrfs_extref_hash(parent_id, name, namelen); in btrfs_inode_ref_exists()
1330 ret = btrfs_search_slot(NULL, BTRFS_I(inode)->root, &key, path, 0, 0); in btrfs_inode_ref_exists()
1337 if (key.type == BTRFS_INODE_EXTREF_KEY) in btrfs_inode_ref_exists()
1354 struct btrfs_key key; in add_link() local
1379 btrfs_dir_item_key_to_cpu(path->nodes[0], dir_item, &key); in add_link()
1381 other_inode = read_one_inode(root, key.objectid); in add_link()
1421 struct btrfs_key *key) in add_inode_ref() argument
1440 if (key->type == BTRFS_INODE_EXTREF_KEY) { in add_inode_ref()
1449 parent_objectid = key->offset; in add_inode_ref()
1451 inode_objectid = key->objectid; in add_inode_ref()
1527 ret = btrfs_inode_ref_exists(inode, dir, key->type, in add_inode_ref()
1572 key); in add_inode_ref()
1577 ret = overwrite_item(trans, root, path, eb, slot, key); in add_inode_ref()
1646 struct btrfs_key key; in count_inode_refs() local
1653 key.objectid = ino; in count_inode_refs()
1654 key.type = BTRFS_INODE_REF_KEY; in count_inode_refs()
1655 key.offset = (u64)-1; in count_inode_refs()
1658 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in count_inode_refs()
1667 btrfs_item_key_to_cpu(path->nodes[0], &key, in count_inode_refs()
1669 if (key.objectid != ino || in count_inode_refs()
1670 key.type != BTRFS_INODE_REF_KEY) in count_inode_refs()
1685 if (key.offset == 0) in count_inode_refs()
1691 key.offset--; in count_inode_refs()
1762 struct btrfs_key key; in fixup_inode_link_counts() local
1765 key.objectid = BTRFS_TREE_LOG_FIXUP_OBJECTID; in fixup_inode_link_counts()
1766 key.type = BTRFS_ORPHAN_ITEM_KEY; in fixup_inode_link_counts()
1767 key.offset = (u64)-1; in fixup_inode_link_counts()
1769 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in fixup_inode_link_counts()
1779 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in fixup_inode_link_counts()
1780 if (key.objectid != BTRFS_TREE_LOG_FIXUP_OBJECTID || in fixup_inode_link_counts()
1781 key.type != BTRFS_ORPHAN_ITEM_KEY) in fixup_inode_link_counts()
1789 inode = read_one_inode(root, key.offset); in fixup_inode_link_counts()
1803 key.offset = (u64)-1; in fixup_inode_link_counts()
1822 struct btrfs_key key; in link_to_fixup_dir() local
1830 key.objectid = BTRFS_TREE_LOG_FIXUP_OBJECTID; in link_to_fixup_dir()
1831 key.type = BTRFS_ORPHAN_ITEM_KEY; in link_to_fixup_dir()
1832 key.offset = objectid; in link_to_fixup_dir()
1834 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in link_to_fixup_dir()
1933 struct btrfs_key *key) in replay_one_name() argument
1944 bool update_size = (key->type == BTRFS_DIR_INDEX_KEY); in replay_one_name()
1947 dir = read_one_inode(root, key->objectid); in replay_one_name()
1970 if (key->type == BTRFS_DIR_ITEM_KEY) { in replay_one_name()
1971 dst_di = btrfs_lookup_dir_item(trans, root, path, key->objectid, in replay_one_name()
1973 } else if (key->type == BTRFS_DIR_INDEX_KEY) { in replay_one_name()
1975 key->objectid, in replay_one_name()
1976 key->offset, name, in replay_one_name()
1987 if (key->type != BTRFS_DIR_INDEX_KEY) in replay_one_name()
2013 if (key->type == BTRFS_DIR_INDEX_KEY) in replay_one_name()
2029 key->objectid, log_key.objectid)) { in replay_one_name()
2036 ret = insert_one_name(trans, root, key->objectid, key->offset, in replay_one_name()
2057 struct btrfs_key *key) in replay_one_dir_item() argument
2072 ret = replay_one_name(trans, root, path, eb, di, key); in replay_one_dir_item()
2144 struct btrfs_key key; in find_dir_range() local
2153 key.objectid = dirid; in find_dir_range()
2154 key.type = key_type; in find_dir_range()
2155 key.offset = *start_ret; in find_dir_range()
2157 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in find_dir_range()
2166 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in find_dir_range()
2168 if (key.type != key_type || key.objectid != dirid) { in find_dir_range()
2176 if (*start_ret >= key.offset && *start_ret <= found_end) { in find_dir_range()
2178 *start_ret = key.offset; in find_dir_range()
2193 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in find_dir_range()
2195 if (key.type != key_type || key.objectid != dirid) { in find_dir_range()
2202 *start_ret = key.offset; in find_dir_range()
2344 struct btrfs_key key; in replay_xattr_deletes() local
2350 btrfs_item_key_to_cpu(path->nodes[0], &key, i); in replay_xattr_deletes()
2351 if (key.objectid != ino || key.type != BTRFS_XATTR_ITEM_KEY) { in replay_xattr_deletes()
2392 search_key = key; in replay_xattr_deletes()
2541 struct btrfs_key key; in replay_one_buffer() local
2560 btrfs_item_key_to_cpu(eb, &key, i); in replay_one_buffer()
2563 if (key.type == BTRFS_INODE_ITEM_KEY && in replay_one_buffer()
2585 path, key.objectid); in replay_one_buffer()
2591 root, log, path, key.objectid, 0); in replay_one_buffer()
2596 eb, i, &key); in replay_one_buffer()
2612 inode = read_one_inode(root, key.objectid); in replay_one_buffer()
2632 path, key.objectid); in replay_one_buffer()
2640 if (key.type == BTRFS_DIR_INDEX_KEY && in replay_one_buffer()
2643 eb, i, &key); in replay_one_buffer()
2652 if (key.type == BTRFS_XATTR_ITEM_KEY) { in replay_one_buffer()
2654 eb, i, &key); in replay_one_buffer()
2657 } else if (key.type == BTRFS_INODE_REF_KEY || in replay_one_buffer()
2658 key.type == BTRFS_INODE_EXTREF_KEY) { in replay_one_buffer()
2660 eb, i, &key); in replay_one_buffer()
2664 } else if (key.type == BTRFS_EXTENT_DATA_KEY) { in replay_one_buffer()
2666 eb, i, &key); in replay_one_buffer()
2669 } else if (key.type == BTRFS_DIR_ITEM_KEY) { in replay_one_buffer()
2671 eb, i, &key); in replay_one_buffer()
3452 struct btrfs_key key; in btrfs_del_dir_entries_in_log() local
3454 key.objectid = dir_ino; in btrfs_del_dir_entries_in_log()
3455 key.offset = 0; in btrfs_del_dir_entries_in_log()
3456 key.type = BTRFS_INODE_ITEM_KEY; 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()
3540 struct btrfs_key key; in insert_dir_log_key() local
3543 key.objectid = dirid; in insert_dir_log_key()
3544 key.offset = first_offset; in insert_dir_log_key()
3546 key.type = BTRFS_DIR_LOG_ITEM_KEY; in insert_dir_log_key()
3548 key.type = BTRFS_DIR_LOG_INDEX_KEY; in insert_dir_log_key()
3549 ret = btrfs_insert_empty_item(trans, log, path, &key, sizeof(*item)); in insert_dir_log_key()
3809 struct btrfs_key key; in drop_objectid_items() local
3813 key.objectid = objectid; in drop_objectid_items()
3814 key.type = max_key_type; in drop_objectid_items()
3815 key.offset = (u64)-1; in drop_objectid_items()
3818 ret = btrfs_search_slot(trans, log, &key, path, -1, 1); in drop_objectid_items()
3967 struct btrfs_key first_key, last_key, key; in copy_items() local
4133 btrfs_item_key_to_cpu(src, &key, src_path->slots[0]); in copy_items()
4134 if (key.objectid != btrfs_ino(inode) || in copy_items()
4135 key.type != BTRFS_EXTENT_DATA_KEY) in copy_items()
4142 *last_extent = ALIGN(key.offset + len, in copy_items()
4146 *last_extent = key.offset + len; in copy_items()
4195 btrfs_item_key_to_cpu(src, &key, i); in copy_items()
4196 if (!btrfs_comp_cpu_keys(&key, &last_key)) in copy_items()
4198 if (key.objectid != btrfs_ino(inode) || in copy_items()
4199 key.type != BTRFS_EXTENT_DATA_KEY) { in copy_items()
4207 extent_end = ALIGN(key.offset + len, in copy_items()
4211 extent_end = key.offset + len; in copy_items()
4215 if (*last_extent == key.offset) { in copy_items()
4220 len = key.offset - *last_extent; in copy_items()
4234 key.objectid == btrfs_ino(inode) && in copy_items()
4235 key.type == BTRFS_EXTENT_DATA_KEY && in copy_items()
4242 btrfs_item_key_to_cpu(src_path->nodes[0], &key, in copy_items()
4244 if (key.objectid == btrfs_ino(inode) && in copy_items()
4245 key.type == BTRFS_EXTENT_DATA_KEY && in copy_items()
4246 *last_extent < key.offset) { in copy_items()
4247 const u64 len = key.offset - *last_extent; in copy_items()
4336 struct btrfs_key key; in log_one_extent() local
4353 key.objectid = btrfs_ino(inode); in log_one_extent()
4354 key.type = BTRFS_EXTENT_DATA_KEY; in log_one_extent()
4355 key.offset = em->start; in log_one_extent()
4357 ret = btrfs_insert_empty_item(trans, log, path, &key, in log_one_extent()
4424 struct btrfs_key key; in btrfs_log_prealloc_extents() local
4436 key.objectid = ino; in btrfs_log_prealloc_extents()
4437 key.type = BTRFS_EXTENT_DATA_KEY; in btrfs_log_prealloc_extents()
4438 key.offset = i_size; in btrfs_log_prealloc_extents()
4439 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_prealloc_extents()
4466 btrfs_item_key_to_cpu(leaf, &key, slot); in btrfs_log_prealloc_extents()
4467 if (key.objectid > ino) in btrfs_log_prealloc_extents()
4469 if (WARN_ON_ONCE(key.objectid < ino) || in btrfs_log_prealloc_extents()
4470 key.type < BTRFS_EXTENT_DATA_KEY || in btrfs_log_prealloc_extents()
4471 key.offset < i_size) { in btrfs_log_prealloc_extents()
4476 last_extent = key.offset; in btrfs_log_prealloc_extents()
4618 struct btrfs_key key; in logged_inode_size() local
4621 key.objectid = btrfs_ino(inode); in logged_inode_size()
4622 key.type = BTRFS_INODE_ITEM_KEY; in logged_inode_size()
4623 key.offset = 0; in logged_inode_size()
4625 ret = btrfs_search_slot(NULL, log, &key, path, 0, 0); in logged_inode_size()
4671 struct btrfs_key key; in btrfs_log_all_xattrs() local
4676 key.objectid = ino; in btrfs_log_all_xattrs()
4677 key.type = BTRFS_XATTR_ITEM_KEY; in btrfs_log_all_xattrs()
4678 key.offset = 0; in btrfs_log_all_xattrs()
4680 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_all_xattrs()
4710 btrfs_item_key_to_cpu(leaf, &key, slot); in btrfs_log_all_xattrs()
4711 if (key.objectid != ino || key.type != BTRFS_XATTR_ITEM_KEY) in btrfs_log_all_xattrs()
4766 struct btrfs_key key; in btrfs_log_trailing_hole() local
4777 key.objectid = ino; in btrfs_log_trailing_hole()
4778 key.type = BTRFS_EXTENT_DATA_KEY; in btrfs_log_trailing_hole()
4779 key.offset = (u64)-1; in btrfs_log_trailing_hole()
4781 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_trailing_hole()
4789 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_log_trailing_hole()
4791 if (key.objectid != ino || key.type != BTRFS_EXTENT_DATA_KEY) { in btrfs_log_trailing_hole()
4803 if (key.offset >= i_size) in btrfs_log_trailing_hole()
4815 if (key.offset + len > i_size) in btrfs_log_trailing_hole()
4817 hole_start = key.offset + len; in btrfs_log_trailing_hole()
4876 const struct btrfs_key *key, in btrfs_check_ref_name_override() argument
4901 if (key->type == BTRFS_INODE_REF_KEY) { in btrfs_check_ref_name_override()
4905 parent = key->offset; in btrfs_check_ref_name_override()
4941 if (di_key.objectid != key->objectid) { in btrfs_check_ref_name_override()
4992 struct btrfs_key key; in log_conflicting_inodes() local
5006 key.objectid = ino; in log_conflicting_inodes()
5007 key.type = BTRFS_INODE_ITEM_KEY; in log_conflicting_inodes()
5008 key.offset = 0; in log_conflicting_inodes()
5009 inode = btrfs_iget(fs_info->sb, &key, root, NULL); in log_conflicting_inodes()
5018 key.objectid = parent; in log_conflicting_inodes()
5019 inode = btrfs_iget(fs_info->sb, &key, root, in log_conflicting_inodes()
5047 key.objectid = ino; in log_conflicting_inodes()
5048 key.type = BTRFS_INODE_REF_KEY; in log_conflicting_inodes()
5049 key.offset = 0; in log_conflicting_inodes()
5050 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in log_conflicting_inodes()
5073 btrfs_item_key_to_cpu(leaf, &key, slot); in log_conflicting_inodes()
5074 if (key.objectid != ino || in log_conflicting_inodes()
5075 (key.type != BTRFS_INODE_REF_KEY && in log_conflicting_inodes()
5076 key.type != BTRFS_INODE_EXTREF_KEY)) { in log_conflicting_inodes()
5081 ret = btrfs_check_ref_name_override(leaf, slot, &key, in log_conflicting_inodes()
5789 struct btrfs_key key; in btrfs_log_all_parents() local
5799 key.objectid = ino; in btrfs_log_all_parents()
5800 key.type = BTRFS_INODE_REF_KEY; in btrfs_log_all_parents()
5801 key.offset = 0; in btrfs_log_all_parents()
5802 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_log_all_parents()
5822 btrfs_item_key_to_cpu(leaf, &key, slot); in btrfs_log_all_parents()
5824 if (key.objectid != ino || key.type > BTRFS_INODE_EXTREF_KEY) in btrfs_log_all_parents()
5836 if (key.type == BTRFS_INODE_EXTREF_KEY) { in btrfs_log_all_parents()
5847 inode_key.objectid = key.offset; in btrfs_log_all_parents()
6269 struct btrfs_key key; in btrfs_recover_log_trees() local
6302 key.objectid = BTRFS_TREE_LOG_OBJECTID; in btrfs_recover_log_trees()
6303 key.offset = (u64)-1; in btrfs_recover_log_trees()
6304 key.type = BTRFS_ROOT_ITEM_KEY; in btrfs_recover_log_trees()
6307 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0); in btrfs_recover_log_trees()
6403 key.offset = found_key.offset - 1; in btrfs_recover_log_trees()