diff options
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r-- | fs/ocfs2/alloc.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 19e3a96aa02c..678a067d9251 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -294,6 +294,55 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = { | |||
294 | .eo_fill_max_leaf_clusters = ocfs2_xattr_tree_fill_max_leaf_clusters, | 294 | .eo_fill_max_leaf_clusters = ocfs2_xattr_tree_fill_max_leaf_clusters, |
295 | }; | 295 | }; |
296 | 296 | ||
297 | static void ocfs2_dx_root_set_last_eb_blk(struct ocfs2_extent_tree *et, | ||
298 | u64 blkno) | ||
299 | { | ||
300 | struct ocfs2_dx_root_block *dx_root = et->et_object; | ||
301 | |||
302 | dx_root->dr_last_eb_blk = cpu_to_le64(blkno); | ||
303 | } | ||
304 | |||
305 | static u64 ocfs2_dx_root_get_last_eb_blk(struct ocfs2_extent_tree *et) | ||
306 | { | ||
307 | struct ocfs2_dx_root_block *dx_root = et->et_object; | ||
308 | |||
309 | return le64_to_cpu(dx_root->dr_last_eb_blk); | ||
310 | } | ||
311 | |||
312 | static void ocfs2_dx_root_update_clusters(struct inode *inode, | ||
313 | struct ocfs2_extent_tree *et, | ||
314 | u32 clusters) | ||
315 | { | ||
316 | struct ocfs2_dx_root_block *dx_root = et->et_object; | ||
317 | |||
318 | le32_add_cpu(&dx_root->dr_clusters, clusters); | ||
319 | } | ||
320 | |||
321 | static int ocfs2_dx_root_sanity_check(struct inode *inode, | ||
322 | struct ocfs2_extent_tree *et) | ||
323 | { | ||
324 | struct ocfs2_dx_root_block *dx_root = et->et_object; | ||
325 | |||
326 | BUG_ON(!OCFS2_IS_VALID_DX_ROOT(dx_root)); | ||
327 | |||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | static void ocfs2_dx_root_fill_root_el(struct ocfs2_extent_tree *et) | ||
332 | { | ||
333 | struct ocfs2_dx_root_block *dx_root = et->et_object; | ||
334 | |||
335 | et->et_root_el = &dx_root->dr_list; | ||
336 | } | ||
337 | |||
338 | static struct ocfs2_extent_tree_operations ocfs2_dx_root_et_ops = { | ||
339 | .eo_set_last_eb_blk = ocfs2_dx_root_set_last_eb_blk, | ||
340 | .eo_get_last_eb_blk = ocfs2_dx_root_get_last_eb_blk, | ||
341 | .eo_update_clusters = ocfs2_dx_root_update_clusters, | ||
342 | .eo_sanity_check = ocfs2_dx_root_sanity_check, | ||
343 | .eo_fill_root_el = ocfs2_dx_root_fill_root_el, | ||
344 | }; | ||
345 | |||
297 | static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, | 346 | static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, |
298 | struct inode *inode, | 347 | struct inode *inode, |
299 | struct buffer_head *bh, | 348 | struct buffer_head *bh, |
@@ -339,6 +388,14 @@ void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, | |||
339 | &ocfs2_xattr_value_et_ops); | 388 | &ocfs2_xattr_value_et_ops); |
340 | } | 389 | } |
341 | 390 | ||
391 | void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et, | ||
392 | struct inode *inode, | ||
393 | struct buffer_head *bh) | ||
394 | { | ||
395 | __ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_dr, | ||
396 | NULL, &ocfs2_dx_root_et_ops); | ||
397 | } | ||
398 | |||
342 | static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et, | 399 | static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et, |
343 | u64 new_last_eb_blk) | 400 | u64 new_last_eb_blk) |
344 | { | 401 | { |