btrfs_set_header_nritems(&c->header, 1);
btrfs_set_header_level(&c->header, level);
btrfs_set_header_blocknr(&c->header, t->blocknr);
- btrfs_set_header_parentid(&c->header,
- btrfs_header_parentid(&root->node->node.header));
lower = &path->nodes[level-1]->node;
if (btrfs_is_leaf(lower))
lower_key = &((struct btrfs_leaf *)lower)->items[0].key;
btrfs_set_header_flags(&split->header, btrfs_header_flags(&c->header));
btrfs_set_header_level(&split->header, btrfs_header_level(&c->header));
btrfs_set_header_blocknr(&split->header, split_buffer->blocknr);
- btrfs_set_header_parentid(&split->header,
- btrfs_header_parentid(&root->node->node.header));
mid = (c_nritems + 1) / 2;
memcpy(split->ptrs, c->ptrs + mid,
(c_nritems - mid) * sizeof(struct btrfs_key_ptr));
btrfs_set_header_nritems(&right->header, nritems - mid);
btrfs_set_header_blocknr(&right->header, right_buffer->blocknr);
btrfs_set_header_level(&right->header, 0);
- btrfs_set_header_parentid(&right->header,
- btrfs_header_parentid(&root->node->node.header));
data_copy_size = btrfs_item_end(l->items + mid) -
leaf_data_end(root, l);
memcpy(right->items, l->items + mid,
u8 fsid[16]; /* FS specific uuid */
__le64 blocknr; /* which block this node is supposed to live in */
__le64 generation;
- __le64 parentid; /* objectid of the tree root */
__le16 nritems;
__le16 flags;
u8 level;
*/
struct btrfs_extent_item {
__le32 refs;
- __le64 owner;
} __attribute__ ((__packed__));
struct btrfs_inode_timespec {
ts->nsec = cpu_to_le32(val);
}
-static inline u64 btrfs_extent_owner(struct btrfs_extent_item *ei)
-{
- return le64_to_cpu(ei->owner);
-}
-
-static inline void btrfs_set_extent_owner(struct btrfs_extent_item *ei, u64 val)
-{
- ei->owner = cpu_to_le64(val);
-}
-
static inline u32 btrfs_extent_refs(struct btrfs_extent_item *ei)
{
return le32_to_cpu(ei->refs);
h->generation = cpu_to_le64(val);
}
-static inline u64 btrfs_header_parentid(struct btrfs_header *h)
-{
- return le64_to_cpu(h->parentid);
-}
-
-static inline void btrfs_set_header_parentid(struct btrfs_header *h,
- u64 parentid)
-{
- h->parentid = cpu_to_le64(parentid);
-}
-
static inline u16 btrfs_header_nritems(struct btrfs_header *h)
{
return le16_to_cpu(h->nritems);
struct btrfs_fs_info *info = extent_root->fs_info;
btrfs_set_extent_refs(&extent_item, 1);
- btrfs_set_extent_owner(&extent_item,
- btrfs_header_parentid(&extent_root->node->node.header));
ins.offset = 1;
ins.flags = 0;
btrfs_set_key_type(&ins, BTRFS_EXTENT_ITEM_KEY);
*/
static int alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root
*root, u64 num_blocks, u64 search_start, u64
- search_end, u64 owner, struct btrfs_key *ins)
+ search_end, struct btrfs_key *ins)
{
int ret;
int pending_ret;
struct btrfs_extent_item extent_item;
btrfs_set_extent_refs(&extent_item, 1);
- btrfs_set_extent_owner(&extent_item, owner);
if (root == extent_root) {
BUG_ON(extent_root->fs_info->current_insert.offset == 0);
int ret;
struct btrfs_buffer *buf;
- ret = alloc_extent(trans, root, 1, 0, (unsigned long)-1,
- btrfs_header_parentid(&root->node->node.header),
- &ins);
+ ret = alloc_extent(trans, root, 1, 0, (unsigned long)-1, &ins);
if (ret) {
BUG();
return NULL;
/* create the tree of root objects */
empty_leaf = malloc(blocksize);
memset(empty_leaf, 0, blocksize);
- btrfs_set_header_parentid(&empty_leaf->header,
- BTRFS_ROOT_TREE_OBJECTID);
btrfs_set_header_blocknr(&empty_leaf->header, start_block + 1);
btrfs_set_header_nritems(&empty_leaf->header, 2);
btrfs_set_header_generation(&empty_leaf->header, 0);
ret = pwrite(fd, empty_leaf, blocksize, (start_block + 1) * blocksize);
/* create the items for the extent tree */
- btrfs_set_header_parentid(&empty_leaf->header,
- BTRFS_EXTENT_TREE_OBJECTID);
btrfs_set_header_blocknr(&empty_leaf->header, start_block + 2);
btrfs_set_header_nritems(&empty_leaf->header, 4);
btrfs_set_item_offset(&item, itemoff);
btrfs_set_item_size(&item, sizeof(struct btrfs_extent_item));
btrfs_set_extent_refs(&extent_item, 1);
- btrfs_set_extent_owner(&extent_item, 0);
memcpy(empty_leaf->items, &item, sizeof(item));
memcpy(btrfs_leaf_data(empty_leaf) + btrfs_item_offset(&item),
&extent_item, btrfs_item_size(&item));
btrfs_set_disk_key_offset(&item.key, 1);
itemoff = itemoff - sizeof(struct btrfs_extent_item);
btrfs_set_item_offset(&item, itemoff);
- btrfs_set_extent_owner(&extent_item, BTRFS_ROOT_TREE_OBJECTID);
memcpy(empty_leaf->items + 1, &item, sizeof(item));
memcpy(btrfs_leaf_data(empty_leaf) + btrfs_item_offset(&item),
&extent_item, btrfs_item_size(&item));
btrfs_set_disk_key_offset(&item.key, 1);
itemoff = itemoff - sizeof(struct btrfs_extent_item);
btrfs_set_item_offset(&item, itemoff);
- btrfs_set_extent_owner(&extent_item, BTRFS_EXTENT_TREE_OBJECTID);
memcpy(empty_leaf->items + 2, &item, sizeof(item));
memcpy(btrfs_leaf_data(empty_leaf) + btrfs_item_offset(&item),
&extent_item, btrfs_item_size(&item));
btrfs_set_disk_key_offset(&item.key, 1);
itemoff = itemoff - sizeof(struct btrfs_extent_item);
btrfs_set_item_offset(&item, itemoff);
- btrfs_set_extent_owner(&extent_item, BTRFS_FS_TREE_OBJECTID);
memcpy(empty_leaf->items + 3, &item, sizeof(item));
memcpy(btrfs_leaf_data(empty_leaf) + btrfs_item_offset(&item),
&extent_item, btrfs_item_size(&item));
return -1;
/* finally create the FS root */
- btrfs_set_header_parentid(&empty_leaf->header, BTRFS_FS_TREE_OBJECTID);
btrfs_set_header_blocknr(&empty_leaf->header, start_block + 3);
btrfs_set_header_nritems(&empty_leaf->header, 0);
ret = pwrite(fd, empty_leaf, blocksize, (start_block + 3) * blocksize);
char *p;
u32 type;
- printf("leaf %Lu ptrs %d free space %d parent %Lu generation %Lu\n",
+ printf("leaf %Lu ptrs %d free space %d generation %Lu\n",
btrfs_header_blocknr(&l->header), nr,
btrfs_leaf_free_space(root, l),
- btrfs_header_parentid(&l->header),
btrfs_header_generation(&l->header));
fflush(stdout);
for (i = 0 ; i < nr ; i++) {
break;
case BTRFS_EXTENT_ITEM_KEY:
ei = btrfs_item_ptr(l, i, struct btrfs_extent_item);
- printf("\t\textent data refs %u owner %Lu\n",
- btrfs_extent_refs(ei), btrfs_extent_owner(ei));
+ printf("\t\textent data refs %u\n",
+ btrfs_extent_refs(ei));
break;
case BTRFS_EXTENT_DATA_KEY:
fi = btrfs_item_ptr(l, i,
btrfs_print_leaf(root, (struct btrfs_leaf *)c);
return;
}
- printf("node %Lu level %d ptrs %d free %u parent %Lu generation %Lu\n",
+ printf("node %Lu level %d ptrs %d free %u generation %Lu\n",
t->blocknr,
btrfs_header_level(&c->header), nr,
(u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr,
- btrfs_header_parentid(&c->header),
btrfs_header_generation(&c->header));
fflush(stdout);
for (i = 0; i < nr; i++) {