[Ocfs2-commits] khackel commits r1079 - branches/format-changes/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Sun Jun 13 18:48:15 CDT 2004


Author: khackel
Date: 2004-06-13 17:48:13 -0500 (Sun, 13 Jun 2004)
New Revision: 1079

Modified:
   branches/format-changes/src/alloc.c
   branches/format-changes/src/extmap.c
   branches/format-changes/src/hash.c
   branches/format-changes/src/inode.c
   branches/format-changes/src/lockres.c
   branches/format-changes/src/ocfs.h
   branches/format-changes/src/ocfs2_fs.h
   branches/format-changes/src/super.c
   branches/format-changes/src/sysfile.c
   branches/format-changes/src/volcfg.c
   branches/format-changes/src/vote.c
Log:
got the new format stuff to get as far as mounting... meaning that all the system file offsets are hopefully getting loaded ok

Modified: branches/format-changes/src/alloc.c
===================================================================
--- branches/format-changes/src/alloc.c	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/alloc.c	2004-06-13 22:48:13 UTC (rev 1079)
@@ -2740,8 +2740,10 @@
 	if (ocfs_lookup_extent_map_entry (osb, &(OCFS_I(inode)->map), Vbo, Lbo, &cnt, &NumIndex) &&
 	    cnt >= sectors) {
 		status = 0;
-	} else
+	} else {
 		status = -EFAIL;
+		printk("failed to lookup extmap... vbo=%llu mapcount=%d\n", Vbo, OCFS_I(inode)->map.count);
+	}
 
 	/* want to return cnt only if asked for it */
 	if (sector_count)

Modified: branches/format-changes/src/extmap.c
===================================================================
--- branches/format-changes/src/extmap.c	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/extmap.c	2004-06-13 22:48:13 UTC (rev 1079)
@@ -712,6 +712,8 @@
 	Vbo >>= osb->sb->s_blocksize_bits;
 	Lbo >>= osb->sb->s_blocksize_bits;
 
+	printk("addextent: map=%p vbo=%llu lbo=%llu bytes=%llu\n",
+	       Map, Vbo, Lbo, ByteCount);
 	ret = ocfs_extent_map_add (Map, ((__s64) Vbo), ((__s64) Lbo), ((__s64) ByteCount));
 	if (!ret)
 		LOG_ERROR_ARGS ("fileoff=%llu, diskoff=%llu, len=%llu",

Modified: branches/format-changes/src/hash.c
===================================================================
--- branches/format-changes/src/hash.c	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/hash.c	2004-06-13 22:48:13 UTC (rev 1079)
@@ -587,7 +587,8 @@
 #endif
 		if (!do_timeout) {
 			set_task_state(tsk, TASK_UNINTERRUPTIBLE);
-			io_schedule();
+			//io_schedule();
+			schedule();
 		} else {
 			do_timeout = 0;
 			set_task_state(tsk, TASK_INTERRUPTIBLE);

Modified: branches/format-changes/src/inode.c
===================================================================
--- branches/format-changes/src/inode.c	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/inode.c	2004-06-13 22:48:13 UTC (rev 1079)
@@ -205,27 +205,6 @@
 
 	LOG_ENTRY_ARGS("(feoff = %llu)\n", feoff);
 
-	/* Shortcut: if they ask for the root dirnode, just return
-	 * it. */
-	if (feoff == OCFS_ROOT_INODE_FE_OFF(osb)) {
-		LOG_TRACE_ARGS("Asked for root dirnode (%llu)\n",
-			       feoff);
-
-		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();
-			}
-			goto bail;
-		}
-		/* If we fall through here, then it's mount time! */
-	}
-
 	/* Ok. By now we've either got the offsets passed to us by the
 	 * caller, or we just pulled them off the bh. Lets do some
 	 * sanity checks to make sure they're OK. */
@@ -408,6 +387,8 @@
 
 	OCFS_I(inode)->alloc_size =
 		(u64)fe->i_clusters << osb->s_clustersize_bits;
+	printk("oin alloc_size=%llu, fe->i_clusters=%lu\n",
+	       OCFS_I(inode)->alloc_size, fe->i_clusters);
 	OCFS_I(inode)->inode = inode;
 	OCFS_I(inode)->chng_seq_num = DISK_LOCK(fe)->dl_seq_num;
 	OCFS_I(inode)->u.fe_private = fe->id1.i_pad1;
