Commit d0dbc624 authored by Chris Mason's avatar Chris Mason Committed by David Woodhouse

Btrfs: drop owner and parentid

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 1b05da2e
...@@ -688,8 +688,6 @@ static int insert_new_root(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -688,8 +688,6 @@ static int insert_new_root(struct btrfs_trans_handle *trans, struct btrfs_root
btrfs_set_header_level(&c->header, level); btrfs_set_header_level(&c->header, level);
btrfs_set_header_blocknr(&c->header, t->b_blocknr); btrfs_set_header_blocknr(&c->header, t->b_blocknr);
btrfs_set_header_generation(&c->header, trans->transid); 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]); lower = btrfs_buffer_node(path->nodes[level-1]);
memcpy(c->header.fsid, root->fs_info->disk_super->fsid, memcpy(c->header.fsid, root->fs_info->disk_super->fsid,
sizeof(c->header.fsid)); sizeof(c->header.fsid));
...@@ -784,8 +782,6 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -784,8 +782,6 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
btrfs_set_header_level(&split->header, btrfs_header_level(&c->header)); btrfs_set_header_level(&split->header, btrfs_header_level(&c->header));
btrfs_set_header_blocknr(&split->header, split_buffer->b_blocknr); btrfs_set_header_blocknr(&split->header, split_buffer->b_blocknr);
btrfs_set_header_generation(&split->header, trans->transid); 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, memcpy(split->header.fsid, root->fs_info->disk_super->fsid,
sizeof(split->header.fsid)); sizeof(split->header.fsid));
mid = (c_nritems + 1) / 2; mid = (c_nritems + 1) / 2;
...@@ -1145,8 +1141,6 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -1145,8 +1141,6 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root
btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr); btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr);
btrfs_set_header_generation(&right->header, trans->transid); btrfs_set_header_generation(&right->header, trans->transid);
btrfs_set_header_level(&right->header, 0); 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, memcpy(right->header.fsid, root->fs_info->disk_super->fsid,
sizeof(right->header.fsid)); sizeof(right->header.fsid));
if (mid <= slot) { if (mid <= slot) {
...@@ -1237,8 +1231,6 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -1237,8 +1231,6 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root
btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr); btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr);
btrfs_set_header_generation(&right->header, trans->transid); btrfs_set_header_generation(&right->header, trans->transid);
btrfs_set_header_level(&right->header, 0); 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, memcpy(right->header.fsid, root->fs_info->disk_super->fsid,
sizeof(right->header.fsid)); sizeof(right->header.fsid));
btrfs_cpu_key_to_disk(&disk_key, ins_key); btrfs_cpu_key_to_disk(&disk_key, ins_key);
......
...@@ -60,7 +60,6 @@ struct btrfs_header { ...@@ -60,7 +60,6 @@ struct btrfs_header {
u8 fsid[16]; /* FS specific uuid */ u8 fsid[16]; /* FS specific uuid */
__le64 blocknr; /* which block this node is supposed to live in */ __le64 blocknr; /* which block this node is supposed to live in */
__le64 generation; __le64 generation;
__le64 parentid; /* objectid of the tree root */
__le16 nritems; __le16 nritems;
__le16 flags; __le16 flags;
u8 level; u8 level;
...@@ -147,7 +146,6 @@ struct btrfs_path { ...@@ -147,7 +146,6 @@ struct btrfs_path {
*/ */
struct btrfs_extent_item { struct btrfs_extent_item {
__le32 refs; __le32 refs;
__le64 owner;
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
struct btrfs_inode_timespec { struct btrfs_inode_timespec {
...@@ -443,16 +441,6 @@ static inline void btrfs_set_timespec_nsec(struct btrfs_inode_timespec *ts, ...@@ -443,16 +441,6 @@ static inline void btrfs_set_timespec_nsec(struct btrfs_inode_timespec *ts,
ts->nsec = cpu_to_le32(val); 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) static inline u32 btrfs_extent_refs(struct btrfs_extent_item *ei)
{ {
return le32_to_cpu(ei->refs); return le32_to_cpu(ei->refs);
...@@ -652,17 +640,6 @@ static inline void btrfs_set_header_generation(struct btrfs_header *h, ...@@ -652,17 +640,6 @@ static inline void btrfs_set_header_generation(struct btrfs_header *h,
h->generation = cpu_to_le64(val); 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) static inline u16 btrfs_header_nritems(struct btrfs_header *h)
{ {
return le16_to_cpu(h->nritems); return le16_to_cpu(h->nritems);
...@@ -919,7 +896,7 @@ struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, ...@@ -919,7 +896,7 @@ struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root); struct btrfs_root *root);
int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root
*root, u64 num_blocks, u64 search_start, u64 *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, int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct buffer_head *buf); struct buffer_head *buf);
int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
......
...@@ -157,8 +157,6 @@ static int finish_current_insert(struct btrfs_trans_handle *trans, struct ...@@ -157,8 +157,6 @@ static int finish_current_insert(struct btrfs_trans_handle *trans, struct
struct btrfs_fs_info *info = extent_root->fs_info; struct btrfs_fs_info *info = extent_root->fs_info;
btrfs_set_extent_refs(&extent_item, 1); 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.offset = 1;
ins.flags = 0; ins.flags = 0;
btrfs_set_key_type(&ins, BTRFS_EXTENT_ITEM_KEY); btrfs_set_key_type(&ins, BTRFS_EXTENT_ITEM_KEY);
...@@ -457,7 +455,7 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -457,7 +455,7 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
*/ */
int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root
*root, u64 num_blocks, u64 search_start, u64 *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 ret;
int pending_ret; int pending_ret;
...@@ -467,7 +465,6 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -467,7 +465,6 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root
struct btrfs_extent_item extent_item; struct btrfs_extent_item extent_item;
btrfs_set_extent_refs(&extent_item, 1); btrfs_set_extent_refs(&extent_item, 1);
btrfs_set_extent_owner(&extent_item, owner);
if (root == extent_root) { if (root == extent_root) {
BUG_ON(extent_root->fs_info->current_insert.offset == 0); BUG_ON(extent_root->fs_info->current_insert.offset == 0);
...@@ -510,8 +507,7 @@ struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, ...@@ -510,8 +507,7 @@ struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
int ret; int ret;
struct buffer_head *buf; struct buffer_head *buf;
ret = btrfs_alloc_extent(trans, root, 1, 0, (unsigned long)-1, ret = btrfs_alloc_extent(trans, root, 1, 0, (unsigned long)-1, &ins);
btrfs_header_parentid(btrfs_buffer_header(root->node)), &ins);
if (ret) { if (ret) {
BUG(); BUG();
return NULL; return NULL;
......
...@@ -19,7 +19,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans, ...@@ -19,7 +19,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
BUG_ON(!path); BUG_ON(!path);
btrfs_init_path(path); btrfs_init_path(path);
ret = btrfs_alloc_extent(trans, root, num_blocks, hint_block, ret = btrfs_alloc_extent(trans, root, num_blocks, hint_block,
(u64)-1, objectid, &ins); (u64)-1, &ins);
BUG_ON(ret); BUG_ON(ret);
file_key.objectid = objectid; file_key.objectid = objectid;
file_key.offset = offset; file_key.offset = offset;
......
...@@ -50,8 +50,8 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) ...@@ -50,8 +50,8 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
break; break;
case BTRFS_EXTENT_ITEM_KEY: case BTRFS_EXTENT_ITEM_KEY:
ei = btrfs_item_ptr(l, i, struct btrfs_extent_item); ei = btrfs_item_ptr(l, i, struct btrfs_extent_item);
printk("\t\textent data refs %u owner %Lu\n", printk("\t\textent data refs %u\n",
btrfs_extent_refs(ei), btrfs_extent_owner(ei)); btrfs_extent_refs(ei));
break; break;
case BTRFS_STRING_ITEM_KEY: case BTRFS_STRING_ITEM_KEY:
printk("\t\titem data %.*s\n", btrfs_item_size(item), printk("\t\titem data %.*s\n", btrfs_item_size(item),
......
...@@ -163,7 +163,6 @@ int add_dirty_roots(struct btrfs_trans_handle *trans, ...@@ -163,7 +163,6 @@ int add_dirty_roots(struct btrfs_trans_handle *trans,
int i; int i;
int ret; int ret;
int err; int err;
printk("add dirty\n");
while(1) { while(1) {
ret = radix_tree_gang_lookup_tag(radix, (void **)gang, 0, ret = radix_tree_gang_lookup_tag(radix, (void **)gang, 0,
ARRAY_SIZE(gang), ARRAY_SIZE(gang),
...@@ -188,7 +187,6 @@ printk("add dirty\n"); ...@@ -188,7 +187,6 @@ printk("add dirty\n");
dirty->commit_root = root->commit_root; dirty->commit_root = root->commit_root;
root->commit_root = NULL; root->commit_root = NULL;
dirty->root = root; 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; root->root_key.offset = root->fs_info->generation;
btrfs_set_root_blocknr(&root->root_item, btrfs_set_root_blocknr(&root->root_item,
root->node->b_blocknr); root->node->b_blocknr);
...@@ -199,7 +197,6 @@ printk("adding dirty root %Lu gen %Lu blocknr %Lu\n", root->root_key.objectid, r ...@@ -199,7 +197,6 @@ printk("adding dirty root %Lu gen %Lu blocknr %Lu\n", root->root_key.objectid, r
list_add(&dirty->list, list); list_add(&dirty->list, list);
} }
} }
printk("add dirty done\n");
return 0; return 0;
} }
...@@ -213,12 +210,10 @@ int drop_dirty_roots(struct btrfs_root *tree_root, struct list_head *list) ...@@ -213,12 +210,10 @@ int drop_dirty_roots(struct btrfs_root *tree_root, struct list_head *list)
dirty = list_entry(list->next, struct dirty_root, list); dirty = list_entry(list->next, struct dirty_root, list);
list_del_init(&dirty->list); list_del_init(&dirty->list);
trans = btrfs_start_transaction(tree_root, 1); 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, ret = btrfs_drop_snapshot(trans, dirty->root,
dirty->commit_root); dirty->commit_root);
BUG_ON(ret); 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); ret = btrfs_del_root(trans, tree_root, &dirty->snap_key);
BUG_ON(ret); BUG_ON(ret);
ret = btrfs_end_transaction(trans, tree_root); ret = btrfs_end_transaction(trans, tree_root);
...@@ -240,7 +235,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, ...@@ -240,7 +235,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
mutex_lock(&root->fs_info->trans_mutex); mutex_lock(&root->fs_info->trans_mutex);
if (trans->transaction->in_commit) { if (trans->transaction->in_commit) {
printk("already in commit!, waiting\n");
cur_trans = trans->transaction; cur_trans = trans->transaction;
trans->transaction->use_count++; trans->transaction->use_count++;
btrfs_end_transaction(trans, root); btrfs_end_transaction(trans, root);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment