diff options
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r-- | fs/ocfs2/alloc.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 14b9106849ca..a6296560a5cb 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -385,6 +385,52 @@ static struct ocfs2_extent_tree_operations ocfs2_dx_root_et_ops = { | |||
385 | .eo_fill_root_el = ocfs2_dx_root_fill_root_el, | 385 | .eo_fill_root_el = ocfs2_dx_root_fill_root_el, |
386 | }; | 386 | }; |
387 | 387 | ||
388 | static void ocfs2_refcount_tree_fill_root_el(struct ocfs2_extent_tree *et) | ||
389 | { | ||
390 | struct ocfs2_refcount_block *rb = et->et_object; | ||
391 | |||
392 | et->et_root_el = &rb->rf_list; | ||
393 | } | ||
394 | |||
395 | static void ocfs2_refcount_tree_set_last_eb_blk(struct ocfs2_extent_tree *et, | ||
396 | u64 blkno) | ||
397 | { | ||
398 | struct ocfs2_refcount_block *rb = et->et_object; | ||
399 | |||
400 | rb->rf_last_eb_blk = cpu_to_le64(blkno); | ||
401 | } | ||
402 | |||
403 | static u64 ocfs2_refcount_tree_get_last_eb_blk(struct ocfs2_extent_tree *et) | ||
404 | { | ||
405 | struct ocfs2_refcount_block *rb = et->et_object; | ||
406 | |||
407 | return le64_to_cpu(rb->rf_last_eb_blk); | ||
408 | } | ||
409 | |||
410 | static void ocfs2_refcount_tree_update_clusters(struct ocfs2_extent_tree *et, | ||
411 | u32 clusters) | ||
412 | { | ||
413 | struct ocfs2_refcount_block *rb = et->et_object; | ||
414 | |||
415 | le32_add_cpu(&rb->rf_clusters, clusters); | ||
416 | } | ||
417 | |||
418 | static enum ocfs2_contig_type | ||
419 | ocfs2_refcount_tree_extent_contig(struct ocfs2_extent_tree *et, | ||
420 | struct ocfs2_extent_rec *ext, | ||
421 | struct ocfs2_extent_rec *insert_rec) | ||
422 | { | ||
423 | return CONTIG_NONE; | ||
424 | } | ||
425 | |||
426 | static struct ocfs2_extent_tree_operations ocfs2_refcount_tree_et_ops = { | ||
427 | .eo_set_last_eb_blk = ocfs2_refcount_tree_set_last_eb_blk, | ||
428 | .eo_get_last_eb_blk = ocfs2_refcount_tree_get_last_eb_blk, | ||
429 | .eo_update_clusters = ocfs2_refcount_tree_update_clusters, | ||
430 | .eo_fill_root_el = ocfs2_refcount_tree_fill_root_el, | ||
431 | .eo_extent_contig = ocfs2_refcount_tree_extent_contig, | ||
432 | }; | ||
433 | |||
388 | static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, | 434 | static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, |
389 | struct ocfs2_caching_info *ci, | 435 | struct ocfs2_caching_info *ci, |
390 | struct buffer_head *bh, | 436 | struct buffer_head *bh, |
@@ -439,6 +485,14 @@ void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et, | |||
439 | NULL, &ocfs2_dx_root_et_ops); | 485 | NULL, &ocfs2_dx_root_et_ops); |
440 | } | 486 | } |
441 | 487 | ||
488 | void ocfs2_init_refcount_extent_tree(struct ocfs2_extent_tree *et, | ||
489 | struct ocfs2_caching_info *ci, | ||
490 | struct buffer_head *bh) | ||
491 | { | ||
492 | __ocfs2_init_extent_tree(et, ci, bh, ocfs2_journal_access_rb, | ||
493 | NULL, &ocfs2_refcount_tree_et_ops); | ||
494 | } | ||
495 | |||
442 | static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et, | 496 | static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et, |
443 | u64 new_last_eb_blk) | 497 | u64 new_last_eb_blk) |
444 | { | 498 | { |