@@ -425,6 +406,21 @@
 		       create_ino ? "true" : "false");
 
 	inode->i_nlink = fe->i_links_count;
+
+	if (le32_to_cpu(fe->i_flags) & OCFS2_LOCAL_ALLOC_FL) {
+		LOG_TRACE_ARGS("local alloc inode: i_ino=%lu\n", inode->i_ino);
+	} else if (le32_to_cpu(fe->i_flags) & OCFS2_BITMAP_FL) {
+		OCFS_I(inode)->u.ip_bitinfo.used_bits = 
+			le32_to_cpu(fe->id1.bitmap1.i_used);
+		OCFS_I(inode)->u.ip_bitinfo.total_bits = 
+			le32_to_cpu(fe->id1.bitmap1.i_total);
+		LOG_TRACE_ARGS("bitmap inode: i_ino=%lu, used=%lu, total=%lu\n",
+			       inode->i_ino, OCFS_I(inode)->u.ip_bitinfo.used_bits,
+			       OCFS_I(inode)->u.ip_bitinfo.total_bits);
+	} else if (le32_to_cpu(fe->i_flags) & OCFS2_SUPER_BLOCK_FL) {
+		LOG_TRACE_ARGS("superblock inode: i_ino=%lu\n", inode->i_ino);
+	}
+	
 	switch (inode->i_mode & S_IFMT) {
 	    case S_IFREG:
 		    atomic_set(GET_INODE_CLEAN_SEQ(inode), atomic_read(&osb->clean_buffer_seq));
@@ -585,10 +581,6 @@
 		goto bail;
 
 	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) {
 		LOG_ERROR_STATUS(-EINVAL);
@@ -669,7 +661,7 @@
 		goto clear_inode;
 	}
 
-	if (inode->i_ino == OCFS_ROOT_INODE_NUMBER) {
+	if (inode == osb->root_inode) {
 		LOG_TRACE_STR("Skipping root inode delete.");
 		goto clear_inode;
 	}
@@ -2007,6 +1999,16 @@
 			ocfs_extent_map_init (&OCFS_I(inode)->map);
 		}
 
+		if (le32_to_cpu(fe->i_flags) & OCFS2_BITMAP_FL) {
+			OCFS_I(inode)->u.ip_bitinfo.used_bits = 
+				le32_to_cpu(fe->id1.bitmap1.i_used);
+			OCFS_I(inode)->u.ip_bitinfo.total_bits = 
+				le32_to_cpu(fe->id1.bitmap1.i_total);
+			LOG_TRACE_ARGS("updated bitmap inode: i_ino=%lu, used=%lu, total=%lu\n",
+			       inode->i_ino, OCFS_I(inode)->u.ip_bitinfo.used_bits,
+			       OCFS_I(inode)->u.ip_bitinfo.total_bits);
+		}
+
 		LOG_TRACE_STR("Allocsize, filesize or seq no did not match");
 		OCFS_I(inode)->alloc_size = 
 			(u64)fe->i_clusters << osb->s_clustersize_bits;

Modified: branches/format-changes/src/lockres.c
===================================================================
--- branches/format-changes/src/lockres.c	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/lockres.c	2004-06-13 22:48:13 UTC (rev 1079)
@@ -204,7 +204,7 @@
 			if (down_trylock(&OCFS_I(inode)->ip_io_sem) == 0) {
 				LOG_ERROR_ARGS("locking lockres without io_sem! ino = %lu, offset = %llu\n", inode->i_ino, OCFS_I(inode)->feoff);
 
-				BUG();
+				//BUG();
 			}
 			break;
 		}

Modified: branches/format-changes/src/ocfs.h
===================================================================
--- branches/format-changes/src/ocfs.h	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/ocfs.h	2004-06-13 22:48:13 UTC (rev 1079)
@@ -188,39 +188,8 @@
 #define  FLAG_ACQUIRE_LOCK        0x40000000 
 #define  FLAG_RELEASE_LOCK        0x80000000 
 									    
