[Ocfs2-tools-commits] zab commits r399 - in trunk: fsck.ocfs2 libocfs2 libocfs2/include

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Nov 15 15:25:06 CST 2004


Author: zab
Date: 2004-11-15 15:25:04 -0600 (Mon, 15 Nov 2004)
New Revision: 399

Modified:
   trunk/fsck.ocfs2/pass1.c
   trunk/libocfs2/chainalloc.c
   trunk/libocfs2/include/ocfs2.h
Log:
o fix up logic error that was preventing inode allocator checking
o add a little helper that forces a bit in a chain allocator


Modified: trunk/fsck.ocfs2/pass1.c
===================================================================
--- trunk/fsck.ocfs2/pass1.c	2004-11-13 00:16:22 UTC (rev 398)
+++ trunk/fsck.ocfs2/pass1.c	2004-11-15 21:25:04 UTC (rev 399)
@@ -95,7 +95,7 @@
 
 	val = !!val;
 
-	if (!ost->ost_write_inode_alloc)
+	if (ost->ost_write_inode_alloc_asked && !ost->ost_write_inode_alloc)
 		return;
 
 	max_nodes = OCFS2_RAW_SB(ost->ost_fs->fs_super)->s_max_nodes;
@@ -114,15 +114,8 @@
 		if (cinode == NULL)
 			continue;
 
-		if (val)
-			ret = ocfs2_bitmap_set(cinode->ci_chains, blkno,
-					       &oldval);
-		else
-			ret = ocfs2_bitmap_clear(cinode->ci_chains, blkno,
-						 &oldval);
-
-		com_err(whoami, ret, "node %"PRIu16, node);
-
+		ret = ocfs2_chain_force_val(ost->ost_fs, cinode, blkno, val,
+					    &oldval);
 		if (ret) {
 		       	if (ret != OCFS2_ET_INVALID_BIT)
 				com_err(whoami, ret, "while trying to set "

Modified: trunk/libocfs2/chainalloc.c
===================================================================
--- trunk/libocfs2/chainalloc.c	2004-11-13 00:16:22 UTC (rev 398)
+++ trunk/libocfs2/chainalloc.c	2004-11-15 21:25:04 UTC (rev 399)
@@ -353,6 +353,27 @@
 	return 0;
 }
 
+/* just a variant that won't return failure if it tried to set what
+ * was already set */
+errcode_t ocfs2_chain_force_val(ocfs2_filesys *fs,
+				ocfs2_cached_inode *cinode,
+				uint64_t blkno, 
+				int newval, 
+				int *oldval)
+{
+	errcode_t ret;
+
+	if (!cinode->ci_chains)
+		return OCFS2_ET_INVALID_ARGUMENT;
+
+	if (newval)
+		ret = ocfs2_bitmap_set(cinode->ci_chains, blkno, oldval);
+	else
+		ret = ocfs2_bitmap_clear(cinode->ci_chains, blkno, oldval);
+
+	return ret;
+}
+
 errcode_t ocfs2_chain_test(ocfs2_filesys *fs,
 			   ocfs2_cached_inode *cinode,
 			   uint64_t blkno,

Modified: trunk/libocfs2/include/ocfs2.h
===================================================================
--- trunk/libocfs2/include/ocfs2.h	2004-11-13 00:16:22 UTC (rev 398)
+++ trunk/libocfs2/include/ocfs2.h	2004-11-15 21:25:04 UTC (rev 399)
@@ -428,6 +428,11 @@
 			   ocfs2_cached_inode *cinode,
 			   uint64_t blkno,
 			   int *oldval);
+errcode_t ocfs2_chain_force_val(ocfs2_filesys *fs,
+				ocfs2_cached_inode *cinode,
+				uint64_t blkno, 
+				int newval,
+				int *oldval);
 
 errcode_t ocfs2_expand_dir(ocfs2_filesys *fs, uint64_t dir);
 



More information about the Ocfs2-tools-commits mailing list