Lines Matching refs:leaf
539 struct extent_buffer *leaf) in check_leaf() argument
543 u32 nritems = btrfs_header_nritems(leaf); in check_leaf()
550 if (btrfs_item_offset_nr(leaf, 0) + btrfs_item_size_nr(leaf, 0) != in check_leaf()
552 CORRUPT("invalid item offset size pair", leaf, root, 0); in check_leaf()
564 btrfs_item_key_to_cpu(leaf, &leaf_key, slot); in check_leaf()
565 btrfs_item_key_to_cpu(leaf, &key, slot + 1); in check_leaf()
569 CORRUPT("bad key order", leaf, root, slot); in check_leaf()
578 if (btrfs_item_offset_nr(leaf, slot) != in check_leaf()
579 btrfs_item_end_nr(leaf, slot + 1)) { in check_leaf()
580 CORRUPT("slot offset bad", leaf, root, slot); in check_leaf()
589 if (btrfs_item_end_nr(leaf, slot) > in check_leaf()
591 CORRUPT("slot end outside of leaf", leaf, root, slot); in check_leaf()
1311 struct extent_buffer *leaf; in btrfs_create_tree() local
1328 leaf = btrfs_alloc_tree_block(trans, root, 0, objectid, NULL, 0, 0, 0); in btrfs_create_tree()
1329 if (IS_ERR(leaf)) { in btrfs_create_tree()
1330 ret = PTR_ERR(leaf); in btrfs_create_tree()
1331 leaf = NULL; in btrfs_create_tree()
1335 memset_extent_buffer(leaf, 0, 0, sizeof(struct btrfs_header)); in btrfs_create_tree()
1336 btrfs_set_header_bytenr(leaf, leaf->start); in btrfs_create_tree()
1337 btrfs_set_header_generation(leaf, trans->transid); in btrfs_create_tree()
1338 btrfs_set_header_backref_rev(leaf, BTRFS_MIXED_BACKREF_REV); in btrfs_create_tree()
1339 btrfs_set_header_owner(leaf, objectid); in btrfs_create_tree()
1340 root->node = leaf; in btrfs_create_tree()
1342 write_extent_buffer(leaf, fs_info->fsid, btrfs_header_fsid(), in btrfs_create_tree()
1344 write_extent_buffer(leaf, fs_info->chunk_tree_uuid, in btrfs_create_tree()
1345 btrfs_header_chunk_tree_uuid(leaf), in btrfs_create_tree()
1347 btrfs_mark_buffer_dirty(leaf); in btrfs_create_tree()
1354 btrfs_set_root_bytenr(&root->root_item, leaf->start); in btrfs_create_tree()
1358 btrfs_set_root_used(&root->root_item, leaf->len); in btrfs_create_tree()
1372 btrfs_tree_unlock(leaf); in btrfs_create_tree()
1377 if (leaf) { in btrfs_create_tree()
1378 btrfs_tree_unlock(leaf); in btrfs_create_tree()
1380 free_extent_buffer(leaf); in btrfs_create_tree()
1392 struct extent_buffer *leaf; in alloc_log_tree() local
1415 leaf = btrfs_alloc_tree_block(trans, root, 0, BTRFS_TREE_LOG_OBJECTID, in alloc_log_tree()
1417 if (IS_ERR(leaf)) { in alloc_log_tree()
1419 return ERR_CAST(leaf); in alloc_log_tree()
1422 memset_extent_buffer(leaf, 0, 0, sizeof(struct btrfs_header)); in alloc_log_tree()
1423 btrfs_set_header_bytenr(leaf, leaf->start); in alloc_log_tree()
1424 btrfs_set_header_generation(leaf, trans->transid); in alloc_log_tree()
1425 btrfs_set_header_backref_rev(leaf, BTRFS_MIXED_BACKREF_REV); in alloc_log_tree()
1426 btrfs_set_header_owner(leaf, BTRFS_TREE_LOG_OBJECTID); in alloc_log_tree()
1427 root->node = leaf; in alloc_log_tree()