-enum {
-    OCFS_INVALID_SYSFILE = -1,
-    OCFS_VOL_MD_SYSFILE = 0,		// unused in version 2
-    OCFS_VOL_MD_LOG_SYSFILE,		// unused in version 2
-    OCFS_DIR_SYSFILE,			// unused in version 2
-    OCFS_DIR_BM_SYSFILE,		// unused in version 2
-    OCFS_FILE_EXTENT_SYSFILE,
-    OCFS_FILE_EXTENT_BM_SYSFILE,
-    OCFS_RECOVER_LOG_SYSFILE,		// unused in version 2
-    OCFS_CLEANUP_LOG_SYSFILE,		// unused in version 2
-    OCFS_VOL_BM_SYSFILE,		// this is the local alloc file
-    OCFS_ORPHAN_DIR_SYSFILE,
-    OCFS_JOURNAL_SYSFILE,
-    OCFS_INODE_SYSFILE,
-    OCFS_INODE_BM_SYSFILE,
-    OCFS_NUM_SYSFILES
-};
 
-#define OCFS_FILE_VOL_META_DATA      (OCFS_VOL_MD_SYSFILE         * OCFS_MAXIMUM_NODES)		// unused in version 2
-#define OCFS_FILE_VOL_LOG_FILE       (OCFS_VOL_MD_LOG_SYSFILE     * OCFS_MAXIMUM_NODES)		// unused in version 2
-#define OCFS_FILE_DIR_ALLOC          (OCFS_DIR_SYSFILE            * OCFS_MAXIMUM_NODES)		// unused in version 2
-#define OCFS_FILE_DIR_ALLOC_BITMAP   (OCFS_DIR_BM_SYSFILE         * OCFS_MAXIMUM_NODES)		// unused in version 2
-#define OCFS_FILE_FILE_ALLOC         (OCFS_FILE_EXTENT_SYSFILE    * OCFS_MAXIMUM_NODES)
-#define OCFS_FILE_FILE_ALLOC_BITMAP  (OCFS_FILE_EXTENT_BM_SYSFILE * OCFS_MAXIMUM_NODES)
-#define LOG_FILE_BASE_ID             (OCFS_RECOVER_LOG_SYSFILE    * OCFS_MAXIMUM_NODES)		// unused in version 2
-#define CLEANUP_FILE_BASE_ID         (OCFS_CLEANUP_LOG_SYSFILE    * OCFS_MAXIMUM_NODES)		// unused in version 2
-#define OCFS_LOCAL_ALLOC_FILE        (OCFS_VOL_BM_SYSFILE         * OCFS_MAXIMUM_NODES)		// was OCFS_VOL_BITMAP_FILE
-#define OCFS_ORPHAN_DIR              (OCFS_ORPHAN_DIR_SYSFILE     * OCFS_MAXIMUM_NODES)
-#define OCFS_JOURNAL_FILE            (OCFS_JOURNAL_SYSFILE        * OCFS_MAXIMUM_NODES)
-#define OCFS_INODE_FILE              (OCFS_INODE_SYSFILE          * OCFS_MAXIMUM_NODES)
-#define OCFS_INODE_BITMAP            (OCFS_INODE_BM_SYSFILE       * OCFS_MAXIMUM_NODES)
 
-
 /* FIXME: Left about for now */
 #define  OCFS_SECTOR_SIZE            512
 
@@ -320,17 +289,6 @@
 
 #define OCFS_MAGIC                 0xa156f7eb
 
-/* TODO: no hardcoding of this stuff!!! */
-/* TODO: these should be stored in the on-disk superblock */
-#define OCFS_VOLUME_LOCK_INODE_NUMBER	1   // unused !!!
-#define OCFS_BITMAP_LOCK_INODE_NUMBER	2
-#define OCFS_ROOT_INODE_NUMBER		3
-#define OCFS_SYS_ROOT_INODE_NUMBER	4
-#define OCFS_VOLUME_LOCK_OFFSET(osb)	(OCFS_VOLUME_LOCK_INODE_NUMBER << osb->sb->s_blocksize_bits) // unused !!!
-#define OCFS_BITMAP_LOCK_OFFSET(osb)	(OCFS_BITMAP_LOCK_INODE_NUMBER << osb->sb->s_blocksize_bits)
-#define OCFS_ROOT_INODE_FE_OFF(osb)	(OCFS_ROOT_INODE_NUMBER << osb->sb->s_blocksize_bits)
-#define OCFS_SYS_ROOT_INODE_OFF(osb)	(OCFS_SYS_ROOT_INODE_NUMBER << osb->sb->s_blocksize_bits)
-	
 #define OCFS_LINUX_MAX_FILE_SIZE   9223372036854775807LL
 #define INITIAL_EXTENT_MAP_SIZE    10
 
@@ -494,19 +452,7 @@
 		
 #define OCFS_IPC_DLM_VERSION    0x0201
 
