btrfs_set_header_level(&c->header, level);
btrfs_set_header_blocknr(&c->header, t->b_blocknr);
btrfs_set_header_generation(&c->header, trans->transid);
- btrfs_set_header_parentid(&c->header,
- btrfs_header_parentid(btrfs_buffer_header(root->node)));
lower = btrfs_buffer_node(path->nodes[level-1]);
memcpy(c->header.fsid, root->fs_info->disk_super->fsid,
sizeof(c->header.fsid));
btrfs_set_header_level(&split->header, btrfs_header_level(&c->header));
btrfs_set_header_blocknr(&split->header, split_buffer->b_blocknr);
btrfs_set_header_generation(&split->header, trans->transid);
- btrfs_set_header_parentid(&split->header,
- btrfs_header_parentid(btrfs_buffer_header(root->node)));
memcpy(split->header.fsid, root->fs_info->disk_super->fsid,
sizeof(split->header.fsid));
mid = (c_nritems + 1) / 2;
btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr);
btrfs_set_header_generation(&right->header, trans->transid);
btrfs_set_header_level(&right->header, 0);
- btrfs_set_header_parentid(&right->header,
- btrfs_header_parentid(btrfs_buffer_header(root->node)));
memcpy(right->header.fsid, root->fs_info->disk_super->fsid,
sizeof(right->header.fsid));
if (mid <= slot) {
btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr);
btrfs_set_header_generation(&right->header, trans->transid);
btrfs_set_header_level(&right->header, 0);
- btrfs_set_header_parentid(&right->header,
- btrfs_header_parentid(btrfs_buffer_header(root->node)));
memcpy(right->header.fsid, root->fs_info->disk_super->fsid,
sizeof(right->header.fsid));
btrfs_cpu_key_to_disk(&disk_key, ins_key);
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_root *root);
int btrfs_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 btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct buffer_head *buf);
int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
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(btrfs_buffer_header(extent_root->node)));
ins.offset = 1;
ins.flags = 0;
btrfs_set_key_type(&ins, BTRFS_EXTENT_ITEM_KEY);
*/
int btrfs_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 buffer_head *buf;
- ret = btrfs_alloc_extent(trans, root, 1, 0, (unsigned long)-1,
- btrfs_header_parentid(btrfs_buffer_header(root->node)), &ins);
+ ret = btrfs_alloc_extent(trans, root, 1, 0, (unsigned long)-1, &ins);
if (ret) {
BUG();
return NULL;
BUG_ON(!path);
btrfs_init_path(path);
ret = btrfs_alloc_extent(trans, root, num_blocks, hint_block,
- (u64)-1, objectid, &ins);
+ (u64)-1, &ins);
BUG_ON(ret);
file_key.objectid = objectid;
file_key.offset = offset;
break;
case BTRFS_EXTENT_ITEM_KEY:
ei = btrfs_item_ptr(l, i, struct btrfs_extent_item);
- printk("\t\textent data refs %u owner %Lu\n",
- btrfs_extent_refs(ei), btrfs_extent_owner(ei));
+ printk("\t\textent data refs %u\n",
+ btrfs_extent_refs(ei));
break;
case BTRFS_STRING_ITEM_KEY:
printk("\t\titem data %.*s\n", btrfs_item_size(item),
int i;
int ret;
int err;
-printk("add dirty\n");
while(1) {
ret = radix_tree_gang_lookup_tag(radix, (void **)gang, 0,
ARRAY_SIZE(gang),
dirty->commit_root = root->commit_root;
root->commit_root = NULL;
dirty->root = root;
-printk("adding dirty root %Lu gen %Lu blocknr %Lu\n", root->root_key.objectid, root->root_key.offset, dirty->commit_root->b_blocknr);
root->root_key.offset = root->fs_info->generation;
btrfs_set_root_blocknr(&root->root_item,
root->node->b_blocknr);
list_add(&dirty->list, list);
}
}
-printk("add dirty done\n");
return 0;
}
dirty = list_entry(list->next, struct dirty_root, list);
list_del_init(&dirty->list);
trans = btrfs_start_transaction(tree_root, 1);
-printk("drop snapshot root %p, commit_root blocknr %Lu generation %Lu\n", dirty->root, dirty->commit_root->b_blocknr, dirty->snap_key.offset);
ret = btrfs_drop_snapshot(trans, dirty->root,
dirty->commit_root);
BUG_ON(ret);
-printk("del root objectid %Lu, offset %Lu\n", dirty->snap_key.objectid, dirty->snap_key.offset);
ret = btrfs_del_root(trans, tree_root, &dirty->snap_key);
BUG_ON(ret);
ret = btrfs_end_transaction(trans, tree_root);
mutex_lock(&root->fs_info->trans_mutex);
if (trans->transaction->in_commit) {
-printk("already in commit!, waiting\n");
cur_trans = trans->transaction;
trans->transaction->use_count++;
btrfs_end_transaction(trans, root);