aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-13 09:49:06 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-13 09:49:06 -0400
commitcf27e1eec063fa68a89c57ae0a83f93aa38851d6 (patch)
tree230f1f887d5dad72501ed0826cf3d6e9a9d0f6fc /fs/btrfs/extent-tree.c
parent1d4f8a0c1eca5586134b56a4114a7cd5e85e3560 (diff)
Btrfs: struct extent_item endian
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index e511f48eb48e..1676a6595cce 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -29,6 +29,7 @@ static int inc_block_ref(struct ctree_root *root, u64 blocknr)
29 struct leaf *l; 29 struct leaf *l;
30 struct extent_item *item; 30 struct extent_item *item;
31 struct btrfs_key ins; 31 struct btrfs_key ins;
32 u32 refs;
32 33
33 find_free_extent(root->extent_root, 0, 0, (u64)-1, &ins); 34 find_free_extent(root->extent_root, 0, 0, (u64)-1, &ins);
34 init_path(&path); 35 init_path(&path);
@@ -42,7 +43,8 @@ static int inc_block_ref(struct ctree_root *root, u64 blocknr)
42 l = &path.nodes[0]->leaf; 43 l = &path.nodes[0]->leaf;
43 item = (struct extent_item *)(l->data + btrfs_item_offset(l->items + 44 item = (struct extent_item *)(l->data + btrfs_item_offset(l->items +
44 path.slots[0])); 45 path.slots[0]));
45 item->refs++; 46 refs = btrfs_extent_refs(item);
47 btrfs_set_extent_refs(item, refs + 1);
46 48
47 BUG_ON(list_empty(&path.nodes[0]->dirty)); 49 BUG_ON(list_empty(&path.nodes[0]->dirty));
48 release_path(root->extent_root, &path); 50 release_path(root->extent_root, &path);
@@ -69,7 +71,7 @@ static int lookup_block_ref(struct ctree_root *root, u64 blocknr, u32 *refs)
69 item = (struct extent_item *)(l->data + 71 item = (struct extent_item *)(l->data +
70 btrfs_item_offset(l->items + 72 btrfs_item_offset(l->items +
71 path.slots[0])); 73 path.slots[0]));
72 *refs = item->refs; 74 *refs = btrfs_extent_refs(item);
73 release_path(root->extent_root, &path); 75 release_path(root->extent_root, &path);
74 return 0; 76 return 0;
75} 77}
@@ -120,9 +122,9 @@ static int finish_current_insert(struct ctree_root *extent_root)
120 int i; 122 int i;
121 int ret; 123 int ret;
122 124
123 extent_item.refs = 1; 125 btrfs_set_extent_refs(&extent_item, 1);
124 extent_item.owner = 126 btrfs_set_extent_owner(&extent_item,
125 btrfs_header_parentid(&extent_root->node->node.header); 127 btrfs_header_parentid(&extent_root->node->node.header));
126 ins.offset = 1; 128 ins.offset = 1;
127 ins.flags = 0; 129 ins.flags = 0;
128 130
@@ -148,6 +150,7 @@ int __free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks)
148 struct btrfs_item *item; 150 struct btrfs_item *item;
149 struct extent_item *ei; 151 struct extent_item *ei;
150 struct btrfs_key ins; 152 struct btrfs_key ins;
153 u32 refs;
151 154
152 key.objectid = blocknr; 155 key.objectid = blocknr;
153 key.flags = 0; 156 key.flags = 0;
@@ -166,8 +169,9 @@ int __free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks)
166 ei = (struct extent_item *)(path.nodes[0]->leaf.data + 169 ei = (struct extent_item *)(path.nodes[0]->leaf.data +
167 btrfs_item_offset(item)); 170 btrfs_item_offset(item));
168 BUG_ON(ei->refs == 0); 171 BUG_ON(ei->refs == 0);
169 ei->refs--; 172 refs = btrfs_extent_refs(ei) - 1;
170 if (ei->refs == 0) { 173 btrfs_set_extent_refs(ei, refs);
174 if (refs == 0) {
171 if (root == extent_root) { 175 if (root == extent_root) {
172 int err; 176 int err;
173 radix_tree_preload(GFP_KERNEL); 177 radix_tree_preload(GFP_KERNEL);
@@ -368,8 +372,8 @@ int alloc_extent(struct ctree_root *root, u64 num_blocks, u64 search_start,
368 struct ctree_root *extent_root = root->extent_root; 372 struct ctree_root *extent_root = root->extent_root;
369 struct extent_item extent_item; 373 struct extent_item extent_item;
370 374
371 extent_item.refs = 1; 375 btrfs_set_extent_refs(&extent_item, 1);
372 extent_item.owner = owner; 376 btrfs_set_extent_owner(&extent_item, owner);
373 377
374 if (root == extent_root) { 378 if (root == extent_root) {
375 BUG_ON(extent_root->current_insert.offset == 0); 379 BUG_ON(extent_root->current_insert.offset == 0);