-#define GUID_LEN		32
-#define HOSTID_LEN		20
-#define MACID_LEN		12
 
-#define MAX_NODE_NAME_LENGTH    32
-
-
-#define NODE_CONFIG_HDR_SIGN        "NODECFG"
-#define NODE_CONFIG_SIGN_LEN        8
-#define NODE_CONFIG_VER             2
-#define NODE_MIN_SUPPORTED_VER      2
-
-
 /* =========================================================== */
 
 enum {
@@ -589,47 +535,6 @@
 }
 ocfs_vol_label;					  // END CLASS
 
-typedef struct _ocfs_ipc_config_info			// CLASS
-{
-	__u8 type;					// NUMBER RANGE(0, 255)
-	__u8 ip_addr[MAX_IP_ADDR_LEN+1];		// CHAR[MAX_IP_ADDR_LEN+1]
-	__u32 ip_port;					// NUMBER RANGE(0,ULONG_MAX)
-	__u8 ip_mask[MAX_IP_ADDR_LEN+1];		// CHAR[MAX_IP_ADDR_LEN+1]
-}
-ocfs_ipc_config_info;	// END CLASS
-/* TODO this structure will break in 64-bit.... need to pack */
-typedef union _ocfs_guid				// CLASS
-{
-	struct
-	{
-		char host_id[HOSTID_LEN];
-		char mac_id[MACID_LEN];
-	} id;
-	__u8 guid[GUID_LEN];				// CHAR[GUID_LEN]
-}
-ocfs_guid;						// END CLASS
-
-typedef struct _ocfs_node_config_info			// CLASS
-{
-	ocfs2_disk_lock disk_lock;			// DISKLOCK
-	__u8 node_name[MAX_NODE_NAME_LENGTH+1];		// CHAR[MAX_NODE_NAME_LENGTH+1]
-	ocfs_guid guid;					// GUID
-	ocfs_ipc_config_info ipc_config;		// IPCONFIG
-}
-ocfs_node_config_info;					// END CLASS
-
-typedef struct _ocfs_node_config_hdr			// CLASS
-{
-	ocfs2_disk_lock disk_lock;			// DISKLOCK
-	__u8 signature[NODE_CONFIG_SIGN_LEN];		// CHAR[NODE_CONFIG_SIGN_LEN]
-	__u32 version;					// NUMBER RANGE(0,ULONG_MAX)
-	__u32 num_nodes;				// NUMBER RANGE(0,32)
-	__u32 last_node;				// NUMBER RANGE(0,32)
-	__u32 onch_pad;                                 // UNUSED
-	__u64 cfg_seq_num;				// NUMBER RANGE(0,ULONG_LONG_MAX)
-}
-ocfs_node_config_hdr;					// END CLASS
-
 typedef struct _BARF_BARF_BARF
 {
 	char node_name[MAX_NODE_NAME_LENGTH];
@@ -1508,14 +1413,11 @@
 	struct list_head *iter;
 	int max_cnt = 1; /* one for the inode hash */
 	ocfs_super *osb = NULL;
-	int is_root = 0;
 
 	if (!inode)
 		return;
 
 	osb = OCFS_SB(inode->i_sb);
-	if (inode->i_ino == OCFS_ROOT_INODE_NUMBER)
-		is_root = 1;
 
 	if (INODE_DELETED(inode))
 		max_cnt--;
@@ -1535,8 +1437,7 @@
 		return;
 
 
-	LOG_ERROR_ARGS("max_cnt = %d, line = %u, root=%u\n", max_cnt, line, 
-		       is_root);
+	LOG_ERROR_ARGS("max_cnt = %d, line = %u\n", max_cnt, line);
 	if (dentry)
 		LOG_ERROR_ARGS("eek! i_count=%d, i_state=%lu, i_ino=%lu, name='%*s'\n",
 			       atomic_read(&inode->i_count), inode->i_state, inode->i_ino,

Modified: branches/format-changes/src/ocfs2_fs.h
===================================================================
--- branches/format-changes/src/ocfs2_fs.h	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/ocfs2_fs.h	2004-06-13 22:48:13 UTC (rev 1079)
@@ -152,7 +152,21 @@
 #define DISK_LOCK(dinode)	(&((dinode)->i_disk_lock))
 #define LOCAL_ALLOC(dinode)	(&((dinode)->id2.i_lab))
 
+/* TODO: change these?  */
+#define OCFS2_NODE_CONFIG_HDR_SIGN	"NODECFG"
+#define OCFS2_NODE_CONFIG_SIGN_LEN	8
+#define OCFS2_NODE_CONFIG_VER		2
+#define OCFS2_NODE_MIN_SUPPORTED_VER	2
 
+#define MAX_IP_ADDR_LEN		32
+#define HOSTID_LEN              20
+#define MACID_LEN		12
+#define GUID_LEN		(HOSTID_LEN+MACID_LEN)
+#define MAX_NODE_NAME_LENGTH	32
+
+
+
+
 /*
  * On disk extent record for OCFS2
  * It describes a range of clusters on disk.
@@ -332,7 +346,48 @@
 /* Actual on-disk length specified by rec_len */
 };
 
+typedef struct _ocfs_ipc_config_info			// CLASS
+{
+	__u8 type;					// NUMBER RANGE(0, 255)
+	__u8 ip_addr[MAX_IP_ADDR_LEN+1];		// CHAR[MAX_IP_ADDR_LEN+1]
+	__u32 ip_port;					// NUMBER RANGE(0,ULONG_MAX)
+	__u8 ip_mask[MAX_IP_ADDR_LEN+1];		// CHAR[MAX_IP_ADDR_LEN+1]
+}
+ocfs_ipc_config_info;	// END CLASS
+/* TODO this structure will break in 64-bit.... need to pack */
+typedef union _ocfs_guid				// CLASS
+{
+	struct
+	{
+		char host_id[HOSTID_LEN];
+		char mac_id[MACID_LEN];
+	} id;
+	__u8 guid[GUID_LEN];				// CHAR[GUID_LEN]
+}
+ocfs_guid;						// END CLASS
 
+typedef struct _ocfs_node_config_info			// CLASS
+{
+	ocfs2_disk_lock disk_lock;			// DISKLOCK
+	__u8 node_name[MAX_NODE_NAME_LENGTH+1];		// CHAR[MAX_NODE_NAME_LENGTH+1]
+	ocfs_guid guid;					// GUID
+	ocfs_ipc_config_info ipc_config;		// IPCONFIG
+}
+ocfs_node_config_info;					// END CLASS
+
+typedef struct _ocfs_node_config_hdr			// CLASS
+{
+	ocfs2_disk_lock disk_lock;			// DISKLOCK
+	__u8 signature[OCFS2_NODE_CONFIG_SIGN_LEN];	// CHAR[NODE_CONFIG_SIGN_LEN]
+	__u32 version;					// NUMBER RANGE(0,ULONG_MAX)
+	__u32 num_nodes;				// NUMBER RANGE(0,32)
+	__u32 last_node;				// NUMBER RANGE(0,32)
+	__u32 onch_pad;                                 // UNUSED
+	__u64 cfg_seq_num;				// NUMBER RANGE(0,ULONG_LONG_MAX)
+}
+ocfs_node_config_hdr;					// END CLASS
+
+
 #ifdef __KERNEL__
 static inline int ocfs2_extent_recs_per_inode(struct super_block *sb)
 {

Modified: branches/format-changes/src/super.c
===================================================================
--- branches/format-changes/src/super.c	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/super.c	2004-06-13 22:48:13 UTC (rev 1079)
@@ -180,7 +180,8 @@
 static int ocfs_statfs (struct super_block *sb, struct statfs *buf);
 #endif
 
-static int ocfs_init_system_inodes(ocfs_super *osb);
+static int ocfs_init_global_system_inodes(ocfs_super *osb);
+static int ocfs_init_local_system_inodes(ocfs_super *osb);
 static int ocfs_release_system_inodes(ocfs_super *osb);
 static int ocfs_publish_set_unmounted(ocfs_super *osb, int node_num);
 static int ocfs_publish_set_mounted(ocfs_super *osb, int node_num);
@@ -229,9 +230,9 @@
 }
 
 /*
- * ocfs_init_system_inodes()
+ * ocfs_init_global_system_inodes()
  */
-static int ocfs_init_system_inodes(ocfs_super *osb)
+static int ocfs_init_global_system_inodes(ocfs_super *osb)
 {
 	struct inode *new = NULL;
 	int status = 0;
@@ -253,7 +254,7 @@
 	}
 	osb->sys_root_inode = new;
 
-	for (i = 0; i < NUM_SYSTEM_INODES; i++) {
+	for (i = 0; i <= OCFS_LAST_GLOBAL_SYSTEM_INODE; i++) {
 		new = ocfs_get_system_file_inode(osb, i, osb->node_num);
 		if (!new) {
 			ocfs_release_system_inodes(osb);
@@ -266,9 +267,34 @@
 bail:
 	LOG_EXIT_STATUS(status);
 	return(status);
-} /* ocfs_init_system_inodes */
+} /* ocfs_init_global_system_inodes */
 
+/*
+ * ocfs_init_local_system_inodes()
+ */
+static int ocfs_init_local_system_inodes(ocfs_super *osb)
+{
+	struct inode *new = NULL;
+	int status = 0;
+	int i;
 
+	LOG_ENTRY();
+
+	for (i = OCFS_LAST_GLOBAL_SYSTEM_INODE + 1; i < NUM_SYSTEM_INODES ; i++) {
+		new = ocfs_get_system_file_inode(osb, i, osb->node_num);
+		if (!new) {
+			ocfs_release_system_inodes(osb);
+			LOG_ERROR_STATUS(status = -EINVAL);
+			goto bail;
+		}
+		osb->system_inodes[i] = new;
+	}
+
+bail:
+	LOG_EXIT_STATUS(status);
+	return(status);
+} /* ocfs_init_local_system_inodes */
+
 /*
  * ocfs_release_system_inodes()
  */
@@ -722,15 +748,14 @@
 
 	osb = OCFS_SB(sb);
 
-#warning WRONG WRONG WRONG	
-
 	inode = ocfs_get_system_file_inode(osb, GLOBAL_BITMAP_SYSTEM_INODE, -1);
 	if (!inode) {
 		LOG_ERROR_STR("failed to get bitmap inode");
 		return -EIO;
 	}
 
-	status = ocfs_read_bh (osb, OCFS_BITMAP_LOCK_OFFSET(osb), &bh, 0, NULL);
+	/* must this be a non cached read? */
+	status = ocfs_read_bh (osb, GET_INODE_FEOFF(inode), &bh, 0, inode);
 	if (status < 0) {
 		LOG_ERROR_STR("failed to read bitmap data");
 		return -EIO;
@@ -875,7 +900,6 @@
 	/* now check at magic offset for 512, 1024, 2048, 4096 blocksizes */
 	status = -EINVAL;
 	for (sectsize=hardsect; sectsize<=4096; sectsize<<=1) {
-		int done = 0;
 		tmpstat = ocfs2_get_sector(sb, bh, 
 					   OCFS2_SUPER_BLOCK_BLKNO, 
 					   sectsize);
@@ -886,9 +910,11 @@
 		di = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(*bh);
 		status = ocfs_verify_volume(di, *bh, sectsize);
 		OCFS_BH_PUT_DATA(*bh);
+		if (status >= 0)
+			goto bail;
 		brelse(*bh);
 		*bh = NULL;
-		if (done)
+		if (status != -EAGAIN)
 			break;
 	}
 
@@ -1379,6 +1405,7 @@
 	/* this needs to be done before most other initializations */
 	di = OCFS_BH_GET_DATA_READ(bh);
 	osb->max_nodes = le32_to_cpu(di->id2.i_super.s_max_nodes);
+	printk("max_nodes for this device: %u\n", osb->max_nodes);
 	OCFS_BH_PUT_DATA(bh);
 
 	/* FIXME
@@ -1497,15 +1524,32 @@
 #endif	
 
 	di = OCFS_BH_GET_DATA_READ(bh);
+
+	/* get some pseudo constants for clustersize bits */
+	osb->s_clustersize_bits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
+	osb->s_clustersize = 1 << osb->s_clustersize_bits;
+	printk("clusterbits=%d\n", osb->s_clustersize_bits);
+	OCFS_ASSERT(osb->s_clustersize_bits);
+
 	strncpy(osb->vol_label, di->id2.i_super.s_label, 63);
 	osb->vol_label[63] = '\0';
 	memcpy(osb->uuid, di->id2.i_super.s_uuid, MAX_VOL_ID_LENGTH);
 	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);
+	printk("vol_label: %s\n", osb->vol_label);
+	{
+		int ttt;
+		printk("uuid: ");
+		for (ttt=0; ttt<16; ttt++)
+		printk("%02x ", di->id2.i_super.s_uuid[ttt]);
+		printk("\n");
+	}
+	printk("root_blkno=%llu, system_dir_blkno=%llu\n", osb->root_blkno, osb->system_dir_blkno);
+
 	OCFS_BH_PUT_DATA(bh);
 
-	/* load root, system_dir, and all global and node-local system inodes */
-	status = ocfs_init_system_inodes(osb);
+	/* load root, system_dir, and all global system inodes */
+	status = ocfs_init_global_system_inodes(osb);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
 		goto bail;
@@ -1526,7 +1570,6 @@
 	}
 	osb->autoconfig_blkno = ret >> osb->sb->s_blocksize_bits;
 	osb->autoconfig_blocks = inode->i_size >> osb->sb->s_blocksize_bits;
-	printk("autoconfig: blkno=%llu, blocks=%llu\n", osb->autoconfig_blkno, osb->autoconfig_blocks);
 	if (osb->autoconfig_blocks != 2+osb->max_nodes+4) {
 		LOG_ERROR_ARGS("autoconfig size incorrect: "
 			       "found=%llu, expected=%u\n",
@@ -1541,6 +1584,7 @@
 	osb->new_autoconfig_blocks = OCFS_VOLCFG_NEWCFG_SECTORS;
 	osb->new_autoconfig_blkno = osb->autoconfig_blkno + osb->autoconfig_blocks;
 	osb->total_autoconfig_blocks = OCFS_VOLCFG_NEWCFG_SECTORS + osb->max_nodes;
+	printk("autoconfig: blkno=%llu, blocks=%llu newblkno=%llu newblocks=%llu\n", osb->autoconfig_blkno, osb->autoconfig_blocks, osb->new_autoconfig_blkno, osb->new_autoconfig_blocks);
 	osb->autoconfig_bhs = ocfs_malloc (osb->total_autoconfig_blocks
 				    * sizeof(struct buffer_head *));
 	if (!osb->autoconfig_bhs) {
@@ -1569,11 +1613,14 @@
 	printk("publish: blkno=%llu, blocks=%llu\n", osb->publish_blkno, osb->publish_blocks);
 
 	/* we still require our autoconfig and publish to be contiguous */
-	if (osb->publish_blkno != osb->autoconfig_blkno + osb->autoconfig_blocks) {
+	if (osb->publish_blkno != (osb->autoconfig_blkno + 
+	      osb->autoconfig_blocks + osb->new_autoconfig_blocks)) {
 		LOG_ERROR_ARGS("autoconfig is NOT contiguous with publish! "
 			       "autoconfig: blkno=%llu, blocks=%llu, "
+			       "newautoconfig: blkno=%llu, blocks=%llu, "
 			       "publish: blkno=%llu, blocks=%llu\n", 
 			       osb->autoconfig_blkno, osb->autoconfig_blocks,
+			       osb->new_autoconfig_blkno, osb->new_autoconfig_blocks,
 			       osb->publish_blkno, osb->publish_blocks);
 		status = -EINVAL;
 		goto bail;
@@ -1616,6 +1663,8 @@
 	osb->bitmap_blkno = ret >> osb->sb->s_blocksize_bits;
 	osb->bitmap_blocks = OCFS_I(inode)->alloc_size >> osb->sb->s_blocksize_bits;
 	osb->num_clusters = OCFS_I(inode)->u.ip_bitinfo.total_bits;
+	printk("bitmap_blkno=%llu, bitmap_blocks=%llu, num_clusters=%llu\n",
+	       osb->bitmap_blkno, osb->bitmap_blocks, osb->num_clusters);
 	
 	ocfs_initialize_bitmap (&osb->cluster_bitmap, osb->num_clusters, OCFS_I(inode)->alloc_size << 3);
 	/* read the whole cluster bitmap off disk, even though we only
@@ -1628,11 +1677,6 @@
 	}
 	iput(inode);
 
-	/* get some pseudo constants for >> bits */
-	osb->s_clustersize_bits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
-	osb->s_clustersize = 1 << osb->s_clustersize_bits;
-	printk("clusterbits=%d\n", osb->s_clustersize_bits);
-	OCFS_ASSERT(osb->s_clustersize_bits);
 
 	osb->prealloc_lock = 0;
 
@@ -1685,6 +1729,14 @@
 	for(i = 0; i < osb->max_nodes; i++)
 		osb->last_publ_seq_num[i] = (__u64) (-1);
 
+
+	/* load all node-local system inodes */
+	status = ocfs_init_local_system_inodes(osb);
+	if (status < 0) {
+		LOG_ERROR_STATUS(status);
+		goto bail;
+	}
+
 	/* We might need to add a variable in Global List of osb to */
 	/* delay any creation, if any other node is already creating a file */
 

Modified: branches/format-changes/src/sysfile.c
===================================================================
--- branches/format-changes/src/sysfile.c	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/sysfile.c	2004-06-13 22:48:13 UTC (rev 1079)
@@ -127,7 +127,7 @@
 	
 	status = ocfs_find_files_on_disk(osb, namebuf, strlen(namebuf),
 					 &fe_off, osb->sys_root_inode, 
-					 1, &dirent_bh, &de);
+					 0, &dirent_bh, &de);
 	if (status < 0) {
 		goto bail;
 	}

Modified: branches/format-changes/src/volcfg.c
===================================================================
--- branches/format-changes/src/volcfg.c	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/volcfg.c	2004-06-13 22:48:13 UTC (rev 1079)
@@ -768,18 +768,18 @@
 	/* 1st block in buffer is the NodeCfgHdr */
 	hdr = OCFS_BH_GET_DATA_READ(cfg_bhs[0]);
 
-	if (strncmp (hdr->signature, NODE_CONFIG_HDR_SIGN,
-		     NODE_CONFIG_SIGN_LEN)) {
+	if (strncmp (hdr->signature, OCFS2_NODE_CONFIG_HDR_SIGN,
+		     OCFS2_NODE_CONFIG_SIGN_LEN)) {
 		LOG_ERROR_STR ("Invalid node config signature");
 		status = -EINVAL;
 		goto finally;
 	}
 
-	if  (hdr->version < NODE_MIN_SUPPORTED_VER ||
-	     hdr->version > NODE_CONFIG_VER) {
+	if  (hdr->version < OCFS2_NODE_MIN_SUPPORTED_VER ||
+	     hdr->version > OCFS2_NODE_CONFIG_VER) {
 		LOG_ERROR_ARGS ("Node config version mismatch, (%d) < minimum" \
 				" (%d) or > current (%d)", hdr->version,
-				NODE_MIN_SUPPORTED_VER, NODE_CONFIG_VER);
+				OCFS2_NODE_MIN_SUPPORTED_VER, OCFS2_NODE_CONFIG_VER);
 		status = -EINVAL;
 		goto finally;
 	}

Modified: branches/format-changes/src/vote.c
===================================================================
--- branches/format-changes/src/vote.c	2004-06-13 08:30:18 UTC (rev 1078)
+++ branches/format-changes/src/vote.c	2004-06-13 22:48:13 UTC (rev 1079)
@@ -966,7 +966,8 @@
 	*(ctxt->status) = status;
 }
 
-
+/* special case -1 for now
+ * TODO: should *really* make sure the calling func never passes -1!!  */
 void ocfs_node_map_init(ocfs_super *osb, ocfs_node_map *map)
 {
 	map->num_nodes = osb->max_nodes;
@@ -976,12 +977,16 @@
 
 void ocfs_node_map_set_bit(ocfs_node_map *map, int bit)
 {
+	if (bit==-1)
+		return;
 	OCFS_ASSERT(bit < map->num_nodes);
 	set_bit(bit, map->map);
 }
 
 void ocfs_node_map_clear_bit(ocfs_node_map *map, int bit)
 {
+	if (bit==-1)
+		return;
 	OCFS_ASSERT(bit < map->num_nodes);
 	clear_bit(bit, map->map);
 }
@@ -1014,7 +1019,10 @@
 
 int ocfs_node_map_test_bit(ocfs_node_map *map, int bit)
 {
-	OCFS_ASSERT(bit < map->num_nodes);
+	if (bit >= map->num_nodes) {
+		LOG_ERROR_ARGS("bit=%d map->num_nodes=%d\n", bit, map->num_nodes);
+		BUG();
+	}
 	return test_bit(bit, map->map);
 }
 
@@ -1179,12 +1187,16 @@
 }
 
 int ocfs_node_is_recovering(ocfs_super *osb, int num)
-{
+{	
+	if (num == -1)
+		return 0;
 	return ocfs_node_map_test_bit(&osb->recovery_map, num);
 }
 
 int ocfs_node_is_alive(ocfs_node_map *pubmap, int index)
 {
+	if (index == -1)
+		return 0;
 	return ocfs_node_map_test_bit(pubmap, index);
 }	
 



More information about the Ocfs2-commits mailing list