[Ocfs2-tools-devel] [PATCH 05/22] libocfs2: Add functions for read/write discontig groups.

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


Add functions to read discontig block group and change
all the callers to see no-discontig groups. They will be
changed later.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
 debugfs.ocfs2/commands.c           |    4 ++--
 debugfs.ocfs2/dump.c               |    3 ++-
 debugfs.ocfs2/find_block_inode.c   |    2 +-
 extras/find_allocation_fragments.c |    2 +-
 fsck.ocfs2/pass0.c                 |   20 ++++++++++----------
 fswreck/chain.c                    |    6 +++---
 fswreck/group.c                    |   12 ++++++------
 include/ocfs2/ocfs2.h              |    8 +++++---
 libocfs2/chain.c                   |   24 +++++++++++++++++-------
 libocfs2/chainalloc.c              |    6 +++---
 libocfs2/inode_scan.c              |    2 +-
 mkfs.ocfs2/mkfs.c                  |   16 +++++++++++++---
 o2image/o2image.c                  |    2 +-
 tunefs.ocfs2/feature_metaecc.c     |    4 ++--
 tunefs.ocfs2/libocfs2ne.c          |    2 +-
 tunefs.ocfs2/op_resize_volume.c    |    8 ++++----
 tunefs.ocfs2/op_set_slot_count.c   |    4 ++--
 17 files changed, 74 insertions(+), 51 deletions(-)

diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
index 1c19ab4..2c33ab3 100644
--- a/debugfs.ocfs2/commands.c
+++ b/debugfs.ocfs2/commands.c
@@ -603,7 +603,7 @@ static errcode_t traverse_chains (ocfs2_filesys *fs, struct ocfs2_chain_list *cl
 		index = 0;
 		fprintf(out, "\n");
 		while (blkno) {
-			ret = ocfs2_read_group_desc(fs, blkno, buf);
+			ret = ocfs2_read_group_desc(fs, blkno, buf, 0);
 			if (ret)
 				goto bail;
 
@@ -1230,7 +1230,7 @@ static void do_group (char **args)
 	buf = gbls.blockbuf;
 	out = open_pager(gbls.interactive);
 	while (blkno) {
-		ret = ocfs2_read_group_desc(gbls.fs, blkno, buf);
+		ret = ocfs2_read_group_desc(gbls.fs, blkno, buf, 0);
 		if (ret) {
 			com_err(args[0], ret, "while reading block group "
 				"descriptor %"PRIu64"", blkno);
diff --git a/debugfs.ocfs2/dump.c b/debugfs.ocfs2/dump.c
index 7880991..a78ab02 100644
--- a/debugfs.ocfs2/dump.c
+++ b/debugfs.ocfs2/dump.c
@@ -708,7 +708,8 @@ void dump_jbd_metadata (FILE *out, enum dump_block_type type, char *buf,
 		break;
 	case DUMP_BLOCK_GROUP_DESCRIPTOR:
 		fprintf(out, "Group\n");
-		ocfs2_swap_group_desc((struct ocfs2_group_desc *)buf);
+		ocfs2_swap_group_desc(gbls.fs,
+				      (struct ocfs2_group_desc *)buf, 0, 1);
 		dump_group_descriptor (out, (struct ocfs2_group_desc *)buf, 0);
 		fprintf (out, "\n");
 		break;
diff --git a/debugfs.ocfs2/find_block_inode.c b/debugfs.ocfs2/find_block_inode.c
index 3ed8879..a90488c 100644
--- a/debugfs.ocfs2/find_block_inode.c
+++ b/debugfs.ocfs2/find_block_inode.c
@@ -139,7 +139,7 @@ static int walk_chain_func(ocfs2_filesys *fs, uint64_t blkno, int chain,
 	int i;
 	errcode_t ret;
 
-	ret = ocfs2_read_group_desc(fs, blkno, wi->buf);
+	ret = ocfs2_read_group_desc(fs, blkno, wi->buf, 0);
 	if (ret) {
 		com_err(gbls.cmd, ret, "while reading group %"PRIu64, blkno);
 		return ret;
diff --git a/extras/find_allocation_fragments.c b/extras/find_allocation_fragments.c
index 0724655..aa76529 100644
--- a/extras/find_allocation_fragments.c
+++ b/extras/find_allocation_fragments.c
@@ -123,7 +123,7 @@ static int iterate_chain(ocfs2_filesys *fs, uint64_t start)
 
 	gd_blkno = start;
 	do {
-		ret = ocfs2_read_group_desc(fs, gd_blkno, buf);
+		ret = ocfs2_read_group_desc(fs, gd_blkno, buf, 0);
 		if (ret)
 			goto out_free;
 
diff --git a/fsck.ocfs2/pass0.c b/fsck.ocfs2/pass0.c
index 35f5e41..bc28ab2 100644
--- a/fsck.ocfs2/pass0.c
+++ b/fsck.ocfs2/pass0.c
@@ -139,7 +139,7 @@ static errcode_t check_group_parent(ocfs2_filesys *fs, uint64_t group,
 			break;
 		}
 
-		ret = ocfs2_read_group_desc(fs, gd_blkno, gd_buf);
+		ret = ocfs2_read_group_desc(fs, gd_blkno, gd_buf, 0);
 		if (ret)
 			goto out;
 		gd = (struct ocfs2_group_desc *)gd_buf;
@@ -255,7 +255,7 @@ static errcode_t repair_group_desc(o2fsck_state *ost,
 
 	if (changed) {
 		ret = ocfs2_write_group_desc(ost->ost_fs, bg->bg_blkno,
-					     (char *)bg);
+					     (char *)bg, 0);
 		if (ret) {
 			com_err(whoami, ret, "while writing a group "
 				"descriptor to block %"PRIu64" somewhere in "
@@ -313,7 +313,7 @@ static void unlink_group_desc(o2fsck_state *ost,
 		next_desc = cr->c_blkno;
 		while(next_desc) {
 			ret = ocfs2_read_group_desc(ost->ost_fs, next_desc,
-						    (char *)link);
+						    (char *)link, 0);
 			if (ret) {
 				com_err(whoami, ret, "while reading a "
 					"group descriptor from block %"PRIu64,
@@ -328,7 +328,7 @@ static void unlink_group_desc(o2fsck_state *ost,
 
 			link->bg_next_group = bg->bg_next_group;
 			ret = ocfs2_write_group_desc(ost->ost_fs, next_desc,
-						     (char *)link);
+						     (char *)link, 0);
 			if (ret) {
 				com_err(whoami, ret, "while writing a group "
 					"descriptor to block %"PRIu64" "
@@ -423,7 +423,7 @@ static errcode_t maybe_fix_clusters_per_group(o2fsck_state *ost,
 
 	blkno = cl->cl_recs[0].c_blkno;
 
-	ret = ocfs2_read_group_desc(ost->ost_fs, blkno, (char *)gd);
+	ret = ocfs2_read_group_desc(ost->ost_fs, blkno, (char *)gd, 0);
 	if (ret) {
 		com_err(whoami, ret, "while reading group descriptor "
 			"at block %"PRIu64" to fix cl_cpg", blkno);
@@ -537,7 +537,7 @@ static errcode_t check_chain(o2fsck_state *ost,
 			ocfs2_read_blocks(ost->ost_fs, blkno,
 					  blocks_per_group, pre_cache_buf);
 
-		ret = ocfs2_read_group_desc(ost->ost_fs, blkno, (char *)bg2);
+		ret = ocfs2_read_group_desc(ost->ost_fs, blkno, (char *)bg2, 0);
 		if (ret == OCFS2_ET_BAD_GROUP_DESC_MAGIC) {
 			if (prompt(ost, PY, PR_CHAIN_LINK_MAGIC,
 				   "Chain %d in allocator at inode "
@@ -605,7 +605,7 @@ static errcode_t check_chain(o2fsck_state *ost,
 			bg1->bg_next_group = 0;
 			ret = ocfs2_write_group_desc(ost->ost_fs,
 					             bg1->bg_blkno,
-						     (char *)bg1);
+						     (char *)bg1, 0);
 			if (ret) {
 				com_err(whoami, ret, "while writing a group "
 					"descriptor at depth %d in chain %d "
@@ -931,7 +931,7 @@ static errcode_t verify_bitmap_descs(o2fsck_state *ost,
 			continue;
 		}
 
-		ret = ocfs2_read_group_desc(ost->ost_fs, blkno, (char *)bg);
+		ret = ocfs2_read_group_desc(ost->ost_fs, blkno, (char *)bg, 0);
 		if (ret) {
 			com_err(whoami, ret, "while reading a cluster bitmap "
 				"group descriptor from block %"PRIu64,
@@ -973,7 +973,7 @@ static errcode_t verify_bitmap_descs(o2fsck_state *ost,
 		 * using the predictability of the group descs to rebuild
 		 * its values.. we only preserve the bitmap if the signature
 		 * and generation match this volume */
-		ret = ocfs2_read_group_desc(ost->ost_fs, blkno, (char *)bg);
+		ret = ocfs2_read_group_desc(ost->ost_fs, blkno, (char *)bg, 0);
 		if (ret == OCFS2_ET_BAD_GROUP_DESC_MAGIC ||
 		    bg->bg_generation != ost->ost_fs_generation) {
 			memset(bg, 0, ost->ost_fs->fs_blocksize);
@@ -1012,7 +1012,7 @@ static errcode_t verify_bitmap_descs(o2fsck_state *ost,
 		rec = &di->id2.i_chain.cl_recs[bg->bg_chain];
 		bg->bg_next_group = rec->c_blkno;
 
-		ret = ocfs2_write_group_desc(ost->ost_fs, blkno, (char *)bg);
+		ret = ocfs2_write_group_desc(ost->ost_fs, blkno, (char *)bg, 0);
 		if (ret) {
 			com_err(whoami, ret, "while writing a cluster group "
 				"descriptor at block %"PRIu64, blkno);
diff --git a/fswreck/chain.c b/fswreck/chain.c
index efe14e9..6c2dbf0 100644
--- a/fswreck/chain.c
+++ b/fswreck/chain.c
@@ -279,7 +279,7 @@ static void mess_up_sys_file(ocfs2_filesys *fs, uint64_t blkno,
 		bg = (struct ocfs2_group_desc *)bufgroup;
 		cr = cl->cl_recs;
 
-		ret = ocfs2_read_group_desc(fs, cr->c_blkno, (char *)bg);
+		ret = ocfs2_read_group_desc(fs, cr->c_blkno, (char *)bg, 0);
 		if (ret)
 			FSWRK_COM_FATAL(progname, ret);
 
@@ -298,10 +298,10 @@ static void mess_up_sys_file(ocfs2_filesys *fs, uint64_t blkno,
 			    ocfs2_clusters_to_blocks(fs, fs->fs_clusters) + 10;
 			fprintf(stdout, "Corrupt CHAIN_LINK_RANGE: "
 				"change next group from %"PRIu64" to %"PRIu64
-				" \n", oldblkno, bg->bg_next_group);
+				"\n", oldblkno, bg->bg_next_group);
 		}
 		
-		ret = ocfs2_write_group_desc(fs, cr->c_blkno, (char *)bg);
+		ret = ocfs2_write_group_desc(fs, cr->c_blkno, (char *)bg, 0);
 		if (ret)
 			FSWRK_COM_FATAL(progname, ret);
 		break;	
diff --git a/fswreck/group.c b/fswreck/group.c
index 6734f49..f9ea159 100644
--- a/fswreck/group.c
+++ b/fswreck/group.c
@@ -108,7 +108,7 @@ static void damage_group_desc(ocfs2_filesys *fs, uint64_t blkno,
 		FSWRK_COM_FATAL(progname, ret);
 	
 	cr = cl->cl_recs;
-	ret = ocfs2_read_group_desc(fs, cr->c_blkno, bufgroup);
+	ret = ocfs2_read_group_desc(fs, cr->c_blkno, bufgroup, 0);
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
@@ -141,7 +141,7 @@ static void damage_group_desc(ocfs2_filesys *fs, uint64_t blkno,
 				FSWRK_COM_FATAL(progname, ret);
 	
 			ret = ocfs2_read_group_desc(fs, bg->bg_next_group,
-							 bufgroup1);
+							 bufgroup1, 0);
 			if (ret)
 				FSWRK_COM_FATAL(progname, ret);
 
@@ -153,7 +153,7 @@ static void damage_group_desc(ocfs2_filesys *fs, uint64_t blkno,
 				bg1->bg_generation, (bg1->bg_generation + 10));
 
 			ret = ocfs2_write_group_desc(fs, bg->bg_next_group,
-							bufgroup1);
+							bufgroup1, 0);
 			if (ret)
 				FSWRK_COM_FATAL(progname, ret);
 		}
@@ -186,7 +186,7 @@ static void damage_group_desc(ocfs2_filesys *fs, uint64_t blkno,
 		FSWRK_FATAL("Invalid type[%d]\n", type);
 	}
 
-	ret = ocfs2_write_group_desc(fs, cr->c_blkno, bufgroup);
+	ret = ocfs2_write_group_desc(fs, cr->c_blkno, bufgroup, 0);
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
@@ -275,7 +275,7 @@ void mess_up_cluster_group_desc(ocfs2_filesys *fs, enum fsck_type type,
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
-	ret = ocfs2_read_group_desc(fs, bg_blk, buf);
+	ret = ocfs2_read_group_desc(fs, bg_blk, buf, 0);
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
@@ -284,7 +284,7 @@ void mess_up_cluster_group_desc(ocfs2_filesys *fs, enum fsck_type type,
 	old_free_bits = bg->bg_free_bits_count;
 	bg->bg_free_bits_count = bg->bg_bits + 10;
 
-	ret = ocfs2_write_group_desc(fs, bg_blk, buf);
+	ret = ocfs2_write_group_desc(fs, bg_blk, buf, 0);
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
diff --git a/include/ocfs2/ocfs2.h b/include/ocfs2/ocfs2.h
index 658bb04..5c46acf 100644
--- a/include/ocfs2/ocfs2.h
+++ b/include/ocfs2/ocfs2.h
@@ -568,12 +568,14 @@ errcode_t ocfs2_check_heartbeats(struct list_head *dev_list, int ignore_local);
 errcode_t ocfs2_get_ocfs1_label(char *device, uint8_t *label, uint16_t label_len,
 				uint8_t *uuid, uint16_t uuid_len);
 
-void ocfs2_swap_group_desc(struct ocfs2_group_desc *gd);
+void ocfs2_swap_group_desc(ocfs2_filesys *fs,
+			   struct ocfs2_group_desc *gd,
+			   int suballocator, int from_cpu);
 errcode_t ocfs2_read_group_desc(ocfs2_filesys *fs, uint64_t blkno,
-				char *gd_buf);
+				char *gd_buf, int suballocator);
 
 errcode_t ocfs2_write_group_desc(ocfs2_filesys *fs, uint64_t blkno,
-				 char *gd_buf);
+				 char *gd_buf, int suballocator);
 
 errcode_t ocfs2_chain_iterate(ocfs2_filesys *fs,
 			      uint64_t blkno,
diff --git a/libocfs2/chain.c b/libocfs2/chain.c
index e9d3873..039ddaf 100644
--- a/libocfs2/chain.c
+++ b/libocfs2/chain.c
@@ -31,7 +31,9 @@
 
 #include "ocfs2/byteorder.h"
 
-void ocfs2_swap_group_desc(struct ocfs2_group_desc *gd)
+void ocfs2_swap_group_desc(ocfs2_filesys *fs,
+			   struct ocfs2_group_desc *gd,
+			   int suballocator, int from_cpu)
 {
 	if (cpu_is_little_endian)
 		return;
@@ -44,10 +46,18 @@ void ocfs2_swap_group_desc(struct ocfs2_group_desc *gd)
 	gd->bg_next_group = bswap_64(gd->bg_next_group);
 	gd->bg_parent_dinode = bswap_64(gd->bg_parent_dinode);
 	gd->bg_blkno = bswap_64(gd->bg_blkno);
+
+	/* In case of suballocator, we may meet with a discontiguous group. */
+	if (suballocator && gd->bg_list.l_next_free_rec) {
+		if (from_cpu)
+			ocfs2_swap_extent_list_from_cpu(fs, gd, &gd->bg_list);
+		else
+			ocfs2_swap_extent_list_to_cpu(fs, gd, &gd->bg_list);
+	}
 }
 
 errcode_t ocfs2_read_group_desc(ocfs2_filesys *fs, uint64_t blkno,
-				char *gd_buf)
+				char *gd_buf, int suballocator)
 {
 	errcode_t ret;
 	char *blk;
@@ -79,7 +89,7 @@ errcode_t ocfs2_read_group_desc(ocfs2_filesys *fs, uint64_t blkno,
 	memcpy(gd_buf, blk, fs->fs_blocksize);
 
 	gd = (struct ocfs2_group_desc *)gd_buf;
-	ocfs2_swap_group_desc(gd);
+	ocfs2_swap_group_desc(fs, gd, suballocator, 0);
 
 	ret = 0;
 out:
@@ -89,7 +99,7 @@ out:
 }
 
 errcode_t ocfs2_write_group_desc(ocfs2_filesys *fs, uint64_t blkno,
-				 char *gd_buf)
+				 char *gd_buf, int suballocator)
 {
 	errcode_t ret;
 	char *blk;
@@ -109,7 +119,7 @@ errcode_t ocfs2_write_group_desc(ocfs2_filesys *fs, uint64_t blkno,
 	memcpy(blk, gd_buf, fs->fs_blocksize);
 
 	gd = (struct ocfs2_group_desc *)blk;
-	ocfs2_swap_group_desc(gd);
+	ocfs2_swap_group_desc(fs, gd, suballocator, 1);
 
 	ocfs2_compute_meta_ecc(fs, blk, &gd->bg_check);
 	ret = io_write_block(fs->fs_io, blkno, 1, blk);
@@ -156,7 +166,7 @@ static int chain_iterate_gd(struct ocfs2_chain_rec *c_rec,
 			break;
 
 		ctxt->errcode = ocfs2_read_group_desc(ctxt->fs, blkno,
-						      ctxt->gd_buf);
+						      ctxt->gd_buf, 0);
 		if (ctxt->errcode) {
 			iret |= OCFS2_CHAIN_ERROR;
 			break;
@@ -303,7 +313,7 @@ static int walk_chain_func(ocfs2_filesys *fs,
 		wi->count_free = wi->count_total = 0;
 	}
 
-	ret = ocfs2_read_group_desc(fs, gd_blkno, wi->gd_buf);
+	ret = ocfs2_read_group_desc(fs, gd_blkno, wi->gd_buf, 0);
 	if (ret)
 		return OCFS2_CHAIN_ERROR;
 
diff --git a/libocfs2/chainalloc.c b/libocfs2/chainalloc.c
index fb2b99e..eecf979 100644
--- a/libocfs2/chainalloc.c
+++ b/libocfs2/chainalloc.c
@@ -96,7 +96,7 @@ static int chainalloc_process_group(ocfs2_filesys *fs,
 	if (cb->cb_errcode)
 		return OCFS2_CHAIN_ABORT;
 
-	cb->cb_errcode = ocfs2_read_group_desc(fs, gd_blkno, gd_buf);
+	cb->cb_errcode = ocfs2_read_group_desc(fs, gd_blkno, gd_buf, 0);
 	if (cb->cb_errcode)
 		goto out_free_buf;
 
@@ -177,7 +177,7 @@ static errcode_t chainalloc_write_group(struct ocfs2_bitmap_region *br,
 	memcpy(cr->cr_ag->bg_bitmap, br->br_bitmap, br->br_bytes);
 
 	ret = ocfs2_write_group_desc(fs, cr->cr_ag->bg_blkno, 
-				     (char *)cr->cr_ag);
+				     (char *)cr->cr_ag, 0);
 	if (ret == 0)
 		cr->cr_dirty = 0;
 
@@ -543,7 +543,7 @@ errcode_t ocfs2_chain_add_group(ocfs2_filesys *fs,
 	old_blkno = rec->c_blkno;
 	gd->bg_next_group = old_blkno;
 
-	ret = ocfs2_write_group_desc(fs, blkno, (char *)gd);
+	ret = ocfs2_write_group_desc(fs, blkno, (char *)gd, 0);
 	if (ret)
 		goto out;
 
diff --git a/libocfs2/inode_scan.c b/libocfs2/inode_scan.c
index 0e5f2e6..35e7cb4 100644
--- a/libocfs2/inode_scan.c
+++ b/libocfs2/inode_scan.c
@@ -87,7 +87,7 @@ static errcode_t get_next_group(ocfs2_inode_scan *scan)
 		abort();
 
 	ret = ocfs2_read_group_desc(scan->fs, scan->cur_blkno,
-				    (char *)scan->cur_desc);
+				    (char *)scan->cur_desc, 0);
 	if (ret)
 		return (ret);
 
diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
index 240056e..297577b 100644
--- a/mkfs.ocfs2/mkfs.c
+++ b/mkfs.ocfs2/mkfs.c
@@ -2174,6 +2174,16 @@ static void mkfs_swap_inode_from_cpu(State *s, struct ocfs2_dinode *di)
 	ocfs2_swap_inode_from_cpu(&fake_fs, di);
 }
 
+static void mkfs_swap_group_desc(State *s, struct ocfs2_group_desc *gd,
+				 int from_cpu)
+{
+	ocfs2_filesys fake_fs;
+	char super_buf[OCFS2_MAX_BLOCKSIZE];
+
+	fill_fake_fs(s, &fake_fs, super_buf);
+	ocfs2_swap_group_desc(&fake_fs, gd, 0, from_cpu);
+}
+
 static void
 format_superblock(State *s, SystemFileDiskRecord *rec,
 		  SystemFileDiskRecord *root_rec, SystemFileDiskRecord *sys_rec)
@@ -2469,7 +2479,7 @@ write_bitmap_data(State *s, AllocBitmap *bitmap)
 		gd->bg_parent_dinode = parent_blkno;
 		memcpy(buf, gd, s->blocksize);
 		gd_buf = (struct ocfs2_group_desc *)buf;
-		ocfs2_swap_group_desc(gd_buf);
+		mkfs_swap_group_desc(s, gd_buf, 1);
 		mkfs_compute_meta_ecc(s, buf, &gd_buf->bg_check);
 		do_pwrite(s, buf, s->cluster_size,
 			  gd->bg_blkno << s->blocksize_bits);
@@ -2481,10 +2491,10 @@ static void
 write_group_data(State *s, AllocGroup *group)
 {
 	uint64_t blkno = group->gd->bg_blkno;
-	ocfs2_swap_group_desc(group->gd);
+	mkfs_swap_group_desc(s, group->gd, 1);
 	mkfs_compute_meta_ecc(s, group->gd, &group->gd->bg_check);
 	do_pwrite(s, group->gd, s->blocksize, blkno << s->blocksize_bits);
-	ocfs2_swap_group_desc(group->gd);
+	mkfs_swap_group_desc(s, group->gd, 0);
 }
 
 static void mkfs_swap_dir(State *s, DirData *dir,
diff --git a/o2image/o2image.c b/o2image/o2image.c
index dae649f..cf9f0dc 100644
--- a/o2image/o2image.c
+++ b/o2image/o2image.c
@@ -149,7 +149,7 @@ static errcode_t traverse_chains(ocfs2_filesys *ofs,
 		blkno = rec->c_blkno;
 		while (blkno) {
 			ocfs2_image_mark_bitmap(ofs, blkno);
-			ret = ocfs2_read_group_desc(ofs, blkno, buf);
+			ret = ocfs2_read_group_desc(ofs, blkno, buf, 0);
 			if (ret)
 				goto out;
 
diff --git a/tunefs.ocfs2/feature_metaecc.c b/tunefs.ocfs2/feature_metaecc.c
index c4de8be..360d581 100644
--- a/tunefs.ocfs2/feature_metaecc.c
+++ b/tunefs.ocfs2/feature_metaecc.c
@@ -791,7 +791,7 @@ out:
 static errcode_t gd_write_func(ocfs2_filesys *fs,
 			       struct block_to_ecc *block)
 {
-	return ocfs2_write_group_desc(fs, block->e_blkno, block->e_buf);
+	return ocfs2_write_group_desc(fs, block->e_blkno, block->e_buf, 0);
 }
 
 static errcode_t block_insert_gd(ocfs2_filesys *fs,
@@ -926,7 +926,7 @@ static int chain_iterate(ocfs2_filesys *fs, uint64_t gd_blkno,
 
 	verbosef(VL_DEBUG, "Reading group descriptor at %"PRIu64"\n",
 		 gd_blkno);
-	ret = ocfs2_read_group_desc(fs, gd_blkno, (char *)gd);
+	ret = ocfs2_read_group_desc(fs, gd_blkno, (char *)gd, 0);
 	if (ret)
 		goto out;
 
diff --git a/tunefs.ocfs2/libocfs2ne.c b/tunefs.ocfs2/libocfs2ne.c
index 174fef0..ea30d65 100644
--- a/tunefs.ocfs2/libocfs2ne.c
+++ b/tunefs.ocfs2/libocfs2ne.c
@@ -928,7 +928,7 @@ static errcode_t tunefs_validate_chain_group(ocfs2_filesys *fs,
 	blkno = cr->c_blkno;
 
 	while (blkno) {
-		ret = ocfs2_read_group_desc(fs, blkno, buf);
+		ret = ocfs2_read_group_desc(fs, blkno, buf, 0);
 		if (ret) {
 			verbosef(VL_LIB,
 				 "%s while reading chain group descriptor "
diff --git a/tunefs.ocfs2/op_resize_volume.c b/tunefs.ocfs2/op_resize_volume.c
index 0d0679c..4329010 100644
--- a/tunefs.ocfs2/op_resize_volume.c
+++ b/tunefs.ocfs2/op_resize_volume.c
@@ -149,7 +149,7 @@ static errcode_t online_resize_group_add(ocfs2_filesys *fs,
 	if (ret)
 		goto out;
 
-	ret = ocfs2_write_group_desc(fs, gd_blkno, gd_buf);
+	ret = ocfs2_write_group_desc(fs, gd_blkno, gd_buf, 0);
 	if (ret)
 		goto out;
 
@@ -277,7 +277,7 @@ static errcode_t init_new_gd(ocfs2_filesys *fs,
 			tunefs_update_fs_clusters(fs);
 		} else {
 			/* write a new group descriptor */
-			ret = ocfs2_write_group_desc(fs, gd_blkno, gd_buf);
+			ret = ocfs2_write_group_desc(fs, gd_blkno, gd_buf, 0);
 			if (ret) {
 				tcom_err(ret,
 					 "while writing the new group "
@@ -306,7 +306,7 @@ static errcode_t update_global_bitmap(ocfs2_filesys *fs,
 	tunefs_block_signals();
 	/* Flush that last group descriptor we updated before the new ones */
 	if (flush_lgd) {
-		ret = ocfs2_write_group_desc(fs, lgd->bg_blkno, (char *)lgd);
+		ret = ocfs2_write_group_desc(fs, lgd->bg_blkno, (char *)lgd, 0);
 		if (ret) {
 			tcom_err(ret,
 				 "while flushing the former tail group "
@@ -391,7 +391,7 @@ static errcode_t run_resize(ocfs2_filesys *fs, uint32_t total_clusters,
 	/* Find the blknum of the last cluster group */
 	lgd_blkno = ocfs2_which_cluster_group(fs, cl->cl_cpg, first_new_cluster - 1);
 
-	ret = ocfs2_read_group_desc(fs, lgd_blkno, lgd_buf);
+	ret = ocfs2_read_group_desc(fs, lgd_blkno, lgd_buf, 0);
 	if (ret) {
 		tcom_err(ret,
 			 "while reading the tail group descriptor from "
diff --git a/tunefs.ocfs2/op_set_slot_count.c b/tunefs.ocfs2/op_set_slot_count.c
index 46ce2de..3cac17d 100644
--- a/tunefs.ocfs2/op_set_slot_count.c
+++ b/tunefs.ocfs2/op_set_slot_count.c
@@ -269,7 +269,7 @@ static errcode_t move_group(ocfs2_filesys *fs,
 	 */
 	gd->bg_next_group = cr->c_blkno;
 
-	ret = ocfs2_write_group_desc(fs, group->blkno, group->gd_buf);
+	ret = ocfs2_write_group_desc(fs, group->blkno, group->gd_buf, 0);
 	if (ret)
 		goto bail;
 
@@ -336,7 +336,7 @@ static errcode_t move_chain_rec(ocfs2_filesys *fs, struct relink_ctxt *ctxt)
 		if (ret)
 			goto bail;
 
-		ret = ocfs2_read_group_desc(fs, gd_blkno, group->gd_buf);
+		ret = ocfs2_read_group_desc(fs, gd_blkno, group->gd_buf, 0);
 		if (ret)
 			goto bail;
 
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list