[Ocfs2-tools-commits] zab commits r1035 - in branches/endian-safe: extras fsck.ocfs2 libocfs2 libocfs2/include

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Aug 10 15:17:40 CDT 2005


Author: zab
Date: 2005-08-10 15:17:37 -0500 (Wed, 10 Aug 2005)
New Revision: 1035

Modified:
   branches/endian-safe/extras/find_dup_extents.c
   branches/endian-safe/fsck.ocfs2/pass1.c
   branches/endian-safe/libocfs2/include/ocfs2.h
   branches/endian-safe/libocfs2/inode.c
   branches/endian-safe/libocfs2/inode_scan.c
Log:
Oops, don't check signatures down in the scan inode interface.
It's meant to be much more low level than that, callers are
expected to swap after verifying signatures.

Also update some debugging macros I used when tracking this down.



Modified: branches/endian-safe/extras/find_dup_extents.c
===================================================================
--- branches/endian-safe/extras/find_dup_extents.c	2005-08-10 17:12:19 UTC (rev 1034)
+++ branches/endian-safe/extras/find_dup_extents.c	2005-08-10 20:17:37 UTC (rev 1035)
@@ -184,6 +184,8 @@
 				   strlen(OCFS2_INODE_SIGNATURE)))
 				continue;
 
+			ocfs2_swap_inode_to_cpu(di);
+
 			if (!(di->i_flags & OCFS2_VALID_FL))
 				continue;
 

Modified: branches/endian-safe/fsck.ocfs2/pass1.c
===================================================================
--- branches/endian-safe/fsck.ocfs2/pass1.c	2005-08-10 17:12:19 UTC (rev 1034)
+++ branches/endian-safe/fsck.ocfs2/pass1.c	2005-08-10 20:17:37 UTC (rev 1035)
@@ -129,10 +129,13 @@
 		 * write back the new map */
 		if (oldval != val && !ost->ost_write_inode_alloc_asked) {
 			yn = prompt(ost, PY, PR_INODE_ALLOC_REPAIR,
-				    "fsck found an inode whose "
-				    "allocation does not match the chain "
-				    "allocators.  Fix the allocation of this "
-				    "and all future inodes?");
+				    "Inode %"PRIu64" is marked as %s but its "
+				    "position in the inode allocator is "
+				    "marked as %s.  Fix the allocation of this "
+				    "and all future inodes?", blkno,
+				    val ? "valid" : "invalid",
+				    oldval ? "in use" : "free");
+
 			ost->ost_write_inode_alloc_asked = 1;
 			ost->ost_write_inode_alloc = !!yn;
 			if (!ost->ost_write_inode_alloc)
@@ -149,8 +152,8 @@
 		goto out;
 	}
 
