Lines Matching full:slot
51 * Append generic "corrupt leaf/node root=%llu block=%llu slot=%d: " to @fmt.
56 static void generic_err(const struct extent_buffer *eb, int slot, in generic_err() argument
70 "corrupt %s: root=%llu block=%llu slot=%d, %pV", in generic_err()
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()
98 "corrupt %s: root=%llu block=%llu slot=%d ino=%llu file_offset=%llu, %pV", 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()
159 "corrupt %s: root=%llu block=%llu slot=%d ino=%llu, %pV", 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()
674 "corrupt %s: root=%llu block=%llu slot=%d bg_start=%llu bg_len=%llu, %pV", 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
785 * Get the slot number by iterating through all slots, this in chunk_err()
791 slot = i; in chunk_err()
806 "corrupt leaf: root=%llu block=%llu slot=%d chunk_start=%llu, %pV", 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()
1031 "corrupt %s: root=%llu block=%llu slot=%d devid=%llu %pV", 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()
1287 "corrupt %s: block=%llu slot=%d extent bytenr=%llu len=%llu %pV", 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()
1537 extent_err(leaf, slot, in check_extent_item()
1548 extent_err(leaf, slot, "unknown inline ref type: %u", in check_extent_item()
1553 extent_err(leaf, slot, in check_extent_item()
1562 extent_err(leaf, slot, in check_extent_item()
1574 extent_err(leaf, slot, in check_extent_item()
1581 extent_err(leaf, slot, in check_extent_item()
1597 extent_err(leaf, slot, in check_extent_item()
1610 struct btrfs_key *key, int slot) in check_simple_keyed_refs() argument
1617 if (unlikely(btrfs_item_size(leaf, slot) != expect_item_size)) { in check_simple_keyed_refs()
1618 generic_err(leaf, slot, in check_simple_keyed_refs()
1620 btrfs_item_size(leaf, slot), in check_simple_keyed_refs()
1625 generic_err(leaf, slot, in check_simple_keyed_refs()
1632 extent_err(leaf, slot, in check_simple_keyed_refs()
1641 struct btrfs_key *key, int slot) in check_extent_data_ref() argument
1644 unsigned long ptr = btrfs_item_ptr_offset(leaf, slot); in check_extent_data_ref()
1645 const unsigned long end = ptr + btrfs_item_size(leaf, slot); in check_extent_data_ref()
1647 if (unlikely(btrfs_item_size(leaf, slot) % sizeof(*dref) != 0)) { in check_extent_data_ref()
1648 generic_err(leaf, slot, in check_extent_data_ref()
1650 btrfs_item_size(leaf, slot), in check_extent_data_ref()
1655 generic_err(leaf, slot, in check_extent_data_ref()
1674 extent_err(leaf, slot, in check_extent_data_ref()
1681 extent_err(leaf, slot, in check_extent_data_ref()
1687 extent_err(leaf, slot, in check_extent_data_ref()
1696 #define inode_ref_err(eb, slot, fmt, args...) \ argument
1697 inode_item_err(eb, slot, fmt, ##args)
1700 int slot) in check_inode_ref() argument
1706 if (unlikely(!check_prev_ino(leaf, key, slot, prev_key))) in check_inode_ref()
1709 if (unlikely(btrfs_item_size(leaf, slot) <= sizeof(*iref))) { in check_inode_ref()
1710 inode_ref_err(leaf, slot, in check_inode_ref()
1712 btrfs_item_size(leaf, slot), in check_inode_ref()
1717 ptr = btrfs_item_ptr_offset(leaf, slot); in check_inode_ref()
1718 end = ptr + btrfs_item_size(leaf, slot); in check_inode_ref()
1723 inode_ref_err(leaf, slot, in check_inode_ref()
1732 inode_ref_err(leaf, slot, in check_inode_ref()
1749 const struct btrfs_key *key, int slot) in check_raid_stripe_extent() argument
1752 generic_err(leaf, slot, in check_raid_stripe_extent()
1759 generic_err(leaf, slot, in check_raid_stripe_extent()
1769 int slot, in check_dev_extent_item() argument
1775 de = btrfs_item_ptr(leaf, slot, struct btrfs_dev_extent); in check_dev_extent_item()
1779 generic_err(leaf, slot, in check_dev_extent_item()
1787 generic_err(leaf, slot, in check_dev_extent_item()
1795 generic_err(leaf, slot, in check_dev_extent_item()
1802 generic_err(leaf, slot, in check_dev_extent_item()
1810 generic_err(leaf, slot, in check_dev_extent_item()
1816 if (slot && prev_key->objectid == key->objectid && in check_dev_extent_item()
1821 prev_de = btrfs_item_ptr(leaf, slot - 1, struct btrfs_dev_extent); in check_dev_extent_item()
1824 generic_err(leaf, slot, in check_dev_extent_item()
1838 int slot, in check_leaf_item() argument
1846 ret = check_extent_data_item(leaf, key, slot, prev_key); in check_leaf_item()
1849 ret = check_csum_item(leaf, key, slot, prev_key); in check_leaf_item()
1854 ret = check_dir_item(leaf, key, prev_key, slot); in check_leaf_item()
1857 ret = check_inode_ref(leaf, key, prev_key, slot); in check_leaf_item()
1860 ret = check_block_group_item(leaf, key, slot); in check_leaf_item()
1863 chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); in check_leaf_item()
1864 ret = check_leaf_chunk_item(leaf, chunk, key, slot); in check_leaf_item()
1867 ret = check_dev_item(leaf, key, slot); in check_leaf_item()
1870 ret = check_dev_extent_item(leaf, key, slot, prev_key); in check_leaf_item()
1873 ret = check_inode_item(leaf, key, slot); in check_leaf_item()
1876 ret = check_root_item(leaf, key, slot); in check_leaf_item()
1880 ret = check_extent_item(leaf, key, slot, prev_key); in check_leaf_item()
1885 ret = check_simple_keyed_refs(leaf, key, slot); in check_leaf_item()
1888 ret = check_extent_data_ref(leaf, key, slot); in check_leaf_item()
1891 ret = check_raid_stripe_extent(leaf, key, slot); in check_leaf_item()
1907 int slot; in __btrfs_check_leaf() local
1979 for (slot = 0; slot < nritems; slot++) { in __btrfs_check_leaf()
1984 btrfs_item_key_to_cpu(leaf, &key, slot); in __btrfs_check_leaf()
1988 generic_err(leaf, slot, in __btrfs_check_leaf()
1996 item_data_end = (u64)btrfs_item_offset(leaf, slot) + in __btrfs_check_leaf()
1997 btrfs_item_size(leaf, slot); in __btrfs_check_leaf()
2003 if (slot == 0) in __btrfs_check_leaf()
2007 slot - 1); in __btrfs_check_leaf()
2009 generic_err(leaf, slot, in __btrfs_check_leaf()
2021 generic_err(leaf, slot, in __btrfs_check_leaf()
2022 "slot end outside of leaf, have %llu expect range [0, %u]", in __btrfs_check_leaf()
2028 if (unlikely(btrfs_item_ptr_offset(leaf, slot) < in __btrfs_check_leaf()
2029 btrfs_item_nr_offset(leaf, slot) + sizeof(struct btrfs_item))) { in __btrfs_check_leaf()
2030 generic_err(leaf, slot, in __btrfs_check_leaf()
2031 "slot overlaps with its data, item end %lu data start %lu", in __btrfs_check_leaf()
2032 btrfs_item_nr_offset(leaf, slot) + in __btrfs_check_leaf()
2034 btrfs_item_ptr_offset(leaf, slot)); in __btrfs_check_leaf()
2039 ret = check_leaf_item(leaf, &key, slot, &prev_key); in __btrfs_check_leaf()
2067 int slot; in __btrfs_check_node() local
2091 for (slot = 0; slot < nr - 1; slot++) { in __btrfs_check_node()
2092 bytenr = btrfs_node_blockptr(node, slot); in __btrfs_check_node()
2093 btrfs_node_key_to_cpu(node, &key, slot); in __btrfs_check_node()
2094 btrfs_node_key_to_cpu(node, &next_key, slot + 1); in __btrfs_check_node()
2097 generic_err(node, slot, in __btrfs_check_node()
2102 generic_err(node, slot, in __btrfs_check_node()
2109 generic_err(node, slot, in __btrfs_check_node()