[Ocfs2-tools-devel] [PATCH 07/22] libocfs2: Make chain iteration know discontig group.

Tao Ma tao.ma at oracle.com
Wed Mar 31 21:41:11 PDT 2010


Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
 libocfs2/chain.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/libocfs2/chain.c b/libocfs2/chain.c
index 039ddaf..4af12ee 100644
--- a/libocfs2/chain.c
+++ b/libocfs2/chain.c
@@ -146,6 +146,7 @@ struct chain_context {
 	errcode_t errcode;
 	char *gd_buf;
 	void *priv_data;
+	int suballocator;
 };
 
 
@@ -166,7 +167,8 @@ static int chain_iterate_gd(struct ocfs2_chain_rec *c_rec,
 			break;
 
 		ctxt->errcode = ocfs2_read_group_desc(ctxt->fs, blkno,
-						      ctxt->gd_buf, 0);
+						      ctxt->gd_buf,
+						      ctxt->suballocator);
 		if (ctxt->errcode) {
 			iret |= OCFS2_CHAIN_ERROR;
 			break;
@@ -218,6 +220,12 @@ errcode_t ocfs2_chain_iterate(ocfs2_filesys *fs,
 	struct ocfs2_dinode *inode;
 	errcode_t ret;
 	struct chain_context ctxt;
+	uint64_t gb_blkno;
+
+	ret = ocfs2_lookup_system_inode(fs, GLOBAL_BITMAP_SYSTEM_INODE,
+					0, &gb_blkno);
+	if (ret)
+		return ret;
 
 	ret = ocfs2_malloc_block(fs->fs_io, &buf);
 	if (ret)
@@ -244,6 +252,7 @@ errcode_t ocfs2_chain_iterate(ocfs2_filesys *fs,
 	ctxt.fs = fs;
 	ctxt.func = func;
 	ctxt.priv_data = priv_data;
+	ctxt.suballocator = (gb_blkno != blkno);
 
 	ret = 0;
 	iret |= chain_iterate_cl(&inode->id2.i_chain, &ctxt);
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list