[Ocfs2-commits] mfasheh commits r893 - in trunk/src: . inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue May 4 21:50:53 CDT 2004


Author: mfasheh
Date: 2004-05-04 20:50:52 -0500 (Tue, 04 May 2004)
New Revision: 893

Modified:
   trunk/src/inc/ocfs.h
   trunk/src/inode.c
   trunk/src/super.c
Log:
* start using the new fe field for  voteoff on directories.
* use the new fe for the root directory. you will have to reformat using the latest mkfs sources for this.
* now that the root inode is just like others, initialize it as so and use ocfs_iget().



Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h	2004-05-05 00:33:28 UTC (rev 892)
+++ trunk/src/inc/ocfs.h	2004-05-05 01:50:52 UTC (rev 893)
@@ -501,6 +501,7 @@
 
 #define OCFS_MAGIC                 0xa156f7eb
 #define OCFS_ROOT_INODE_NUMBER     2
+#define OCFS_ROOT_INODE_FE_OFF      1536
 #define OCFS_LINUX_MAX_FILE_SIZE   9223372036854775807LL
 #define INITIAL_EXTENT_MAP_SIZE    10
 

Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c	2004-05-05 00:33:28 UTC (rev 892)
+++ trunk/src/inode.c	2004-05-05 01:50:52 UTC (rev 893)
@@ -157,16 +157,20 @@
 		LOG_TRACE_ARGS("Asked for root dirnode (%llu)\n",
 			       feoff);
 
-		inode = osb->sb->s_root->d_inode;
+		if (osb->root_inode) {
+			inode = osb->root_inode;
 
-		/* should we iget it or not? i suppose if you're in
-		 * here and you've asked for the root inode you don't
-		 * know what it is and will prolly iput it later... */
-		if (inode) {
-			if (ocfs_inc_icount(inode) < 0)
-				BUG();
+			/* should we iget it or not? i suppose if you're in
+			 * here and you've asked for the root inode you don't
+			 * know what it is and will prolly iput it later... */
+			if (inode) {
+				if (ocfs_inc_icount(inode) < 0)
+					BUG();
+			}
+			goto bail;
 		}
-		goto bail;
+		/* If we fall through here, then it's mount time! */
+		printk("ocfs_iget: gonna create the root inode\n");
 	}
 
 	/* This shouldn't happen anymore. */
@@ -378,7 +382,7 @@
 	sb = inode->i_sb;
 	osb = OCFS_GENERIC_SB_P(sb);
 	fe_off = fe->this_sector;
-	offset = S_ISDIR (mode) ? fe->extents[0].disk_off : fe->this_sector;
+	offset = S_ISDIR (mode) ? fe->child_dirnode : fe->this_sector;
 
 	if (!IS_VALID_FILE_ENTRY(fe)) {
 		printk("ocfs2: invalid file entry!\n");
@@ -600,15 +604,6 @@
 	}
 	sb = inode->i_sb;
 	osb = OCFS_GENERIC_SB_P(sb);
-	if (inode->i_ino == OCFS_ROOT_INODE_NUMBER) {
-		ocfs_read_inode_nofe(osb, inode, 
-				     osb->vol_layout.root_start_off);
-		/* should I set the sysfile flag or not? */
-		sysfile = true;
-		skip_bind = false;
-		voteoff = GET_INODE_VOTEOFF(inode);
-		goto skip_fe;
-	}
 
 	if (!args) {
 		LOG_ERROR_STR("bad inode args");
@@ -671,7 +666,8 @@
 	}
 	ocfs_populate_inode (inode, fe, mode, false);
 
-	voteoff = S_ISDIR (mode) ? fe->extents[0].disk_off : fe->this_sector;
+	/* eventually this case has to GO! */
+	voteoff = S_ISDIR (mode) ? fe->child_dirnode : fe->this_sector;
 
 	if (voteoff != args->voteoff)
 		BUG();
@@ -717,15 +713,14 @@
 
 	LOG_ENTRY_ARGS ("(0x%08x, %u, 0x%08x)\n", inode, inode->i_ino, opaque);
 
-	/* Special Case: opaque == NULL, means we're looking for
-	   the root inode. We only get called like this from
-	   ocfs_fill_super, and therefore that inode should not exist
-	   yet. */
-	if (opaque == NULL)
-		goto bail;
 	if (inode == NULL)
 		goto bail;
+
 	args = (ocfs_find_inode_args *) opaque;
+	if (args.ino == OCFS_ROOT_INODE_NUMBER) {
+		printk("find_actor: asked about root inode\n");
+		goto bail;
+	}
 
 	if ((GET_INODE_FEOFF(inode) != args->feoff) 
 	    || (GET_INODE_VOTEOFF(inode) != args->voteoff)) {
@@ -750,21 +745,12 @@
 int ocfs_init_locked_inode(struct inode * inode, void * opaque) 
 {
 	ocfs_find_inode_args *args = (ocfs_find_inode_args *) opaque;
-	int ret = 1;
 	LOG_ENTRY_ARGS("inode = %p, opaque = %p\n", inode, opaque);
 
-	/* We might be called from ocfs_fill_super in which case, opaque
-	 * will be null (but we'll be looking for the root inode
-	 * anyway... */
-	if (args == NULL) {
-		inode->i_ino = OCFS_ROOT_INODE_NUMBER;
-	} else {
-		inode->i_ino = args->ino;
-	}
-	ret = 0;
-//bail:
-	LOG_EXIT_STATUS(ret);
-	return(ret);
+	inode->i_ino = args->ino;
+
+	LOG_EXIT_STATUS(0);
+	return(0);
 }
 
 #endif /* 2.6 kernel stuff */

Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c	2004-05-05 00:33:28 UTC (rev 892)
+++ trunk/src/super.c	2004-05-05 01:50:52 UTC (rev 893)
@@ -993,35 +993,14 @@
 	osb->vol_state = VOLUME_ENABLED;
 	up (&(osb->osb_res));
 
-	/* Initialize the root inode. */
-	/* We need a better way of getting our root inode during startup. */
-	ocfs_inode_hash_insert(osb, osb->vol_layout.root_start_off, 0ULL);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)	
-	inode = iget5_locked(sb, OCFS_ROOT_INODE_NUMBER, 
-			     ocfs_find_actor, ocfs_init_locked_inode, NULL);
-#else
-	inode = iget4(sb, OCFS_ROOT_INODE_NUMBER, 0, NULL);
-#endif
+	inode = ocfs_iget(osb, osb->vol_layout.root_start_off, 
+			  OCFS_ROOT_INODE_FE_OFF, NULL);
 	if (!inode) {
 		status = -EIO;
 		LOG_ERROR_STATUS (status);
 		goto leave;
 	}
-	if  (is_bad_inode(inode)) {
-		status = -EIO;
-		LOG_ERROR_STATUS (status);
-		iput(inode);
-		inode = NULL;
-		goto leave;
-	}
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-	if (inode->i_state & I_NEW) {
-		ocfs_read_locked_inode(inode, NULL);
-		unlock_new_inode(inode);
-	}
-#endif
-
 	osb->root_inode = inode;
 
 	/* Read the publish sector for this node and cleanup dirent being */



More information about the Ocfs2-commits mailing list