aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/alloc.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index d1aa7249deb2..64f1af4e999e 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -76,6 +76,8 @@ struct ocfs2_extent_tree_operations {
76 /* These are internal to ocfs2_extent_tree and don't have 76 /* These are internal to ocfs2_extent_tree and don't have
77 * accessor functions */ 77 * accessor functions */
78 void (*eo_fill_root_el)(struct ocfs2_extent_tree *et); 78 void (*eo_fill_root_el)(struct ocfs2_extent_tree *et);
79 void (*eo_fill_max_leaf_clusters)(struct inode *inode,
80 struct ocfs2_extent_tree *et);
79}; 81};
80 82
81struct ocfs2_extent_tree { 83struct ocfs2_extent_tree {
@@ -205,6 +207,14 @@ static void ocfs2_xattr_tree_fill_root_el(struct ocfs2_extent_tree *et)
205 et->et_root_el = &xb->xb_attrs.xb_root.xt_list; 207 et->et_root_el = &xb->xb_attrs.xb_root.xt_list;
206} 208}
207 209
210static void ocfs2_xattr_tree_fill_max_leaf_clusters(struct inode *inode,
211 struct ocfs2_extent_tree *et)
212{
213 et->et_max_leaf_clusters =
214 ocfs2_clusters_for_bytes(inode->i_sb,
215 OCFS2_MAX_XATTR_TREE_LEAF_SIZE);
216}
217
208static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et, 218static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et,
209 u64 blkno) 219 u64 blkno)
210{ 220{
@@ -243,6 +253,7 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = {
243 .eo_update_clusters = ocfs2_xattr_tree_update_clusters, 253 .eo_update_clusters = ocfs2_xattr_tree_update_clusters,
244 .eo_sanity_check = ocfs2_xattr_tree_sanity_check, 254 .eo_sanity_check = ocfs2_xattr_tree_sanity_check,
245 .eo_fill_root_el = ocfs2_xattr_tree_fill_root_el, 255 .eo_fill_root_el = ocfs2_xattr_tree_fill_root_el,
256 .eo_fill_max_leaf_clusters = ocfs2_xattr_tree_fill_max_leaf_clusters,
246}; 257};
247 258
248static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et, 259static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
@@ -254,7 +265,6 @@ static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
254 et->et_type = et_type; 265 et->et_type = et_type;
255 get_bh(bh); 266 get_bh(bh);
256 et->et_root_bh = bh; 267 et->et_root_bh = bh;
257 et->et_max_leaf_clusters = 0;
258 if (!obj) 268 if (!obj)
259 obj = (void *)bh->b_data; 269 obj = (void *)bh->b_data;
260 et->et_object = obj; 270 et->et_object = obj;
@@ -265,11 +275,13 @@ static void ocfs2_get_extent_tree(struct ocfs2_extent_tree *et,
265 et->et_ops = &ocfs2_xattr_et_ops; 275 et->et_ops = &ocfs2_xattr_et_ops;
266 } else if (et_type == OCFS2_XATTR_TREE_EXTENT) { 276 } else if (et_type == OCFS2_XATTR_TREE_EXTENT) {
267 et->et_ops = &ocfs2_xattr_tree_et_ops; 277 et->et_ops = &ocfs2_xattr_tree_et_ops;
268 et->et_max_leaf_clusters = ocfs2_clusters_for_bytes(inode->i_sb,
269 OCFS2_MAX_XATTR_TREE_LEAF_SIZE);
270 } 278 }
271 279
272 et->et_ops->eo_fill_root_el(et); 280 et->et_ops->eo_fill_root_el(et);
281 if (!et->et_ops->eo_fill_max_leaf_clusters)
282 et->et_max_leaf_clusters = 0;
283 else
284 et->et_ops->eo_fill_max_leaf_clusters(inode, et);
273} 285}
274 286
275static void ocfs2_put_extent_tree(struct ocfs2_extent_tree *et) 287static void ocfs2_put_extent_tree(struct ocfs2_extent_tree *et)