[Ocfs2-commits] zab commits r1654 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Nov 19 16:58:40 CST 2004


Author: zab
Date: 2004-11-19 16:58:39 -0600 (Fri, 19 Nov 2004)
New Revision: 1654

Modified:
   trunk/src/alloc.c
   trunk/src/inode.c
   trunk/src/namei.c
   trunk/src/ocfs.h
   trunk/src/ocfs2_fs.h
   trunk/src/suballoc.c
   trunk/src/super.c
Log:
o add stable generation numbers to various structs so that fsck can easily
  identify stale data from previous file systems.


Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c	2004-11-16 21:25:05 UTC (rev 1653)
+++ trunk/src/alloc.c	2004-11-19 22:58:39 UTC (rev 1654)
@@ -204,6 +204,7 @@
 			/* Ok, setup the minimal stuff here. */
 			strcpy(eb->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE);
 			eb->h_blkno = first_blkno;
+			eb->h_fs_generation = osb->fs_generation;
 
 #ifndef OCFS_USE_ALL_METADATA_SUBALLOCATORS
 			/* we always use node zeros suballocator */

Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c	2004-11-16 21:25:05 UTC (rev 1653)
+++ trunk/src/inode.c	2004-11-19 22:58:39 UTC (rev 1654)
@@ -357,6 +357,15 @@
 		goto bail;
 	}
 
+	if (le32_to_cpu(fe->i_fs_generation) != osb->fs_generation) {
+		LOG_ERROR_ARGS("file entry generation does not match "
+			       "superblock! osb->fs_generation=%x, "
+			       "fe->i_fs_generation=%x\n",
+			       osb->fs_generation,
+			       le32_to_cpu(fe->i_fs_generation));
+		goto bail;
+	}
+
 	if (!inode->u.generic_ip && ocfs_inode_init_private(inode)) {
 		/* How can we recover gracefully? */
 		LOG_ERROR_STR("unable to allocate private data for "

Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c	2004-11-16 21:25:05 UTC (rev 1653)
+++ trunk/src/namei.c	2004-11-19 22:58:39 UTC (rev 1654)
@@ -527,6 +527,7 @@
 	inode->i_generation = osb->s_next_generation++;
 	spin_unlock(&osb->s_next_gen_lock);
 	fe->i_generation = cpu_to_le32(inode->i_generation);
+	fe->i_fs_generation = cpu_to_le32(osb->fs_generation);
 	fe->i_blkno = fe_blkno;
 	fe->i_suballoc_bit = suballoc_bit;
 	fe->i_suballoc_node = osb->node_num;

Modified: trunk/src/ocfs.h
===================================================================
--- trunk/src/ocfs.h	2004-11-16 21:25:05 UTC (rev 1653)
+++ trunk/src/ocfs.h	2004-11-19 22:58:39 UTC (rev 1654)
@@ -514,6 +514,7 @@
 	u8 *uuid;
 	u8 *vol_label;
 	u64 first_cluster_group_blkno;
+	u32 fs_generation;
 
 	u32 s_feature_compat;
 	u32 s_feature_incompat;

Modified: trunk/src/ocfs2_fs.h
===================================================================
--- trunk/src/ocfs2_fs.h	2004-11-16 21:25:05 UTC (rev 1653)
+++ trunk/src/ocfs2_fs.h	2004-11-19 22:58:39 UTC (rev 1654)
@@ -269,7 +269,7 @@
 					   extent_header belongs to */
 	__u16 h_suballoc_bit;		/* Bit offset in suballocater
 					   block group */
-	__u32 h_reserved2;
+	__u32 h_fs_generation;		/* Must match super block */
 	__u64 h_blkno;			/* Offset on disk, in blocks */
 /*20*/	__u64 h_reserved3;
 	__u64 h_next_leaf_blk;		/* Offset on disk, in blocks,
@@ -364,7 +364,9 @@
 /*50*/	__u64 i_blkno;			/* Offset on disk, in blocks */
 	__u64 i_last_eb_blk;		/* Pointer to last extent
 					   block */
-/*60*/	__u64 i_reserved1[11];
+/*60*/	__u32 i_fs_generation;		/* Generation per fs-instance */
+	__u32 i_reserved0;		/* Generation per fs-instance */
+/*68*/	__u64 i_reserved1[10];
 /*B8*/	union {
 		__u64 i_pad1;		/* Generic way to refer to this
 					   64bit union */

Modified: trunk/src/suballoc.c
===================================================================
--- trunk/src/suballoc.c	2004-11-16 21:25:05 UTC (rev 1653)
+++ trunk/src/suballoc.c	2004-11-19 22:58:39 UTC (rev 1654)
@@ -167,7 +167,7 @@
 
 	memset(bg, 0, sb->s_blocksize);
 	strcpy (bg->bg_signature, OCFS2_GROUP_DESC_SIGNATURE);
-	bg->bg_generation = cpu_to_le32(alloc_inode->i_generation);
+	bg->bg_generation = cpu_to_le32(OCFS2_SB(sb)->fs_generation);
 	bg->bg_size = ocfs2_group_bitmap_size(sb);
 	bg->bg_bits = (u32) cl->cl_cpg * (u32) cl->cl_bpc;
 	bg->bg_chain = my_chain;

Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c	2004-11-16 21:25:05 UTC (rev 1653)
+++ trunk/src/super.c	2004-11-19 22:58:39 UTC (rev 1654)
@@ -1503,6 +1503,7 @@
 	osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno);
 	osb->system_dir_blkno = le64_to_cpu(di->id2.i_super.s_system_dir_blkno);
 	osb->first_cluster_group_blkno = le64_to_cpu(di->id2.i_super.s_first_cluster_group);
+	osb->fs_generation = le32_to_cpu(di->i_fs_generation);
 	printk("vol_label: %s\n", osb->vol_label);
 	{
 		int ttt;



More information about the Ocfs2-commits mailing list