[Ocfs2-tools-devel] [RFC 6/8] dx_dirs v4: dir indexed tree truncate in libocfs2
Coly Li
coly.li at suse.de
Wed Jan 20 07:25:20 PST 2010
This patch truncates dir indexed tree with help of libocfs2 extent tree code.
fsck.ocfs2 calls libocfs2/dir_indexed:ocfs2_dx_dir_truncate(), which in turn calls
libocfs2/truncate.c:ocfs2_dir_indexed_tree_truncate() to truncate data block of the indexed tree (not include dx_root).
Signed-off-by: Coly Li <coly.li at suse.de>
---
truncate.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/libocfs2/truncate.c b/libocfs2/truncate.c
index 680fca5..2a39543 100644
--- a/libocfs2/truncate.c
+++ b/libocfs2/truncate.c
@@ -331,6 +331,21 @@ errcode_t ocfs2_xattr_tree_truncate(ocfs2_filesys *fs,
&ctxt, &changed);
}
+
+errcode_t ocfs2_dir_indexed_tree_truncate(ocfs2_filesys *fs,
+ struct ocfs2_dx_root_block *dx_root)
+{
+ struct truncate_ctxt ctxt;
+
+ ctxt.new_i_clusters = dx_root->dr_clusters;
+ ctxt.new_size_in_clusters = 0;
+
+ return ocfs2_extent_iterate_dx_root(fs, dx_root,
+ OCFS2_EXTENT_FLAG_DEPTH_TRAVERSE,
+ NULL, truncate_iterate, &ctxt);
+}
+
+
#ifdef DEBUG_EXE
#include <stdlib.h>
#include <getopt.h>
--
Coly Li
SuSE Labs
More information about the Ocfs2-tools-devel
mailing list