Lines Matching refs:slot

56 static void generic_err(const struct extent_buffer *eb, int slot,  in generic_err()  argument
71 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, &vaf); in generic_err()
81 static void file_extent_err(const struct extent_buffer *eb, int slot, in file_extent_err() argument
89 btrfs_item_key_to_cpu(eb, &key, slot); in file_extent_err()
98 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in file_extent_err()
107 #define CHECK_FE_ALIGNED(leaf, slot, fi, name, alignment) \ argument
111 file_extent_err((leaf), (slot), \
141 static void dir_item_err(const struct extent_buffer *eb, int slot, in dir_item_err() argument
149 btrfs_item_key_to_cpu(eb, &key, slot); in dir_item_err()
158 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in dir_item_err()
173 struct btrfs_key *key, int slot, in check_prev_ino() argument
177 if (slot == 0) in check_prev_ino()
198 dir_item_err(leaf, slot, in check_prev_ino()
204 struct btrfs_key *key, int slot, in check_extent_data_item() argument
210 u32 item_size = btrfs_item_size(leaf, slot); in check_extent_data_item()
214 file_extent_err(leaf, slot, in check_extent_data_item()
226 if (unlikely(!check_prev_ino(leaf, key, slot, prev_key))) in check_extent_data_item()
229 fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); in check_extent_data_item()
236 file_extent_err(leaf, slot, in check_extent_data_item()
244 file_extent_err(leaf, slot, in check_extent_data_item()
257 file_extent_err(leaf, slot, in check_extent_data_item()
264 file_extent_err(leaf, slot, in check_extent_data_item()
272 file_extent_err(leaf, slot, in check_extent_data_item()
286 file_extent_err(leaf, slot, in check_extent_data_item()
297 file_extent_err(leaf, slot, in check_extent_data_item()
302 if (unlikely(CHECK_FE_ALIGNED(leaf, slot, fi, ram_bytes, sectorsize) || in check_extent_data_item()
303 CHECK_FE_ALIGNED(leaf, slot, fi, disk_bytenr, sectorsize) || in check_extent_data_item()
304 CHECK_FE_ALIGNED(leaf, slot, fi, disk_num_bytes, sectorsize) || in check_extent_data_item()
305 CHECK_FE_ALIGNED(leaf, slot, fi, offset, sectorsize) || in check_extent_data_item()
306 CHECK_FE_ALIGNED(leaf, slot, fi, num_bytes, sectorsize))) in check_extent_data_item()
312 file_extent_err(leaf, slot, in check_extent_data_item()
323 if (slot > 0 && in check_extent_data_item()
329 prev_fi = btrfs_item_ptr(leaf, slot - 1, in check_extent_data_item()
333 file_extent_err(leaf, slot - 1, in check_extent_data_item()
344 int slot, struct btrfs_key *prev_key) in check_csum_item() argument
351 generic_err(leaf, slot, in check_csum_item()
357 generic_err(leaf, slot, in check_csum_item()
362 if (unlikely(!IS_ALIGNED(btrfs_item_size(leaf, slot), csumsize))) { in check_csum_item()
363 generic_err(leaf, slot, in check_csum_item()
365 btrfs_item_size(leaf, slot), csumsize); in check_csum_item()
368 if (slot > 0 && prev_key->type == BTRFS_EXTENT_CSUM_KEY) { in check_csum_item()
372 prev_item_size = btrfs_item_size(leaf, slot - 1); in check_csum_item()
376 generic_err(leaf, slot - 1, in check_csum_item()
386 #define inode_item_err(eb, slot, fmt, ...) \ argument
387 dir_item_err(eb, slot, fmt, __VA_ARGS__)
390 int slot) in check_inode_key() argument
395 btrfs_item_key_to_cpu(leaf, &item_key, slot); in check_inode_key()
411 generic_err(leaf, slot, in check_inode_key()
418 dir_item_err(leaf, slot, in check_inode_key()
429 inode_item_err(leaf, slot, in check_inode_key()
433 dir_item_err(leaf, slot, in check_inode_key()
442 int slot) in check_root_key() argument
447 btrfs_item_key_to_cpu(leaf, &item_key, slot); in check_root_key()
458 generic_err(leaf, slot, in check_root_key()
467 generic_err(leaf, slot, "invalid root id 0"); in check_root_key()
469 dir_item_err(leaf, slot, in check_root_key()
476 dir_item_err(leaf, slot, in check_root_key()
493 generic_err(leaf, slot, "invalid root id 0 for reloc tree"); in check_root_key()
501 int slot) in check_dir_item() argument
505 u32 item_size = btrfs_item_size(leaf, slot); in check_dir_item()
508 if (unlikely(!check_prev_ino(leaf, key, slot, prev_key))) in check_dir_item()
511 di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item); in check_dir_item()
524 dir_item_err(leaf, slot, in check_dir_item()
533 ret = check_root_key(leaf, &location_key, slot); in check_dir_item()
538 ret = check_inode_key(leaf, &location_key, slot); in check_dir_item()
542 dir_item_err(leaf, slot, in check_dir_item()
553 dir_item_err(leaf, slot, in check_dir_item()
561 dir_item_err(leaf, slot, in check_dir_item()
568 dir_item_err(leaf, slot, in check_dir_item()
581 dir_item_err(leaf, slot, in check_dir_item()
587 dir_item_err(leaf, slot, in check_dir_item()
595 dir_item_err(leaf, slot, in check_dir_item()
605 dir_item_err(leaf, slot, in check_dir_item()
623 dir_item_err(leaf, slot, in check_dir_item()
637 static void block_group_err(const struct extent_buffer *eb, int slot, in block_group_err() argument
645 btrfs_item_key_to_cpu(eb, &key, slot); in block_group_err()
654 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in block_group_err()
660 struct btrfs_key *key, int slot) in check_block_group_item() argument
664 u32 item_size = btrfs_item_size(leaf, slot); in check_block_group_item()
674 block_group_err(leaf, slot, in check_block_group_item()
680 block_group_err(leaf, slot, in check_block_group_item()
686 read_extent_buffer(leaf, &bgi, btrfs_item_ptr_offset(leaf, slot), in check_block_group_item()
698 block_group_err(leaf, slot, in check_block_group_item()
705 block_group_err(leaf, slot, in check_block_group_item()
713 block_group_err(leaf, slot, in check_block_group_item()
721 block_group_err(leaf, slot, in check_block_group_item()
734 block_group_err(leaf, slot, in check_block_group_item()
756 int slot = -1; in chunk_err() local
769 slot = i; in chunk_err()
785 BTRFS_CHUNK_TREE_OBJECTID, leaf->start, slot, in chunk_err()
962 struct btrfs_key *key, int slot) in check_leaf_chunk_item() argument
966 if (unlikely(btrfs_item_size(leaf, slot) < sizeof(struct btrfs_chunk))) { in check_leaf_chunk_item()
969 btrfs_item_size(leaf, slot), in check_leaf_chunk_item()
981 btrfs_item_size(leaf, slot))) { in check_leaf_chunk_item()
984 btrfs_item_size(leaf, slot), in check_leaf_chunk_item()
994 static void dev_item_err(const struct extent_buffer *eb, int slot, in dev_item_err() argument
1001 btrfs_item_key_to_cpu(eb, &key, slot); in dev_item_err()
1010 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in dev_item_err()
1016 struct btrfs_key *key, int slot) in check_dev_item() argument
1019 const u32 item_size = btrfs_item_size(leaf, slot); in check_dev_item()
1022 dev_item_err(leaf, slot, in check_dev_item()
1029 dev_item_err(leaf, slot, "invalid item size: has %u expect %zu", in check_dev_item()
1034 ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item); in check_dev_item()
1036 dev_item_err(leaf, slot, in check_dev_item()
1049 dev_item_err(leaf, slot, in check_dev_item()
1063 struct btrfs_key *key, int slot) in check_inode_item() argument
1069 const u32 item_size = btrfs_item_size(leaf, slot); in check_inode_item()
1075 ret = check_inode_key(leaf, key, slot); in check_inode_item()
1080 generic_err(leaf, slot, "invalid item size: has %u expect %zu", in check_inode_item()
1085 iitem = btrfs_item_ptr(leaf, slot, struct btrfs_inode_item); in check_inode_item()
1089 inode_item_err(leaf, slot, in check_inode_item()
1097 inode_item_err(leaf, slot, in check_inode_item()
1110 inode_item_err(leaf, slot, in check_inode_item()
1123 inode_item_err(leaf, slot, in check_inode_item()
1130 inode_item_err(leaf, slot, in check_inode_item()
1137 inode_item_err(leaf, slot, in check_inode_item()
1143 inode_item_err(leaf, slot, in check_inode_item()
1152 int slot) in check_root_item() argument
1160 ret = check_root_key(leaf, key, slot); in check_root_item()
1164 if (unlikely(btrfs_item_size(leaf, slot) != sizeof(ri) && in check_root_item()
1165 btrfs_item_size(leaf, slot) != in check_root_item()
1167 generic_err(leaf, slot, in check_root_item()
1169 btrfs_item_size(leaf, slot), sizeof(ri), in check_root_item()
1179 read_extent_buffer(leaf, &ri, btrfs_item_ptr_offset(leaf, slot), in check_root_item()
1180 btrfs_item_size(leaf, slot)); in check_root_item()
1185 generic_err(leaf, slot, in check_root_item()
1193 generic_err(leaf, slot, in check_root_item()
1201 generic_err(leaf, slot, in check_root_item()
1210 generic_err(leaf, slot, in check_root_item()
1216 generic_err(leaf, slot, in check_root_item()
1222 generic_err(leaf, slot, in check_root_item()
1230 generic_err(leaf, slot, in check_root_item()
1240 static void extent_err(const struct extent_buffer *eb, int slot, in extent_err() argument
1249 btrfs_item_key_to_cpu(eb, &key, slot); in extent_err()
1265 eb->start, slot, bytenr, len, &vaf); in extent_err()
1283 struct btrfs_key *key, int slot, in check_extent_item() argument
1291 const u32 item_size = btrfs_item_size(leaf, slot); in check_extent_item()
1301 generic_err(leaf, slot, in check_extent_item()
1307 generic_err(leaf, slot, in check_extent_item()
1316 extent_err(leaf, slot, in check_extent_item()
1354 extent_err(leaf, slot, in check_extent_item()
1360 end = item_size + btrfs_item_ptr_offset(leaf, slot); in check_extent_item()
1363 ei = btrfs_item_ptr(leaf, slot, struct btrfs_extent_item); in check_extent_item()
1369 extent_err(leaf, slot, in check_extent_item()
1377 extent_err(leaf, slot, in check_extent_item()
1387 extent_err(leaf, slot, in check_extent_item()
1394 extent_err(leaf, slot, in check_extent_item()
1400 extent_err(leaf, slot, in check_extent_item()
1406 extent_err(leaf, slot, in check_extent_item()
1419 extent_err(leaf, slot, in check_extent_item()
1441 extent_err(leaf, slot, in check_extent_item()
1451 extent_err(leaf, slot, in check_extent_item()
1466 extent_err(leaf, slot, in check_extent_item()
1487 extent_err(leaf, slot, in check_extent_item()
1494 extent_err(leaf, slot, in check_extent_item()
1501 extent_err(leaf, slot, in check_extent_item()
1513 extent_err(leaf, slot, in check_extent_item()
1521 extent_err(leaf, slot, "unknown inline ref type: %u", in check_extent_item()
1526 extent_err(leaf, slot, in check_extent_item()
1535 extent_err(leaf, slot, in check_extent_item()
1547 extent_err(leaf, slot, in check_extent_item()
1554 extent_err(leaf, slot, in check_extent_item()
1570 extent_err(leaf, slot, in check_extent_item()
1583 struct btrfs_key *key, int slot) in check_simple_keyed_refs() argument
1590 if (unlikely(btrfs_item_size(leaf, slot) != expect_item_size)) { in check_simple_keyed_refs()
1591 generic_err(leaf, slot, in check_simple_keyed_refs()
1593 btrfs_item_size(leaf, slot), in check_simple_keyed_refs()
1598 generic_err(leaf, slot, in check_simple_keyed_refs()
1605 extent_err(leaf, slot, in check_simple_keyed_refs()
1614 struct btrfs_key *key, int slot) in check_extent_data_ref() argument
1617 unsigned long ptr = btrfs_item_ptr_offset(leaf, slot); in check_extent_data_ref()
1618 const unsigned long end = ptr + btrfs_item_size(leaf, slot); in check_extent_data_ref()
1620 if (unlikely(btrfs_item_size(leaf, slot) % sizeof(*dref) != 0)) { in check_extent_data_ref()
1621 generic_err(leaf, slot, in check_extent_data_ref()
1623 btrfs_item_size(leaf, slot), in check_extent_data_ref()
1628 generic_err(leaf, slot, in check_extent_data_ref()
1647 extent_err(leaf, slot, in check_extent_data_ref()
1654 extent_err(leaf, slot, in check_extent_data_ref()
1660 extent_err(leaf, slot, in check_extent_data_ref()
1669 #define inode_ref_err(eb, slot, fmt, args...) \ argument
1670 inode_item_err(eb, slot, fmt, ##args)
1673 int slot) in check_inode_ref() argument
1679 if (unlikely(!check_prev_ino(leaf, key, slot, prev_key))) in check_inode_ref()
1682 if (unlikely(btrfs_item_size(leaf, slot) <= sizeof(*iref))) { in check_inode_ref()
1683 inode_ref_err(leaf, slot, in check_inode_ref()
1685 btrfs_item_size(leaf, slot), in check_inode_ref()
1690 ptr = btrfs_item_ptr_offset(leaf, slot); in check_inode_ref()
1691 end = ptr + btrfs_item_size(leaf, slot); in check_inode_ref()
1696 inode_ref_err(leaf, slot, in check_inode_ref()
1705 inode_ref_err(leaf, slot, in check_inode_ref()
1723 int slot, in check_dev_extent_item() argument
1729 de = btrfs_item_ptr(leaf, slot, struct btrfs_dev_extent); in check_dev_extent_item()
1733 generic_err(leaf, slot, in check_dev_extent_item()
1741 generic_err(leaf, slot, in check_dev_extent_item()
1749 generic_err(leaf, slot, in check_dev_extent_item()
1756 generic_err(leaf, slot, in check_dev_extent_item()
1764 generic_err(leaf, slot, in check_dev_extent_item()
1770 if (slot && prev_key->objectid == key->objectid && in check_dev_extent_item()
1775 prev_de = btrfs_item_ptr(leaf, slot - 1, struct btrfs_dev_extent); in check_dev_extent_item()
1778 generic_err(leaf, slot, in check_dev_extent_item()
1792 int slot, in check_leaf_item() argument
1800 ret = check_extent_data_item(leaf, key, slot, prev_key); in check_leaf_item()
1803 ret = check_csum_item(leaf, key, slot, prev_key); in check_leaf_item()
1808 ret = check_dir_item(leaf, key, prev_key, slot); in check_leaf_item()
1811 ret = check_inode_ref(leaf, key, prev_key, slot); in check_leaf_item()
1814 ret = check_block_group_item(leaf, key, slot); in check_leaf_item()
1817 chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); in check_leaf_item()
1818 ret = check_leaf_chunk_item(leaf, chunk, key, slot); in check_leaf_item()
1821 ret = check_dev_item(leaf, key, slot); in check_leaf_item()
1824 ret = check_dev_extent_item(leaf, key, slot, prev_key); in check_leaf_item()
1827 ret = check_inode_item(leaf, key, slot); in check_leaf_item()
1830 ret = check_root_item(leaf, key, slot); in check_leaf_item()
1834 ret = check_extent_item(leaf, key, slot, prev_key); in check_leaf_item()
1839 ret = check_simple_keyed_refs(leaf, key, slot); in check_leaf_item()
1842 ret = check_extent_data_ref(leaf, key, slot); in check_leaf_item()
1858 int slot; in __btrfs_check_leaf() local
1925 for (slot = 0; slot < nritems; slot++) { in __btrfs_check_leaf()
1929 btrfs_item_key_to_cpu(leaf, &key, slot); in __btrfs_check_leaf()
1933 generic_err(leaf, slot, in __btrfs_check_leaf()
1941 item_data_end = (u64)btrfs_item_offset(leaf, slot) + in __btrfs_check_leaf()
1942 btrfs_item_size(leaf, slot); in __btrfs_check_leaf()
1948 if (slot == 0) in __btrfs_check_leaf()
1952 slot - 1); in __btrfs_check_leaf()
1954 generic_err(leaf, slot, in __btrfs_check_leaf()
1966 generic_err(leaf, slot, in __btrfs_check_leaf()
1973 if (unlikely(btrfs_item_ptr_offset(leaf, slot) < in __btrfs_check_leaf()
1974 btrfs_item_nr_offset(leaf, slot) + sizeof(struct btrfs_item))) { in __btrfs_check_leaf()
1975 generic_err(leaf, slot, in __btrfs_check_leaf()
1977 btrfs_item_nr_offset(leaf, slot) + in __btrfs_check_leaf()
1979 btrfs_item_ptr_offset(leaf, slot)); in __btrfs_check_leaf()
1994 ret = check_leaf_item(leaf, &key, slot, &prev_key); in __btrfs_check_leaf()
2023 int slot; in __btrfs_check_node() local
2042 for (slot = 0; slot < nr - 1; slot++) { in __btrfs_check_node()
2043 bytenr = btrfs_node_blockptr(node, slot); in __btrfs_check_node()
2044 btrfs_node_key_to_cpu(node, &key, slot); in __btrfs_check_node()
2045 btrfs_node_key_to_cpu(node, &next_key, slot + 1); in __btrfs_check_node()
2048 generic_err(node, slot, in __btrfs_check_node()
2053 generic_err(node, slot, in __btrfs_check_node()
2060 generic_err(node, slot, in __btrfs_check_node()