1 From: Joel Becker <joel.becker@oracle.com>
2 Subject: ocfs2: Provide the get_root_el() method to ocfs2_extent_tree_operations.
3 Patch-mainline: 2.6.28?
6 The root_el of an ocfs2_extent_tree needs to be calculated from
7 et->et_object. Make it an operation on et->et_ops.
9 Signed-off-by: Joel Becker <joel.becker@oracle.com>
10 Acked-by: Mark Fasheh <mark.fasheh@suse.com>
12 fs/ocfs2/alloc.c | 38 ++++++++++++++++++++++++++++++--------
13 1 files changed, 30 insertions(+), 8 deletions(-)
15 diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
16 index 93f44f4..fb6ae67 100644
17 --- a/fs/ocfs2/alloc.c
18 +++ b/fs/ocfs2/alloc.c
19 @@ -72,6 +72,10 @@ struct ocfs2_extent_tree_operations {
20 struct ocfs2_extent_tree *et,
22 int (*eo_sanity_check)(struct inode *inode, struct ocfs2_extent_tree *et);
24 + /* These are internal to ocfs2_extent_tree and don't have
25 + * accessor functions */
26 + void (*eo_fill_root_el)(struct ocfs2_extent_tree *et);
29 struct ocfs2_extent_tree {
30 @@ -83,6 +87,13 @@ struct ocfs2_extent_tree {
31 unsigned int et_max_leaf_clusters;
34 +static void ocfs2_dinode_fill_root_el(struct ocfs2_extent_tree *et)
36 + struct ocfs2_dinode *di = et->et_object;
38 + et->et_root_el = &di->id2.i_list;
41 static void ocfs2_dinode_set_last_eb_blk(struct ocfs2_extent_tree *et,
44 @@ -136,8 +147,16 @@ static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = {
45 .eo_get_last_eb_blk = ocfs2_dinode_get_last_eb_blk,
46 .eo_update_clusters = ocfs2_dinode_update_clusters,
47 .eo_sanity_check = ocfs2_dinode_sanity_check,
48 + .eo_fill_root_el = ocfs2_dinode_fill_root_el,
51 +static void ocfs2_xattr_value_fill_root_el(struct ocfs2_extent_tree *et)
53 + struct ocfs2_xattr_value_root *xv = et->et_object;
55 + et->et_root_el = &xv->xr_list;
58 static void ocfs2_xattr_value_set_last_eb_blk(struct ocfs2_extent_tree *et,
61 @@ -176,8 +195,16 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_et_ops = {
62 .eo_get_last_eb_blk = ocfs2_xattr_value_get_last_eb_blk,
63 .eo_update_clusters = ocfs2_xattr_value_update_clusters,
64 .eo_sanity_check = ocfs2_xattr_value_sanity_check,
65 + .eo_fill_root_el = ocfs2_xattr_value_fill_root_el,
68 +static void ocfs2_xattr_tree_fill_root_el(struct ocfs2_extent_tree *et)
70 + struct ocfs2_xattr_block *xb = et->et_object;
72 + et->et_root_el = &xb->xb_attrs.xb_root.xt_list;
75 static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et,
78 @@ -215,6 +242,7 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = {
79 .eo_get_last_eb_blk = ocfs2_xattr_tree_get_last_eb_blk,
80 .eo_update_clusters = ocfs2_xattr_tree_update_clusters,
81 .eo_sanity_check = ocfs2_xattr_tree_sanity_check,
82 + .eo_fill_root_el = ocfs2_xattr_tree_fill_root_el,
85 static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
86 @@ -232,22 +260,16 @@ static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
89 if (et_type == OCFS2_DINODE_EXTENT) {
91 - &((struct ocfs2_dinode *)obj)->id2.i_list;
92 et->et_ops = &ocfs2_dinode_et_ops;
93 } else if (et_type == OCFS2_XATTR_VALUE_EXTENT) {
94 - struct ocfs2_xattr_value_root *xv =
95 - (struct ocfs2_xattr_value_root *)obj;
96 - et->et_root_el = &xv->xr_list;
97 et->et_ops = &ocfs2_xattr_et_ops;
98 } else if (et_type == OCFS2_XATTR_TREE_EXTENT) {
99 - struct ocfs2_xattr_block *xb =
100 - (struct ocfs2_xattr_block *)obj;
101 - et->et_root_el = &xb->xb_attrs.xb_root.xt_list;
102 et->et_ops = &ocfs2_xattr_tree_et_ops;
103 et->et_max_leaf_clusters = ocfs2_clusters_for_bytes(inode->i_sb,
104 OCFS2_MAX_XATTR_TREE_LEAF_SIZE);
107 + et->et_ops->eo_fill_root_el(et);
110 static void ocfs2_put_extent_tree(struct ocfs2_extent_tree *et)