Lines Matching refs:slot
56 static void generic_err(const struct extent_buffer *eb, int slot, in generic_err() argument
72 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, &vaf); in generic_err()
82 static void file_extent_err(const struct extent_buffer *eb, int slot, in file_extent_err() argument
90 btrfs_item_key_to_cpu(eb, &key, slot); in file_extent_err()
100 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in file_extent_err()
109 #define CHECK_FE_ALIGNED(leaf, slot, fi, name, alignment) \ argument
113 file_extent_err((leaf), (slot), \
143 static void dir_item_err(const struct extent_buffer *eb, int slot, in dir_item_err() argument
151 btrfs_item_key_to_cpu(eb, &key, slot); in dir_item_err()
161 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in dir_item_err()
176 struct btrfs_key *key, int slot, in check_prev_ino() argument
180 if (slot == 0) in check_prev_ino()
201 dir_item_err(leaf, slot, in check_prev_ino()
207 struct btrfs_key *key, int slot, in check_extent_data_item() argument
213 u32 item_size = btrfs_item_size(leaf, slot); in check_extent_data_item()
217 file_extent_err(leaf, slot, in check_extent_data_item()
229 if (unlikely(!check_prev_ino(leaf, key, slot, prev_key))) in check_extent_data_item()
232 fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); in check_extent_data_item()
239 file_extent_err(leaf, slot, in check_extent_data_item()
247 file_extent_err(leaf, slot, in check_extent_data_item()
260 file_extent_err(leaf, slot, in check_extent_data_item()
267 file_extent_err(leaf, slot, in check_extent_data_item()
275 file_extent_err(leaf, slot, in check_extent_data_item()
289 file_extent_err(leaf, slot, in check_extent_data_item()
300 file_extent_err(leaf, slot, in check_extent_data_item()
305 if (unlikely(CHECK_FE_ALIGNED(leaf, slot, fi, ram_bytes, sectorsize) || in check_extent_data_item()
306 CHECK_FE_ALIGNED(leaf, slot, fi, disk_bytenr, sectorsize) || in check_extent_data_item()
307 CHECK_FE_ALIGNED(leaf, slot, fi, disk_num_bytes, sectorsize) || in check_extent_data_item()
308 CHECK_FE_ALIGNED(leaf, slot, fi, offset, sectorsize) || in check_extent_data_item()
309 CHECK_FE_ALIGNED(leaf, slot, fi, num_bytes, sectorsize))) in check_extent_data_item()
315 file_extent_err(leaf, slot, in check_extent_data_item()
326 if (slot > 0 && in check_extent_data_item()
332 prev_fi = btrfs_item_ptr(leaf, slot - 1, in check_extent_data_item()
336 file_extent_err(leaf, slot - 1, in check_extent_data_item()
355 file_extent_err(leaf, slot, in check_extent_data_item()
365 int slot, struct btrfs_key *prev_key) in check_csum_item() argument
372 generic_err(leaf, slot, in check_csum_item()
378 generic_err(leaf, slot, in check_csum_item()
383 if (unlikely(!IS_ALIGNED(btrfs_item_size(leaf, slot), csumsize))) { in check_csum_item()
384 generic_err(leaf, slot, in check_csum_item()
386 btrfs_item_size(leaf, slot), csumsize); in check_csum_item()
389 if (slot > 0 && prev_key->type == BTRFS_EXTENT_CSUM_KEY) { in check_csum_item()
393 prev_item_size = btrfs_item_size(leaf, slot - 1); in check_csum_item()
397 generic_err(leaf, slot - 1, in check_csum_item()
407 #define inode_item_err(eb, slot, fmt, ...) \ argument
408 dir_item_err(eb, slot, fmt, __VA_ARGS__)
411 int slot) in check_inode_key() argument
416 btrfs_item_key_to_cpu(leaf, &item_key, slot); in check_inode_key()
432 generic_err(leaf, slot, in check_inode_key()
439 dir_item_err(leaf, slot, in check_inode_key()
450 inode_item_err(leaf, slot, in check_inode_key()
454 dir_item_err(leaf, slot, in check_inode_key()
463 int slot) in check_root_key() argument
468 btrfs_item_key_to_cpu(leaf, &item_key, slot); in check_root_key()
479 generic_err(leaf, slot, in check_root_key()
488 generic_err(leaf, slot, "invalid root id 0"); in check_root_key()
490 dir_item_err(leaf, slot, in check_root_key()
497 dir_item_err(leaf, slot, in check_root_key()
514 generic_err(leaf, slot, "invalid root id 0 for reloc tree"); in check_root_key()
522 int slot) in check_dir_item() argument
526 u32 item_size = btrfs_item_size(leaf, slot); in check_dir_item()
529 if (unlikely(!check_prev_ino(leaf, key, slot, prev_key))) in check_dir_item()
532 di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item); in check_dir_item()
545 dir_item_err(leaf, slot, in check_dir_item()
554 ret = check_root_key(leaf, &location_key, slot); in check_dir_item()
559 ret = check_inode_key(leaf, &location_key, slot); in check_dir_item()
563 dir_item_err(leaf, slot, in check_dir_item()
574 dir_item_err(leaf, slot, in check_dir_item()
582 dir_item_err(leaf, slot, in check_dir_item()
589 dir_item_err(leaf, slot, in check_dir_item()
602 dir_item_err(leaf, slot, in check_dir_item()
608 dir_item_err(leaf, slot, in check_dir_item()
616 dir_item_err(leaf, slot, in check_dir_item()
626 dir_item_err(leaf, slot, in check_dir_item()
644 dir_item_err(leaf, slot, in check_dir_item()
658 static void block_group_err(const struct extent_buffer *eb, int slot, in block_group_err() argument
666 btrfs_item_key_to_cpu(eb, &key, slot); in block_group_err()
676 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in block_group_err()
682 struct btrfs_key *key, int slot) in check_block_group_item() argument
686 u32 item_size = btrfs_item_size(leaf, slot); in check_block_group_item()
696 block_group_err(leaf, slot, in check_block_group_item()
702 block_group_err(leaf, slot, in check_block_group_item()
708 read_extent_buffer(leaf, &bgi, btrfs_item_ptr_offset(leaf, slot), in check_block_group_item()
720 block_group_err(leaf, slot, in check_block_group_item()
727 block_group_err(leaf, slot, in check_block_group_item()
735 block_group_err(leaf, slot, in check_block_group_item()
743 block_group_err(leaf, slot, in check_block_group_item()
756 block_group_err(leaf, slot, in check_block_group_item()
778 int slot = -1; in chunk_err() local
791 slot = i; in chunk_err()
807 BTRFS_CHUNK_TREE_OBJECTID, leaf->start, slot, in chunk_err()
984 struct btrfs_key *key, int slot) in check_leaf_chunk_item() argument
988 if (unlikely(btrfs_item_size(leaf, slot) < sizeof(struct btrfs_chunk))) { in check_leaf_chunk_item()
991 btrfs_item_size(leaf, slot), in check_leaf_chunk_item()
1003 btrfs_item_size(leaf, slot))) { in check_leaf_chunk_item()
1006 btrfs_item_size(leaf, slot), in check_leaf_chunk_item()
1016 static void dev_item_err(const struct extent_buffer *eb, int slot, in dev_item_err() argument
1023 btrfs_item_key_to_cpu(eb, &key, slot); in dev_item_err()
1033 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in dev_item_err()
1039 struct btrfs_key *key, int slot) in check_dev_item() argument
1042 const u32 item_size = btrfs_item_size(leaf, slot); in check_dev_item()
1045 dev_item_err(leaf, slot, in check_dev_item()
1052 dev_item_err(leaf, slot, "invalid item size: has %u expect %zu", in check_dev_item()
1057 ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item); in check_dev_item()
1059 dev_item_err(leaf, slot, in check_dev_item()
1072 dev_item_err(leaf, slot, in check_dev_item()
1086 struct btrfs_key *key, int slot) in check_inode_item() argument
1092 const u32 item_size = btrfs_item_size(leaf, slot); in check_inode_item()
1098 ret = check_inode_key(leaf, key, slot); in check_inode_item()
1103 generic_err(leaf, slot, "invalid item size: has %u expect %zu", in check_inode_item()
1108 iitem = btrfs_item_ptr(leaf, slot, struct btrfs_inode_item); in check_inode_item()
1112 inode_item_err(leaf, slot, in check_inode_item()
1120 inode_item_err(leaf, slot, in check_inode_item()
1133 inode_item_err(leaf, slot, in check_inode_item()
1146 inode_item_err(leaf, slot, in check_inode_item()
1153 inode_item_err(leaf, slot, in check_inode_item()
1160 inode_item_err(leaf, slot, in check_inode_item()
1166 inode_item_err(leaf, slot, in check_inode_item()
1175 int slot) in check_root_item() argument
1183 ret = check_root_key(leaf, key, slot); in check_root_item()
1187 if (unlikely(btrfs_item_size(leaf, slot) != sizeof(ri) && in check_root_item()
1188 btrfs_item_size(leaf, slot) != in check_root_item()
1190 generic_err(leaf, slot, in check_root_item()
1192 btrfs_item_size(leaf, slot), sizeof(ri), in check_root_item()
1202 read_extent_buffer(leaf, &ri, btrfs_item_ptr_offset(leaf, slot), in check_root_item()
1203 btrfs_item_size(leaf, slot)); in check_root_item()
1208 generic_err(leaf, slot, in check_root_item()
1216 generic_err(leaf, slot, in check_root_item()
1224 generic_err(leaf, slot, in check_root_item()
1233 generic_err(leaf, slot, in check_root_item()
1239 generic_err(leaf, slot, in check_root_item()
1245 generic_err(leaf, slot, in check_root_item()
1253 generic_err(leaf, slot, in check_root_item()
1263 static void extent_err(const struct extent_buffer *eb, int slot, in extent_err() argument
1272 btrfs_item_key_to_cpu(eb, &key, slot); in extent_err()
1289 eb->start, slot, bytenr, len, &vaf); in extent_err()
1307 struct btrfs_key *key, int slot, in check_extent_item() argument
1315 const u32 item_size = btrfs_item_size(leaf, slot); in check_extent_item()
1325 generic_err(leaf, slot, in check_extent_item()
1331 generic_err(leaf, slot, in check_extent_item()
1340 extent_err(leaf, slot, in check_extent_item()
1378 extent_err(leaf, slot, in check_extent_item()
1384 end = item_size + btrfs_item_ptr_offset(leaf, slot); in check_extent_item()
1387 ei = btrfs_item_ptr(leaf, slot, struct btrfs_extent_item); in check_extent_item()
1393 extent_err(leaf, slot, in check_extent_item()
1401 extent_err(leaf, slot, in check_extent_item()
1411 extent_err(leaf, slot, in check_extent_item()
1418 extent_err(leaf, slot, in check_extent_item()
1424 extent_err(leaf, slot, in check_extent_item()
1430 extent_err(leaf, slot, in check_extent_item()
1443 extent_err(leaf, slot, in check_extent_item()
1465 extent_err(leaf, slot, in check_extent_item()
1475 extent_err(leaf, slot, in check_extent_item()
1490 extent_err(leaf, slot, in check_extent_item()
1511 extent_err(leaf, slot, in check_extent_item()
1518 extent_err(leaf, slot, in check_extent_item()
1525 extent_err(leaf, slot, in check_extent_item()
1531 extent_err(leaf, slot, in check_extent_item()
1542 extent_err(leaf, slot, in check_extent_item()
1548 extent_err(leaf, slot, in check_extent_item()
1558 extent_err(leaf, slot, "unknown inline ref type: %u", in check_extent_item()
1563 extent_err(leaf, slot, in check_extent_item()
1572 extent_err(leaf, slot, in check_extent_item()
1584 extent_err(leaf, slot, in check_extent_item()
1591 extent_err(leaf, slot, in check_extent_item()
1607 extent_err(leaf, slot, in check_extent_item()
1620 struct btrfs_key *key, int slot) in check_simple_keyed_refs() argument
1627 sref = btrfs_item_ptr(leaf, slot, struct btrfs_shared_data_ref); in check_simple_keyed_refs()
1629 extent_err(leaf, slot, in check_simple_keyed_refs()
1637 if (unlikely(btrfs_item_size(leaf, slot) != expect_item_size)) { in check_simple_keyed_refs()
1638 generic_err(leaf, slot, in check_simple_keyed_refs()
1640 btrfs_item_size(leaf, slot), in check_simple_keyed_refs()
1645 generic_err(leaf, slot, in check_simple_keyed_refs()
1652 extent_err(leaf, slot, in check_simple_keyed_refs()
1661 struct btrfs_key *key, int slot) in check_extent_data_ref() argument
1664 unsigned long ptr = btrfs_item_ptr_offset(leaf, slot); in check_extent_data_ref()
1665 const unsigned long end = ptr + btrfs_item_size(leaf, slot); in check_extent_data_ref()
1667 if (unlikely(btrfs_item_size(leaf, slot) % sizeof(*dref) != 0)) { in check_extent_data_ref()
1668 generic_err(leaf, slot, in check_extent_data_ref()
1670 btrfs_item_size(leaf, slot), in check_extent_data_ref()
1675 generic_err(leaf, slot, in check_extent_data_ref()
1694 extent_err(leaf, slot, in check_extent_data_ref()
1701 extent_err(leaf, slot, in check_extent_data_ref()
1707 extent_err(leaf, slot, in check_extent_data_ref()
1713 extent_err(leaf, slot, in check_extent_data_ref()
1721 #define inode_ref_err(eb, slot, fmt, args...) \ argument
1722 inode_item_err(eb, slot, fmt, ##args)
1725 int slot) in check_inode_ref() argument
1731 if (unlikely(!check_prev_ino(leaf, key, slot, prev_key))) in check_inode_ref()
1734 if (unlikely(btrfs_item_size(leaf, slot) <= sizeof(*iref))) { in check_inode_ref()
1735 inode_ref_err(leaf, slot, in check_inode_ref()
1737 btrfs_item_size(leaf, slot), in check_inode_ref()
1742 ptr = btrfs_item_ptr_offset(leaf, slot); in check_inode_ref()
1743 end = ptr + btrfs_item_size(leaf, slot); in check_inode_ref()
1748 inode_ref_err(leaf, slot, in check_inode_ref()
1757 inode_ref_err(leaf, slot, in check_inode_ref()
1774 const struct btrfs_key *key, int slot) in check_raid_stripe_extent() argument
1777 generic_err(leaf, slot, in check_raid_stripe_extent()
1784 generic_err(leaf, slot, in check_raid_stripe_extent()
1794 int slot, in check_dev_extent_item() argument
1800 de = btrfs_item_ptr(leaf, slot, struct btrfs_dev_extent); in check_dev_extent_item()
1804 generic_err(leaf, slot, in check_dev_extent_item()
1812 generic_err(leaf, slot, in check_dev_extent_item()
1820 generic_err(leaf, slot, in check_dev_extent_item()
1827 generic_err(leaf, slot, in check_dev_extent_item()
1835 generic_err(leaf, slot, in check_dev_extent_item()
1841 if (slot && prev_key->objectid == key->objectid && in check_dev_extent_item()
1846 prev_de = btrfs_item_ptr(leaf, slot - 1, struct btrfs_dev_extent); in check_dev_extent_item()
1849 generic_err(leaf, slot, in check_dev_extent_item()
1863 int slot, in check_leaf_item() argument
1871 ret = check_extent_data_item(leaf, key, slot, prev_key); in check_leaf_item()
1874 ret = check_csum_item(leaf, key, slot, prev_key); in check_leaf_item()
1879 ret = check_dir_item(leaf, key, prev_key, slot); in check_leaf_item()
1882 ret = check_inode_ref(leaf, key, prev_key, slot); in check_leaf_item()
1885 ret = check_block_group_item(leaf, key, slot); in check_leaf_item()
1888 chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); in check_leaf_item()
1889 ret = check_leaf_chunk_item(leaf, chunk, key, slot); in check_leaf_item()
1892 ret = check_dev_item(leaf, key, slot); in check_leaf_item()
1895 ret = check_dev_extent_item(leaf, key, slot, prev_key); in check_leaf_item()
1898 ret = check_inode_item(leaf, key, slot); in check_leaf_item()
1901 ret = check_root_item(leaf, key, slot); in check_leaf_item()
1905 ret = check_extent_item(leaf, key, slot, prev_key); in check_leaf_item()
1910 ret = check_simple_keyed_refs(leaf, key, slot); in check_leaf_item()
1913 ret = check_extent_data_ref(leaf, key, slot); in check_leaf_item()
1916 ret = check_raid_stripe_extent(leaf, key, slot); in check_leaf_item()
1932 int slot; in __btrfs_check_leaf() local
2004 for (slot = 0; slot < nritems; slot++) { in __btrfs_check_leaf()
2009 btrfs_item_key_to_cpu(leaf, &key, slot); in __btrfs_check_leaf()
2013 generic_err(leaf, slot, in __btrfs_check_leaf()
2021 item_data_end = (u64)btrfs_item_offset(leaf, slot) + in __btrfs_check_leaf()
2022 btrfs_item_size(leaf, slot); in __btrfs_check_leaf()
2028 if (slot == 0) in __btrfs_check_leaf()
2032 slot - 1); in __btrfs_check_leaf()
2034 generic_err(leaf, slot, in __btrfs_check_leaf()
2046 generic_err(leaf, slot, in __btrfs_check_leaf()
2053 if (unlikely(btrfs_item_ptr_offset(leaf, slot) < in __btrfs_check_leaf()
2054 btrfs_item_nr_offset(leaf, slot) + sizeof(struct btrfs_item))) { in __btrfs_check_leaf()
2055 generic_err(leaf, slot, in __btrfs_check_leaf()
2057 btrfs_item_nr_offset(leaf, slot) + in __btrfs_check_leaf()
2059 btrfs_item_ptr_offset(leaf, slot)); in __btrfs_check_leaf()
2064 ret = check_leaf_item(leaf, &key, slot, &prev_key); in __btrfs_check_leaf()
2092 int slot; in __btrfs_check_node() local
2116 for (slot = 0; slot < nr - 1; slot++) { in __btrfs_check_node()
2117 bytenr = btrfs_node_blockptr(node, slot); in __btrfs_check_node()
2118 btrfs_node_key_to_cpu(node, &key, slot); in __btrfs_check_node()
2119 btrfs_node_key_to_cpu(node, &next_key, slot + 1); in __btrfs_check_node()
2122 generic_err(node, slot, in __btrfs_check_node()
2127 generic_err(node, slot, in __btrfs_check_node()
2134 generic_err(node, slot, in __btrfs_check_node()