mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
ocfs2: Add refcount b-tree as a new extent tree.
Add refcount b-tree as a new extent tree so that it can use the b-tree to store and maniuplate ocfs2_refcount_rec. Signed-off-by: Tao Ma <tao.ma@oracle.com>
This commit is contained in:
parent
555936bfcb
commit
fe92441595
2 changed files with 57 additions and 0 deletions
|
@ -385,6 +385,52 @@ static struct ocfs2_extent_tree_operations ocfs2_dx_root_et_ops = {
|
|||
.eo_fill_root_el = ocfs2_dx_root_fill_root_el,
|
||||
};
|
||||
|
||||
static void ocfs2_refcount_tree_fill_root_el(struct ocfs2_extent_tree *et)
|
||||
{
|
||||
struct ocfs2_refcount_block *rb = et->et_object;
|
||||
|
||||
et->et_root_el = &rb->rf_list;
|
||||
}
|
||||
|
||||
static void ocfs2_refcount_tree_set_last_eb_blk(struct ocfs2_extent_tree *et,
|
||||
u64 blkno)
|
||||
{
|
||||
struct ocfs2_refcount_block *rb = et->et_object;
|
||||
|
||||
rb->rf_last_eb_blk = cpu_to_le64(blkno);
|
||||
}
|
||||
|
||||
static u64 ocfs2_refcount_tree_get_last_eb_blk(struct ocfs2_extent_tree *et)
|
||||
{
|
||||
struct ocfs2_refcount_block *rb = et->et_object;
|
||||
|
||||
return le64_to_cpu(rb->rf_last_eb_blk);
|
||||
}
|
||||
|
||||
static void ocfs2_refcount_tree_update_clusters(struct ocfs2_extent_tree *et,
|
||||
u32 clusters)
|
||||
{
|
||||
struct ocfs2_refcount_block *rb = et->et_object;
|
||||
|
||||
le32_add_cpu(&rb->rf_clusters, clusters);
|
||||
}
|
||||
|
||||
static enum ocfs2_contig_type
|
||||
ocfs2_refcount_tree_extent_contig(struct ocfs2_extent_tree *et,
|
||||
struct ocfs2_extent_rec *ext,
|
||||
struct ocfs2_extent_rec *insert_rec)
|
||||
{
|
||||
return CONTIG_NONE;
|
||||
}
|
||||
|
||||
static struct ocfs2_extent_tree_operations ocfs2_refcount_tree_et_ops = {
|
||||
.eo_set_last_eb_blk = ocfs2_refcount_tree_set_last_eb_blk,
|
||||
.eo_get_last_eb_blk = ocfs2_refcount_tree_get_last_eb_blk,
|
||||
.eo_update_clusters = ocfs2_refcount_tree_update_clusters,
|
||||
.eo_fill_root_el = ocfs2_refcount_tree_fill_root_el,
|
||||
.eo_extent_contig = ocfs2_refcount_tree_extent_contig,
|
||||
};
|
||||
|
||||
static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et,
|
||||
struct ocfs2_caching_info *ci,
|
||||
struct buffer_head *bh,
|
||||
|
@ -439,6 +485,14 @@ void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et,
|
|||
NULL, &ocfs2_dx_root_et_ops);
|
||||
}
|
||||
|
||||
void ocfs2_init_refcount_extent_tree(struct ocfs2_extent_tree *et,
|
||||
struct ocfs2_caching_info *ci,
|
||||
struct buffer_head *bh)
|
||||
{
|
||||
__ocfs2_init_extent_tree(et, ci, bh, ocfs2_journal_access_rb,
|
||||
NULL, &ocfs2_refcount_tree_et_ops);
|
||||
}
|
||||
|
||||
static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et,
|
||||
u64 new_last_eb_blk)
|
||||
{
|
||||
|
|
|
@ -80,6 +80,9 @@ void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et,
|
|||
void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et,
|
||||
struct ocfs2_caching_info *ci,
|
||||
struct buffer_head *bh);
|
||||
void ocfs2_init_refcount_extent_tree(struct ocfs2_extent_tree *et,
|
||||
struct ocfs2_caching_info *ci,
|
||||
struct buffer_head *bh);
|
||||
|
||||
/*
|
||||
* Read an extent block into *bh. If *bh is NULL, a bh will be
|
||||
|
|
Loading…
Reference in a new issue