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()
1320 struct extent_buffer *leaf; in btrfs_create_tree() local
1337 leaf = btrfs_alloc_tree_block(trans, root, 0, objectid, NULL, 0, 0, 0); in btrfs_create_tree()
1338 if (IS_ERR(leaf)) { in btrfs_create_tree()
1339 ret = PTR_ERR(leaf); in btrfs_create_tree()
1340 leaf = NULL; in btrfs_create_tree()
1344 memset_extent_buffer(leaf, 0, 0, sizeof(struct btrfs_header)); in btrfs_create_tree()
1345 btrfs_set_header_bytenr(leaf, leaf->start); in btrfs_create_tree()
1346 btrfs_set_header_generation(leaf, trans->transid); in btrfs_create_tree()
1347 btrfs_set_header_backref_rev(leaf, BTRFS_MIXED_BACKREF_REV); in btrfs_create_tree()
1348 btrfs_set_header_owner(leaf, objectid); in btrfs_create_tree()
1349 root->node = leaf; in btrfs_create_tree()
1351 write_extent_buffer(leaf, fs_info->fsid, btrfs_header_fsid(), in btrfs_create_tree()
1353 write_extent_buffer(leaf, fs_info->chunk_tree_uuid, in btrfs_create_tree()
1354 btrfs_header_chunk_tree_uuid(leaf), in btrfs_create_tree()
1356 btrfs_mark_buffer_dirty(leaf); in btrfs_create_tree()
1363 btrfs_set_root_bytenr(&root->root_item, leaf->start); in btrfs_create_tree()
1367 btrfs_set_root_used(&root->root_item, leaf->len); in btrfs_create_tree()
1381 btrfs_tree_unlock(leaf); in btrfs_create_tree()
1386 if (leaf) { in btrfs_create_tree()
1387 btrfs_tree_unlock(leaf); in btrfs_create_tree()
1389 free_extent_buffer(leaf); in btrfs_create_tree()
1401 struct extent_buffer *leaf; in alloc_log_tree() local
1424 leaf = btrfs_alloc_tree_block(trans, root, 0, BTRFS_TREE_LOG_OBJECTID, in alloc_log_tree()
1426 if (IS_ERR(leaf)) { in alloc_log_tree()
1428 return ERR_CAST(leaf); in alloc_log_tree()
1431 memset_extent_buffer(leaf, 0, 0, sizeof(struct btrfs_header)); in alloc_log_tree()
1432 btrfs_set_header_bytenr(leaf, leaf->start); in alloc_log_tree()
1433 btrfs_set_header_generation(leaf, trans->transid); in alloc_log_tree()
1434 btrfs_set_header_backref_rev(leaf, BTRFS_MIXED_BACKREF_REV); in alloc_log_tree()
1435 btrfs_set_header_owner(leaf, BTRFS_TREE_LOG_OBJECTID); in alloc_log_tree()
1436 root->node = leaf; in alloc_log_tree()