Lines Matching full:slot
46 * Append generic "corrupt leaf/node root=%llu block=%llu slot=%d: " to @fmt.
51 static void generic_err(const struct extent_buffer *eb, int slot, in generic_err() argument
64 "corrupt %s: root=%llu block=%llu slot=%d, %pV", in generic_err()
66 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, &vaf); in generic_err()
76 static void file_extent_err(const struct extent_buffer *eb, int slot, in file_extent_err() argument
84 btrfs_item_key_to_cpu(eb, &key, slot); in file_extent_err()
91 "corrupt %s: root=%llu block=%llu slot=%d ino=%llu file_offset=%llu, %pV", in file_extent_err()
93 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in file_extent_err()
102 #define CHECK_FE_ALIGNED(leaf, slot, fi, name, alignment) \ argument
106 file_extent_err((leaf), (slot), \
136 static void dir_item_err(const struct extent_buffer *eb, int slot, in dir_item_err() argument
144 btrfs_item_key_to_cpu(eb, &key, slot); in dir_item_err()
151 "corrupt %s: root=%llu block=%llu slot=%d ino=%llu, %pV", in dir_item_err()
153 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in dir_item_err()
168 struct btrfs_key *key, int slot, in check_prev_ino() argument
172 if (slot == 0) in check_prev_ino()
193 dir_item_err(leaf, slot, in check_prev_ino()
199 struct btrfs_key *key, int slot, in check_extent_data_item() argument
205 u32 item_size = btrfs_item_size(leaf, slot); in check_extent_data_item()
209 file_extent_err(leaf, slot, in check_extent_data_item()
221 if (unlikely(!check_prev_ino(leaf, key, slot, prev_key))) in check_extent_data_item()
224 fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); in check_extent_data_item()
231 file_extent_err(leaf, slot, in check_extent_data_item()
239 file_extent_err(leaf, slot, in check_extent_data_item()
252 file_extent_err(leaf, slot, in check_extent_data_item()
259 file_extent_err(leaf, slot, in check_extent_data_item()
267 file_extent_err(leaf, slot, in check_extent_data_item()
281 file_extent_err(leaf, slot, in check_extent_data_item()
292 file_extent_err(leaf, slot, in check_extent_data_item()
297 if (unlikely(CHECK_FE_ALIGNED(leaf, slot, fi, ram_bytes, sectorsize) || in check_extent_data_item()
298 CHECK_FE_ALIGNED(leaf, slot, fi, disk_bytenr, sectorsize) || in check_extent_data_item()
299 CHECK_FE_ALIGNED(leaf, slot, fi, disk_num_bytes, sectorsize) || in check_extent_data_item()
300 CHECK_FE_ALIGNED(leaf, slot, fi, offset, sectorsize) || in check_extent_data_item()
301 CHECK_FE_ALIGNED(leaf, slot, fi, num_bytes, sectorsize))) in check_extent_data_item()
307 file_extent_err(leaf, slot, in check_extent_data_item()
318 if (slot > 0 && in check_extent_data_item()
324 prev_fi = btrfs_item_ptr(leaf, slot - 1, in check_extent_data_item()
328 file_extent_err(leaf, slot - 1, in check_extent_data_item()
339 int slot, struct btrfs_key *prev_key) in check_csum_item() argument
346 generic_err(leaf, slot, in check_csum_item()
352 generic_err(leaf, slot, in check_csum_item()
357 if (unlikely(!IS_ALIGNED(btrfs_item_size(leaf, slot), csumsize))) { in check_csum_item()
358 generic_err(leaf, slot, in check_csum_item()
360 btrfs_item_size(leaf, slot), csumsize); in check_csum_item()
363 if (slot > 0 && prev_key->type == BTRFS_EXTENT_CSUM_KEY) { in check_csum_item()
367 prev_item_size = btrfs_item_size(leaf, slot - 1); in check_csum_item()
371 generic_err(leaf, slot - 1, in check_csum_item()
381 #define inode_item_err(eb, slot, fmt, ...) \ argument
382 dir_item_err(eb, slot, fmt, __VA_ARGS__)
385 int slot) in check_inode_key() argument
390 btrfs_item_key_to_cpu(leaf, &item_key, slot); in check_inode_key()
406 generic_err(leaf, slot, in check_inode_key()
413 dir_item_err(leaf, slot, in check_inode_key()
424 inode_item_err(leaf, slot, in check_inode_key()
428 dir_item_err(leaf, slot, in check_inode_key()
437 int slot) in check_root_key() argument
442 btrfs_item_key_to_cpu(leaf, &item_key, slot); in check_root_key()
448 generic_err(leaf, slot, "invalid root id 0"); in check_root_key()
450 dir_item_err(leaf, slot, in check_root_key()
457 dir_item_err(leaf, slot, in check_root_key()
474 generic_err(leaf, slot, "invalid root id 0 for reloc tree"); in check_root_key()
482 int slot) in check_dir_item() argument
486 u32 item_size = btrfs_item_size(leaf, slot); in check_dir_item()
489 if (unlikely(!check_prev_ino(leaf, key, slot, prev_key))) in check_dir_item()
492 di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item); in check_dir_item()
505 dir_item_err(leaf, slot, in check_dir_item()
514 ret = check_root_key(leaf, &location_key, slot); in check_dir_item()
519 ret = check_inode_key(leaf, &location_key, slot); in check_dir_item()
523 dir_item_err(leaf, slot, in check_dir_item()
533 dir_item_err(leaf, slot, in check_dir_item()
541 dir_item_err(leaf, slot, in check_dir_item()
548 dir_item_err(leaf, slot, in check_dir_item()
561 dir_item_err(leaf, slot, in check_dir_item()
567 dir_item_err(leaf, slot, in check_dir_item()
575 dir_item_err(leaf, slot, in check_dir_item()
585 dir_item_err(leaf, slot, in check_dir_item()
603 dir_item_err(leaf, slot, in check_dir_item()
617 static void block_group_err(const struct extent_buffer *eb, int slot, in block_group_err() argument
625 btrfs_item_key_to_cpu(eb, &key, slot); in block_group_err()
632 "corrupt %s: root=%llu block=%llu slot=%d bg_start=%llu bg_len=%llu, %pV", in block_group_err()
634 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in block_group_err()
640 struct btrfs_key *key, int slot) in check_block_group_item() argument
644 u32 item_size = btrfs_item_size(leaf, slot); in check_block_group_item()
654 block_group_err(leaf, slot, in check_block_group_item()
660 block_group_err(leaf, slot, in check_block_group_item()
666 read_extent_buffer(leaf, &bgi, btrfs_item_ptr_offset(leaf, slot), in check_block_group_item()
678 block_group_err(leaf, slot, in check_block_group_item()
685 block_group_err(leaf, slot, in check_block_group_item()
693 block_group_err(leaf, slot, in check_block_group_item()
701 block_group_err(leaf, slot, in check_block_group_item()
714 block_group_err(leaf, slot, in check_block_group_item()
736 int slot = -1; in chunk_err() local
743 * Get the slot number by iterating through all slots, this in chunk_err()
749 slot = i; in chunk_err()
764 "corrupt leaf: root=%llu block=%llu slot=%d chunk_start=%llu, %pV", in chunk_err()
765 BTRFS_CHUNK_TREE_OBJECTID, leaf->start, slot, in chunk_err()
928 struct btrfs_key *key, int slot) in check_leaf_chunk_item() argument
932 if (unlikely(btrfs_item_size(leaf, slot) < sizeof(struct btrfs_chunk))) { in check_leaf_chunk_item()
935 btrfs_item_size(leaf, slot), in check_leaf_chunk_item()
947 btrfs_item_size(leaf, slot))) { in check_leaf_chunk_item()
950 btrfs_item_size(leaf, slot), in check_leaf_chunk_item()
960 static void dev_item_err(const struct extent_buffer *eb, int slot, in dev_item_err() argument
967 btrfs_item_key_to_cpu(eb, &key, slot); in dev_item_err()
974 "corrupt %s: root=%llu block=%llu slot=%d devid=%llu %pV", in dev_item_err()
976 btrfs_header_owner(eb), btrfs_header_bytenr(eb), slot, in dev_item_err()
982 struct btrfs_key *key, int slot) in check_dev_item() argument
985 const u32 item_size = btrfs_item_size(leaf, slot); in check_dev_item()
988 dev_item_err(leaf, slot, in check_dev_item()
995 dev_item_err(leaf, slot, "invalid item size: has %u expect %zu", in check_dev_item()
1000 ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item); in check_dev_item()
1002 dev_item_err(leaf, slot, in check_dev_item()
1015 dev_item_err(leaf, slot, in check_dev_item()
1029 struct btrfs_key *key, int slot) in check_inode_item() argument
1035 const u32 item_size = btrfs_item_size(leaf, slot); in check_inode_item()
1041 ret = check_inode_key(leaf, key, slot); in check_inode_item()
1046 generic_err(leaf, slot, "invalid item size: has %u expect %zu", in check_inode_item()
1051 iitem = btrfs_item_ptr(leaf, slot, struct btrfs_inode_item); in check_inode_item()
1055 inode_item_err(leaf, slot, in check_inode_item()
1063 inode_item_err(leaf, slot, in check_inode_item()
1076 inode_item_err(leaf, slot, in check_inode_item()
1089 inode_item_err(leaf, slot, in check_inode_item()
1096 inode_item_err(leaf, slot, in check_inode_item()
1103 inode_item_err(leaf, slot, in check_inode_item()
1109 inode_item_err(leaf, slot, in check_inode_item()
1118 int slot) in check_root_item() argument
1126 ret = check_root_key(leaf, key, slot); in check_root_item()
1130 if (unlikely(btrfs_item_size(leaf, slot) != sizeof(ri) && in check_root_item()
1131 btrfs_item_size(leaf, slot) != in check_root_item()
1133 generic_err(leaf, slot, in check_root_item()
1135 btrfs_item_size(leaf, slot), sizeof(ri), in check_root_item()
1145 read_extent_buffer(leaf, &ri, btrfs_item_ptr_offset(leaf, slot), in check_root_item()
1146 btrfs_item_size(leaf, slot)); in check_root_item()
1151 generic_err(leaf, slot, in check_root_item()
1159 generic_err(leaf, slot, in check_root_item()
1167 generic_err(leaf, slot, in check_root_item()
1176 generic_err(leaf, slot, in check_root_item()
1182 generic_err(leaf, slot, in check_root_item()
1188 generic_err(leaf, slot, in check_root_item()
1196 generic_err(leaf, slot, in check_root_item()
1206 static void extent_err(const struct extent_buffer *eb, int slot, in extent_err() argument
1215 btrfs_item_key_to_cpu(eb, &key, slot); in extent_err()
1229 "corrupt %s: block=%llu slot=%d extent bytenr=%llu len=%llu %pV", in extent_err()
1231 eb->start, slot, bytenr, len, &vaf); in extent_err()
1236 struct btrfs_key *key, int slot, in check_extent_item() argument
1244 const u32 item_size = btrfs_item_size(leaf, slot); in check_extent_item()
1252 generic_err(leaf, slot, in check_extent_item()
1258 generic_err(leaf, slot, in check_extent_item()
1267 extent_err(leaf, slot, in check_extent_item()
1293 extent_err(leaf, slot, in check_extent_item()
1299 end = item_size + btrfs_item_ptr_offset(leaf, slot); in check_extent_item()
1302 ei = btrfs_item_ptr(leaf, slot, struct btrfs_extent_item); in check_extent_item()
1308 extent_err(leaf, slot, in check_extent_item()
1316 extent_err(leaf, slot, in check_extent_item()
1326 extent_err(leaf, slot, in check_extent_item()
1333 extent_err(leaf, slot, in check_extent_item()
1339 extent_err(leaf, slot, in check_extent_item()
1345 extent_err(leaf, slot, in check_extent_item()
1358 extent_err(leaf, slot, in check_extent_item()
1377 extent_err(leaf, slot, in check_extent_item()
1386 extent_err(leaf, slot, in check_extent_item()
1401 extent_err(leaf, slot, in check_extent_item()
1417 extent_err(leaf, slot, in check_extent_item()
1429 extent_err(leaf, slot, in check_extent_item()
1437 extent_err(leaf, slot, "unknown inline ref type: %u", in check_extent_item()
1445 extent_err(leaf, slot, in check_extent_item()
1452 extent_err(leaf, slot, in check_extent_item()
1468 extent_err(leaf, slot, in check_extent_item()
1481 struct btrfs_key *key, int slot) in check_simple_keyed_refs() argument
1488 if (unlikely(btrfs_item_size(leaf, slot) != expect_item_size)) { in check_simple_keyed_refs()
1489 generic_err(leaf, slot, in check_simple_keyed_refs()
1491 btrfs_item_size(leaf, slot), in check_simple_keyed_refs()
1496 generic_err(leaf, slot, in check_simple_keyed_refs()
1503 extent_err(leaf, slot, in check_simple_keyed_refs()
1512 struct btrfs_key *key, int slot) in check_extent_data_ref() argument
1515 unsigned long ptr = btrfs_item_ptr_offset(leaf, slot); in check_extent_data_ref()
1516 const unsigned long end = ptr + btrfs_item_size(leaf, slot); in check_extent_data_ref()
1518 if (unlikely(btrfs_item_size(leaf, slot) % sizeof(*dref) != 0)) { in check_extent_data_ref()
1519 generic_err(leaf, slot, in check_extent_data_ref()
1521 btrfs_item_size(leaf, slot), in check_extent_data_ref()
1526 generic_err(leaf, slot, in check_extent_data_ref()
1541 extent_err(leaf, slot, in check_extent_data_ref()
1550 #define inode_ref_err(eb, slot, fmt, args...) \ argument
1551 inode_item_err(eb, slot, fmt, ##args)
1554 int slot) in check_inode_ref() argument
1560 if (unlikely(!check_prev_ino(leaf, key, slot, prev_key))) in check_inode_ref()
1563 if (unlikely(btrfs_item_size(leaf, slot) <= sizeof(*iref))) { in check_inode_ref()
1564 inode_ref_err(leaf, slot, in check_inode_ref()
1566 btrfs_item_size(leaf, slot), in check_inode_ref()
1571 ptr = btrfs_item_ptr_offset(leaf, slot); in check_inode_ref()
1572 end = ptr + btrfs_item_size(leaf, slot); in check_inode_ref()
1577 inode_ref_err(leaf, slot, in check_inode_ref()
1586 inode_ref_err(leaf, slot, in check_inode_ref()
1606 struct btrfs_key *key, int slot, in check_leaf_item() argument
1614 ret = check_extent_data_item(leaf, key, slot, prev_key); in check_leaf_item()
1617 ret = check_csum_item(leaf, key, slot, prev_key); in check_leaf_item()
1622 ret = check_dir_item(leaf, key, prev_key, slot); in check_leaf_item()
1625 ret = check_inode_ref(leaf, key, prev_key, slot); in check_leaf_item()
1628 ret = check_block_group_item(leaf, key, slot); in check_leaf_item()
1631 chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); in check_leaf_item()
1632 ret = check_leaf_chunk_item(leaf, chunk, key, slot); in check_leaf_item()
1635 ret = check_dev_item(leaf, key, slot); in check_leaf_item()
1638 ret = check_inode_item(leaf, key, slot); in check_leaf_item()
1641 ret = check_root_item(leaf, key, slot); in check_leaf_item()
1645 ret = check_extent_item(leaf, key, slot, prev_key); in check_leaf_item()
1650 ret = check_simple_keyed_refs(leaf, key, slot); in check_leaf_item()
1653 ret = check_extent_data_ref(leaf, key, slot); in check_leaf_item()
1666 int slot; in check_leaf() local
1733 for (slot = 0; slot < nritems; slot++) { in check_leaf()
1738 btrfs_item_key_to_cpu(leaf, &key, slot); in check_leaf()
1742 generic_err(leaf, slot, in check_leaf()
1750 item_data_end = (u64)btrfs_item_offset(leaf, slot) + in check_leaf()
1751 btrfs_item_size(leaf, slot); in check_leaf()
1757 if (slot == 0) in check_leaf()
1761 slot - 1); in check_leaf()
1763 generic_err(leaf, slot, in check_leaf()
1775 generic_err(leaf, slot, in check_leaf()
1776 "slot end outside of leaf, have %llu expect range [0, %u]", in check_leaf()
1782 if (unlikely(btrfs_item_ptr_offset(leaf, slot) < in check_leaf()
1783 btrfs_item_nr_offset(slot) + sizeof(struct btrfs_item))) { in check_leaf()
1784 generic_err(leaf, slot, in check_leaf()
1785 "slot overlaps with its data, item end %lu data start %lu", in check_leaf()
1786 btrfs_item_nr_offset(slot) + in check_leaf()
1788 btrfs_item_ptr_offset(leaf, slot)); in check_leaf()
1797 ret = check_leaf_item(leaf, &key, slot, &prev_key); in check_leaf()
1826 int slot; in btrfs_check_node() local
1846 for (slot = 0; slot < nr - 1; slot++) { in btrfs_check_node()
1847 bytenr = btrfs_node_blockptr(node, slot); in btrfs_check_node()
1848 btrfs_node_key_to_cpu(node, &key, slot); in btrfs_check_node()
1849 btrfs_node_key_to_cpu(node, &next_key, slot + 1); in btrfs_check_node()
1852 generic_err(node, slot, in btrfs_check_node()
1858 generic_err(node, slot, in btrfs_check_node()
1866 generic_err(node, slot, in btrfs_check_node()