[Ocfs2-commits] zab commits r1999 - in branches/usysfsify/fs/ocfs2: . cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Mar 17 18:47:29 CST 2005


Author: zab
Date: 2005-03-17 18:47:27 -0600 (Thu, 17 Mar 2005)
New Revision: 1999

Modified:
   branches/usysfsify/fs/ocfs2/cluster/heartbeat.c
   branches/usysfsify/fs/ocfs2/dlmglue.c
   branches/usysfsify/fs/ocfs2/ocfs.h
   branches/usysfsify/fs/ocfs2/super.c
Log:
o use a caps-hex string representation of the uuid for the dlm key and domain
o missed some heartbeat region intialization :/


Modified: branches/usysfsify/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- branches/usysfsify/fs/ocfs2/cluster/heartbeat.c	2005-03-17 23:24:28 UTC (rev 1998)
+++ branches/usysfsify/fs/ocfs2/cluster/heartbeat.c	2005-03-18 00:47:27 UTC (rev 1999)
@@ -392,7 +392,7 @@
  */
 void hb_fill_node_map(unsigned long *map, unsigned bytes)
 {
-	struct hb_region *reg = NULL;
+	struct hb_region *reg;
 	struct hb_disk_slot *slot;
 
 	BUG_ON(bytes < (BITS_TO_LONGS(NM_MAX_NODES) * sizeof(unsigned long)));
@@ -697,6 +697,8 @@
 	if (reg == NULL)
 		goto out; /* ENOMEM */
 
+	INIT_LIST_HEAD(&reg->hr_active_item);
+	rwlock_init(&reg->hr_slot_list_lock);
 	INIT_LIST_HEAD(&reg->hr_alive_list);
 	INIT_LIST_HEAD(&reg->hr_dead_list);
 

Modified: branches/usysfsify/fs/ocfs2/dlmglue.c
===================================================================
--- branches/usysfsify/fs/ocfs2/dlmglue.c	2005-03-17 23:24:28 UTC (rev 1998)
+++ branches/usysfsify/fs/ocfs2/dlmglue.c	2005-03-18 00:47:27 UTC (rev 1999)
@@ -1616,10 +1616,10 @@
 
 	/* used by the dlm code to make message headers unique, each
 	 * node in this domain must agree on this. */
-	dlm_key = crc32(0, osb->uuid, strlen(osb->uuid));
+	dlm_key = crc32(0, osb->uuid_str, strlen(osb->uuid_str));
 
 	/* for now, uuid == domain */
-	dlm = dlm_register_domain(osb->uuid, dlm_key);
+	dlm = dlm_register_domain(osb->uuid_str, dlm_key);
 	if (!dlm) {
 		/* This is a best guess on return value... */
 		status = -ENOMEM;

Modified: branches/usysfsify/fs/ocfs2/ocfs.h
===================================================================
--- branches/usysfsify/fs/ocfs2/ocfs.h	2005-03-17 23:24:28 UTC (rev 1998)
+++ branches/usysfsify/fs/ocfs2/ocfs.h	2005-03-18 00:47:27 UTC (rev 1999)
@@ -330,6 +330,7 @@
 	u64 bitmap_blkno;
 	u32 bitmap_cpg;
 	u8 *uuid;
+	char *uuid_str;
 	u8 *vol_label;
 	u64 first_cluster_group_blkno;
 	u32 fs_generation;

Modified: branches/usysfsify/fs/ocfs2/super.c
===================================================================
--- branches/usysfsify/fs/ocfs2/super.c	2005-03-17 23:24:28 UTC (rev 1998)
+++ branches/usysfsify/fs/ocfs2/super.c	2005-03-18 00:47:27 UTC (rev 1999)
@@ -1032,6 +1032,30 @@
 	sb->s_dev = 0;
 }				/* ocfs_dismount_volume */
 
+static int osb_setup_uuid(ocfs_super *osb, const unsigned char *uuid,
+			  unsigned uuid_bytes)
+{
+	int i, ret;
+	char *ptr;
+
+	BUG_ON(uuid_bytes != MAX_VOL_ID_LENGTH);
+
+	osb->uuid_str = kcalloc(1, MAX_VOL_ID_LENGTH*2 + 1, GFP_KERNEL);
+	if (osb->uuid_str == NULL)
+		return -ENOMEM;
+
+	memcpy(osb->uuid, uuid, MAX_VOL_ID_LENGTH);
+
+	for (i = 0, ptr = osb->uuid_str; i < MAX_VOL_ID_LENGTH; i++) {
+		ret = snprintf(ptr, 2, "%02X", uuid[i]);
+		if (ret != 2) /* drop super cleans up */
+			return -EINVAL;
+		ptr += ret;
+	}
+
+	return 0;
+}
+
 /*
  * ocfs_initialize_osb()
  *
@@ -1158,21 +1182,21 @@
 		goto bail;
 	}
 
+	if (osb_setup_uuid(osb, di->id2.i_super.s_uuid,
+			   sizeof(di->id2.i_super.s_uuid))) {
+		LOG_ERROR_ARGS("Out of memory trying to setup our uuid.\n"); 
+		status = -ENOMEM;
+		goto bail;
+	}
+
 	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);
 	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;
-		printk("uuid: ");
-		for (ttt=0; ttt<16; ttt++)
-		printk("%02x ", di->id2.i_super.s_uuid[ttt]);
-		printk("\n");
-	}
+	printk("uuid: %s\n", osb->uuid_str);
 	printk("root_blkno=%llu, system_dir_blkno=%llu\n", osb->root_blkno, osb->system_dir_blkno);
 
 	atomic_set (&osb->vol_state, VOLUME_INIT);
@@ -1461,6 +1485,7 @@
 	kfree(osb->journal);
 	if (osb->local_alloc_copy)
 		kfree(osb->local_alloc_copy);
+	kfree(osb->uuid_str);
 	memset (osb, 0, sizeof (ocfs_super));
 
 	LOG_EXIT ();



More information about the Ocfs2-commits mailing list