diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-03-14 10:31:29 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-03-14 10:31:29 -0400 |
commit | 4beb1b8b75a86373f6020103ab840448d14c8880 (patch) | |
tree | 944e80ccd6764afd16b4e31d5595d2decf36dabc /fs/btrfs/extent-tree.c | |
parent | 710874947aa0f81c3b348b052e81cb9075113c49 (diff) |
Btrfs: add leaf data casting helper
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 7f156d9b7089..3767744f659e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -41,9 +41,7 @@ static int inc_block_ref(struct btrfs_root *root, u64 blocknr) | |||
41 | BUG(); | 41 | BUG(); |
42 | BUG_ON(ret != 0); | 42 | BUG_ON(ret != 0); |
43 | l = &path.nodes[0]->leaf; | 43 | l = &path.nodes[0]->leaf; |
44 | item = (struct btrfs_extent_item *)(l->data + | 44 | item = btrfs_item_ptr(l, path.slots[0], struct btrfs_extent_item); |
45 | btrfs_item_offset(l->items + | ||
46 | path.slots[0])); | ||
47 | refs = btrfs_extent_refs(item); | 45 | refs = btrfs_extent_refs(item); |
48 | btrfs_set_extent_refs(item, refs + 1); | 46 | btrfs_set_extent_refs(item, refs + 1); |
49 | 47 | ||
@@ -69,9 +67,7 @@ static int lookup_block_ref(struct btrfs_root *root, u64 blocknr, u32 *refs) | |||
69 | if (ret != 0) | 67 | if (ret != 0) |
70 | BUG(); | 68 | BUG(); |
71 | l = &path.nodes[0]->leaf; | 69 | l = &path.nodes[0]->leaf; |
72 | item = (struct btrfs_extent_item *)(l->data + | 70 | item = btrfs_item_ptr(l, path.slots[0], struct btrfs_extent_item); |
73 | btrfs_item_offset(l->items + | ||
74 | path.slots[0])); | ||
75 | *refs = btrfs_extent_refs(item); | 71 | *refs = btrfs_extent_refs(item); |
76 | btrfs_release_path(root->extent_root, &path); | 72 | btrfs_release_path(root->extent_root, &path); |
77 | return 0; | 73 | return 0; |