-	verbosef("updated inode %"PRIu64" alloc to %d in slot %"PRId16"\n",
-		 blkno, val, slot);
+	verbosef("updated inode %"PRIu64" alloc to %d from %d in slot "
+		  "%"PRId16"\n", blkno, val, oldval, slot);
 
 	/* make sure the inode's fields are consistent if it's allocated */
 	if (val == 1 && slot != di->i_suballoc_slot &&
@@ -1168,24 +1171,29 @@
 
 		valid = 0;
 
-		/* we never consider inodes who don't have a signature.
-		 * We only consider inodes whose generations don't match
-		 * if the user has asked us to */
+		/* we never consider inodes who don't have a signature */
 		if (!memcmp(di->i_signature, OCFS2_INODE_SIGNATURE,
-			    strlen(OCFS2_INODE_SIGNATURE)) &&
-		    (ost->ost_fix_fs_gen ||
-		    (di->i_fs_generation == ost->ost_fs_generation))) {
+			    strlen(OCFS2_INODE_SIGNATURE))) {
 
-			if (di->i_flags & OCFS2_VALID_FL)
-				o2fsck_verify_inode_fields(fs, ost, blkno, di);
+			ocfs2_swap_inode_to_cpu(di);
 
-			if (di->i_flags & OCFS2_VALID_FL) {
-				ret = o2fsck_check_blocks(fs, ost, blkno, di);
-				if (ret)
-					goto out;
+			 /* We only consider inodes whose generations don't
+			  * match if the user has asked us to */
+			if ((ost->ost_fix_fs_gen ||
+			    (di->i_fs_generation == ost->ost_fs_generation))) {
+
+				if (di->i_flags & OCFS2_VALID_FL)
+					o2fsck_verify_inode_fields(fs, ost,
+								   blkno, di);
+				if (di->i_flags & OCFS2_VALID_FL) {
+					ret = o2fsck_check_blocks(fs, ost,
+								  blkno, di);
+					if (ret)
+						goto out;
+				}
+
+				valid = di->i_flags & OCFS2_VALID_FL;
 			}
-
-			valid = di->i_flags & OCFS2_VALID_FL;
 		}
 
 		update_inode_alloc(ost, di, blkno, valid);

Modified: branches/endian-safe/libocfs2/include/ocfs2.h
===================================================================
--- branches/endian-safe/libocfs2/include/ocfs2.h	2005-08-10 17:12:19 UTC (rev 1034)
+++ branches/endian-safe/libocfs2/include/ocfs2.h	2005-08-10 20:17:37 UTC (rev 1035)
@@ -257,8 +257,6 @@
 void ocfs2_swap_inode_to_cpu(ocfs2_dinode *di);
 errcode_t ocfs2_read_inode(ocfs2_filesys *fs, uint64_t blkno,
 			   char *inode_buf);
-errcode_t ocfs2_read_inodes(ocfs2_filesys *fs, uint64_t blkno, int num_blocks,
-			    char *block_buffers);
 errcode_t ocfs2_write_inode(ocfs2_filesys *fs, uint64_t blkno,
 			    char *inode_buf);
 errcode_t ocfs2_check_directory(ocfs2_filesys *fs, uint64_t dir);

Modified: branches/endian-safe/libocfs2/inode.c
===================================================================
--- branches/endian-safe/libocfs2/inode.c	2005-08-10 17:12:19 UTC (rev 1034)
+++ branches/endian-safe/libocfs2/inode.c	2005-08-10 20:17:37 UTC (rev 1035)
@@ -245,33 +245,6 @@
 	return ret;
 }
 
-/* block_buffers must have been allocated with malloc_blocks so that its
- * aligned */
-errcode_t ocfs2_read_inodes(ocfs2_filesys *fs, uint64_t blkno, int num_blocks,
-			    char *block_buffers)
-{
-	ocfs2_dinode *di;
-	int i, ret;
-
-	ret = io_read_block(fs->fs_io, blkno, num_blocks, block_buffers);
-	if (ret)
-		goto out;
-
-	for (i = 0; i < num_blocks; i++) {
-		di = (ocfs2_dinode *)(block_buffers + (i * fs->fs_blocksize));
-
-		if (memcmp(di->i_signature, OCFS2_INODE_SIGNATURE,
-			   strlen(OCFS2_INODE_SIGNATURE))) {
-			ret = OCFS2_ET_BAD_INODE_MAGIC;
-			goto out;
-		}
-
-		ocfs2_swap_inode_to_cpu(di);
-	}
-out:
-	return ret;
-}
-
 errcode_t ocfs2_write_inode(ocfs2_filesys *fs, uint64_t blkno,
 			    char *inode_buf)
 {

Modified: branches/endian-safe/libocfs2/inode_scan.c
===================================================================
--- branches/endian-safe/libocfs2/inode_scan.c	2005-08-10 17:12:19 UTC (rev 1034)
+++ branches/endian-safe/libocfs2/inode_scan.c	2005-08-10 20:17:37 UTC (rev 1035)
@@ -175,8 +175,10 @@
 	if (num_blocks > scan->buffer_blocks)
 		num_blocks = scan->buffer_blocks;
 
-	ret = ocfs2_read_inodes(scan->fs, scan->cur_blkno, num_blocks,
-				scan->group_buffer);
+       ret = io_read_block(scan->fs->fs_io,
+			   scan->cur_blkno,
+			   num_blocks,
+			   scan->group_buffer);
 	if (ret)
 		return ret;
 
@@ -237,7 +239,7 @@
 			return ret;
 	}
 	
-	/* ocfs2_read_inodes() swapped these for us alread */
+	/* the caller swap after verifying the inode's signature */
 	memcpy(inode, scan->cur_block, scan->fs->fs_blocksize);
 
 	scan->cur_block += scan->fs->fs_blocksize;



More information about the Ocfs2-tools-commits mailing list