[Ocfs2-tools-devel] [RFC 4/4] dx_dirs v2: extent operations for dx_dir
Coly Li
coly.li at suse.de
Fri Dec 25 11:23:43 PST 2009
This patch removes ocfs2_remove_btree_range() and uses helper routines from libocfs2.
Signed-off-by: Coly Li <coly.li at suse.de>
---
diff --git a/libocfs2/extent_tree.c b/libocfs2/extent_tree.c
index 499ce1b..715bcd7 100644
--- a/libocfs2/extent_tree.c
+++ b/libocfs2/extent_tree.c
@@ -60,6 +60,49 @@ static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = {
.eo_fill_root_el = ocfs2_dinode_fill_root_el,
};
+static void ocfs2_dx_root_set_last_eb_blk (struct ocfs2_extent_tree *et,
+ uint64_t blkno)
+{
+ struct ocfs2_dx_root_block *dx_root = et->et_object;
+ dx_root->dr_last_eb_blk = blkno;
+}
+
+static uint64_t ocfs2_dx_root_get_last_eb_blk (struct ocfs2_extent_tree *et)
+{
+ struct ocfs2_dx_root_block *dx_root = et->et_object;
+ return dx_root->dr_last_eb_blk;
+}
+
+static void ocfs2_dx_root_update_clusters(struct ocfs2_extent_tree *et,
+ uint32_t clusters)
+{
+ struct ocfs2_dx_root_block *dx_root = et->et_object;
+ dx_root->dr_clusters += clusters;
+}
+
+static int ocfs2_dx_root_sanity_check(struct ocfs2_extent_tree *et)
+{
+ struct ocfs2_dx_root_block *dx_root = (struct ocfs2_dx_root_block *)et->et_object;
+ assert(OCFS2_IS_VALID_DX_ROOT(dx_root));
+
+ return 0;
+}
+
+static void ocfs2_dx_root_fill_root_el (struct ocfs2_extent_tree *et)
+{
+ struct ocfs2_dx_root_block *dx_root = et->et_object;
+
+ et->et_root_el = &dx_root->dr_list;
+}
+
+static struct ocfs2_extent_tree_operations ocfs2_dx_root_et_ops = {
+ .eo_set_last_eb_blk = ocfs2_dx_root_set_last_eb_blk,
+ .eo_get_last_eb_blk = ocfs2_dx_root_get_last_eb_blk,
+ .eo_update_clusters = ocfs2_dx_root_update_clusters,
+ .eo_sanity_check = ocfs2_dx_root_sanity_check,
+ .eo_fill_root_el = ocfs2_dx_root_fill_root_el,
+};
+
static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et,
ocfs2_filesys *fs,
char *buf,
@@ -90,6 +133,15 @@ void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et,
buf, &ocfs2_dinode_et_ops);
}
+void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et,
+ ocfs2_filesys *fs,
+ char *buf, uint64_t blkno)
+{
+ __ocfs2_init_extent_tree(et, fs, buf, blkno,
+ NULL,
+ NULL, &ocfs2_dx_root_et_ops);
+}
+
static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et,
uint64_t new_last_eb_blk)
{
@@ -4072,3 +4124,4 @@ out:
ocfs2_free_path(path);
return ret;
}
+
diff --git a/libocfs2/extent_tree.h b/libocfs2/extent_tree.h
index 4e6e091..651d382 100644
--- a/libocfs2/extent_tree.h
+++ b/libocfs2/extent_tree.h
@@ -109,3 +109,10 @@ int ocfs2_change_extent_flag(ocfs2_filesys *fs,
int ocfs2_remove_extent(ocfs2_filesys *fs,
struct ocfs2_extent_tree *et,
uint32_t cpos, uint32_t len);
+void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et,
+ ocfs2_filesys *fs,
+ char *buf, uint64_t blkno);
+int ocfs2_remove_btree_range(ocfs2_filesys *fs, struct ocfs2_dinode *di,
+ struct ocfs2_extent_tree *et, uint32_t cpos,
+ uint32_t p_cpos, uint32_t len);
+
--
Coly Li
SuSE Labs
More information about the Ocfs2-tools-devel
mailing list