aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-08-20 20:19:50 -0400
committerMark Fasheh <mfasheh@suse.com>2008-10-13 19:57:04 -0400
commit0ce1010f1a4319e02574b856d50dfdc0ed855f40 (patch)
tree6d65e00caa9c4c5310fd4f51a07678d46803adfd /fs
parentea5efa151265a743f48e3d371992a0100d73a0eb (diff)
ocfs2: Provide the get_root_el() method to ocfs2_extent_tree_operations.
The root_el of an ocfs2_extent_tree needs to be calculated from et->et_object. Make it an operation on et->et_ops. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/alloc.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 4cefcb6a47a5..fe2ddbb81f74 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -72,6 +72,10 @@ struct ocfs2_extent_tree_operations {
72 struct ocfs2_extent_tree *et, 72 struct ocfs2_extent_tree *et,
73 u32 new_clusters); 73 u32 new_clusters);
74 int (*eo_sanity_check)(struct inode *inode, struct ocfs2_extent_tree *et); 74 int (*eo_sanity_check)(struct inode *inode, struct ocfs2_extent_tree *et);
75
76 /* These are internal to ocfs2_extent_tree and don't have
77 * accessor functions */
78 void (*eo_fill_root_el)(struct ocfs2_extent_tree *et);
75}; 79};
76 80
77struct ocfs2_extent_tree { 81struct ocfs2_extent_tree {
@@ -83,6 +87,13 @@ struct ocfs2_extent_tree {
83 unsigned int et_max_leaf_clusters; 87 unsigned int et_max_leaf_clusters;
84}; 88};
85 89
90static void ocfs2_dinode_fill_root_el(struct ocfs2_extent_tree *et)
91{
92 struct ocfs2_dinode *di = et->et_object;
93
94 et->et_root_el = &di->id2.i_list;
95}
96
86static void ocfs2_dinode_set_last_eb_blk(struct ocfs2_extent_tree *et, 97static void ocfs2_dinode_set_last_eb_blk(struct ocfs2_extent_tree *et,
87 u64 blkno) 98 u64 blkno)
88{ 99{
@@ -136,8 +147,16 @@ static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = {
136 .eo_get_last_eb_blk = ocfs2_dinode_get_last_eb_blk, 147 .eo_get_last_eb_blk = ocfs2_dinode_get_last_eb_blk,
137 .eo_update_clusters = ocfs2_dinode_update_clusters, 148 .eo_update_clusters = ocfs2_dinode_update_clusters,
138 .eo_sanity_check = ocfs2_dinode_sanity_check, 149 .eo_sanity_check = ocfs2_dinode_sanity_check,
150 .eo_fill_root_el = ocfs2_dinode_fill_root_el,
139}; 151};
140 152
153static void ocfs2_xattr_value_fill_root_el(struct ocfs2_extent_tree *et)
154{
155 struct ocfs2_xattr_value_root *xv = et->et_object;
156
157 et->et_root_el = &xv->xr_list;
158}
159
141static void ocfs2_xattr_value_set_last_eb_blk(struct ocfs2_extent_tree *et, 160static void ocfs2_xattr_value_set_last_eb_blk(struct ocfs2_extent_tree *et,
142 u64 blkno) 161 u64 blkno)
143{ 162{
@@ -176,8 +195,16 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_et_ops = {
176 .eo_get_last_eb_blk = ocfs2_xattr_value_get_last_eb_blk, 195 .eo_get_last_eb_blk = ocfs2_xattr_value_get_last_eb_blk,
177 .eo_update_clusters = ocfs2_xattr_value_update_clusters, 196 .eo_update_clusters = ocfs2_xattr_value_update_clusters,
178 .eo_sanity_check = ocfs2_xattr_value_sanity_check, 197 .eo_sanity_check = ocfs2_xattr_value_sanity_check,
198 .eo_fill_root_el = ocfs2_xattr_value_fill_root_el,
179}; 199};
180 200
201static void ocfs2_xattr_tree_fill_root_el(struct ocfs2_extent_tree *et)
202{
203 struct ocfs2_xattr_block *xb = et->et_object;
204
205 et->et_root_el = &xb->xb_attrs.xb_root.xt_list;
206}
207
181static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et, 208static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et,
182 u64 blkno) 209 u64 blkno)
183{ 210{
@@ -215,6 +242,7 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = {
215 .eo_get_last_eb_blk = ocfs2_xattr_tree_get_last_eb_blk, 242 .eo_get_last_eb_blk = ocfs2_xattr_tree_get_last_eb_blk,
216 .eo_update_clusters = ocfs2_xattr_tree_update_clusters, 243 .eo_update_clusters = ocfs2_xattr_tree_update_clusters,
217 .eo_sanity_check = ocfs2_xattr_tree_sanity_check, 244 .eo_sanity_check = ocfs2_xattr_tree_sanity_check,
245 .eo_fill_root_el = ocfs2_xattr_tree_fill_root_el,
218}; 246};
219 247
220static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et, 248static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
@@ -232,22 +260,16 @@ static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
232 et->et_object = obj; 260 et->et_object = obj;
233 261
234 if (et_type == OCFS2_DINODE_EXTENT) { 262 if (et_type == OCFS2_DINODE_EXTENT) {
235 et->et_root_el =
236 &((struct ocfs2_dinode *)obj)->id2.i_list;
237 et->et_ops = &ocfs2_dinode_et_ops; 263 et->et_ops = &ocfs2_dinode_et_ops;
238 } else if (et_type == OCFS2_XATTR_VALUE_EXTENT) { 264 } else if (et_type == OCFS2_XATTR_VALUE_EXTENT) {
239 struct ocfs2_xattr_value_root *xv =
240 (struct ocfs2_xattr_value_root *)obj;
241 et->et_root_el = &xv->xr_list;
242 et->et_ops = &ocfs2_xattr_et_ops; 265 et->et_ops = &ocfs2_xattr_et_ops;
243 } else if (et_type == OCFS2_XATTR_TREE_EXTENT) { 266 } else if (et_type == OCFS2_XATTR_TREE_EXTENT) {
244 struct ocfs2_xattr_block *xb =
245 (struct ocfs2_xattr_block *)obj;
246 et->et_root_el = &xb->xb_attrs.xb_root.xt_list;
247 et->et_ops = &ocfs2_xattr_tree_et_ops; 267 et->et_ops = &ocfs2_xattr_tree_et_ops;
248 et->et_max_leaf_clusters = ocfs2_clusters_for_bytes(inode->i_sb, 268 et->et_max_leaf_clusters = ocfs2_clusters_for_bytes(inode->i_sb,
249 OCFS2_MAX_XATTR_TREE_LEAF_SIZE); 269 OCFS2_MAX_XATTR_TREE_LEAF_SIZE);
250 } 270 }
271
272 et->et_ops->eo_fill_root_el(et);
251} 273}
252 274
253static void ocfs2_put_extent_tree(struct ocfs2_extent_tree *et) 275static void ocfs2_put_extent_tree(struct ocfs2_extent_tree *et)