[Ocfs2-commits] mfasheh commits r1603 - branches/dlm-glue/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Oct 28 18:02:48 CDT 2004


Author: mfasheh
Date: 2004-10-28 18:02:46 -0500 (Thu, 28 Oct 2004)
New Revision: 1603

Modified:
   branches/dlm-glue/src/dlmglue.c
   branches/dlm-glue/src/ocfs1_fs_compat.h
   branches/dlm-glue/src/ocfs2.h
   branches/dlm-glue/src/ocfs2_fs.h
   branches/dlm-glue/src/super.c
Log:
* add some stub functions for the dlm stuff as it doesn't compile
  right now.

* make us actually insmod and mount. Yay, no more load_ocfs2 script is
  needed now!



Modified: branches/dlm-glue/src/dlmglue.c
===================================================================
--- branches/dlm-glue/src/dlmglue.c	2004-10-28 21:47:03 UTC (rev 1602)
+++ branches/dlm-glue/src/dlmglue.c	2004-10-28 23:02:46 UTC (rev 1603)
@@ -51,6 +51,42 @@
 
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_DLMGLUE
 
+#warning REMOVE THESE STUBS
+
+dlm_status dlmlock(dlm_ctxt *dlm,
+		   int mode,
+		   dlm_lockstatus *lksb,
+		   int flags,
+		   char *name, 
+		   dlm_astlockfunc_t *ast,
+		   void *data,
+		   dlm_bastlockfunc_t *bast)
+{
+	lksb->status = DLM_NORMAL;
+	ast(data);
+	return DLM_NORMAL;
+}
+dlm_status dlmunlock(dlm_ctxt *dlm,
+		     dlm_lockstatus *lksb,
+		     int flags,
+		     dlm_astunlockfunc_t *unlockast,
+		     void *data)
+{
+	lksb->status = DLM_NORMAL;
+	unlockast(data, DLM_NORMAL);
+	return DLM_NORMAL;
+}
+dlm_ctxt * dlm_register_domain(char *domain, char *group_name, u32 key)
+{
+	dlm_ctxt * ret = kmalloc(sizeof(dlm_ctxt), GFP_KERNEL);
+	memset(ret, 0, sizeof(dlm_ctxt));
+	return ret;
+}
+void dlm_unregister_domain(dlm_ctxt *dlm)
+{
+	kfree(dlm);
+}
+
 /* lock ids are made up in the following manner:
  * name[0]     --> type
  * name[1-6]   --> 6 pad characters, reserved for now
@@ -536,8 +572,7 @@
 	wait_event_interruptible(lockres->lr_blocked,
 				 !ocfs2_check_wait_flag(lockres,
 							lock,
-							OCFS2_LOCK_REFRESHING));
-}
+							OCFS2_LOCK_REFRESHING));}
 
 static int ocfs2_cluster_lock(struct inode *inode, 
 			      ocfs2_lock *lock, 
@@ -742,8 +777,8 @@
 static inline int ocfs2_wait_on_recovery(ocfs_super *osb)
 {
 	wait_event_interruptible(osb->recovery_event,
-				 !ocfs_node_map_is_empty(osb,
-							 &osb->recovery_map));
+				 ocfs_node_map_is_empty(osb,
+							&osb->recovery_map));
 
 	if (signal_pending(current))
 		return -EINTR;
@@ -1049,8 +1084,8 @@
 	 * different states. */
 	spin_lock(&osb->vote_task_lock);
 	if (osb->vote_task) {
+		osb->vote_exit = 1;
 		ocfs2_kick_vote_thread(osb);
-		osb->vote_exit = 1;
 		wait_on_vote_task = 1;
 	}
 	spin_unlock(&osb->vote_task_lock);
@@ -1493,6 +1528,13 @@
 	complete(&osb->vote_event_init);
 
 	while (1) {
+		if (osb->vote_exit) {
+			if (list_empty(&osb->blocked_inode_list) &&
+			    list_empty(&osb->vote_list))
+				break;
+			/* don't want to sleep if we're supposed to quit. */
+			atomic_set(&osb->wake_vote_task, 1);
+		}
 		spin_unlock(&osb->vote_task_lock);
 
 //#define OCFS2_VOTE_THREAD_TIMEOUT (HZ >> 1)
@@ -1505,14 +1547,13 @@
 
 		atomic_set(&osb->wake_vote_task, 0);
 
+		printk("(%u) vote_thread: awoken\n", current->pid);
+
 		ocfs2_vote_thread_do_work(osb);
 
 		spin_lock(&osb->vote_task_lock);
-		if (osb->vote_exit && 
-		    !list_empty(&osb->blocked_inode_list) &&
-		    !list_empty(&osb->vote_list))
-			break;
 	}
+	printk("(%u) vote_thread: exiting\n", current->pid);
 
 	osb->vote_task = NULL;
 	spin_unlock(&osb->vote_task_lock);

Modified: branches/dlm-glue/src/ocfs1_fs_compat.h
===================================================================
--- branches/dlm-glue/src/ocfs1_fs_compat.h	2004-10-28 21:47:03 UTC (rev 1602)
+++ branches/dlm-glue/src/ocfs1_fs_compat.h	2004-10-28 23:02:46 UTC (rev 1603)
@@ -33,6 +33,7 @@
 #define MAX_VOL_ID_LENGTH_V1               16
 #define MAX_VOL_LABEL_LEN_V1               64
 #define MAX_CLUSTER_NAME_LEN_V1            64
+#define MAX_NODE_NAME_LENGTH	32
 
 #define OCFS1_MAJOR_VERSION              (2)
 #define OCFS1_MINOR_VERSION              (0)

Modified: branches/dlm-glue/src/ocfs2.h
===================================================================
--- branches/dlm-glue/src/ocfs2.h	2004-10-28 21:47:03 UTC (rev 1602)
+++ branches/dlm-glue/src/ocfs2.h	2004-10-28 23:02:46 UTC (rev 1603)
@@ -26,6 +26,8 @@
 #ifndef OCFS2_H
 #define OCFS2_H
 
+#define OCFS2_MAX_NODE_NAME_LENGTH	65
+
 static inline u64 ocfs2_clusters_to_blocks(struct super_block *sb,
 					   u32 clusters)
 {

Modified: branches/dlm-glue/src/ocfs2_fs.h
===================================================================
--- branches/dlm-glue/src/ocfs2_fs.h	2004-10-28 21:47:03 UTC (rev 1602)
+++ branches/dlm-glue/src/ocfs2_fs.h	2004-10-28 23:02:46 UTC (rev 1603)
@@ -203,8 +203,6 @@
 #define OCFS2_NODE_CONFIG_VER		2
 #define OCFS2_NODE_MIN_SUPPORTED_VER	2
 
-#define MAX_NODE_NAME_LENGTH	32
-
 #define OCFS2_GUID_HOSTID_LEN	20
 #define OCFS2_GUID_MACID_LEN	12
 #define OCFS2_GUID_LEN		(OCFS2_GUID_HOSTID_LEN + OCFS2_GUID_MACID_LEN)

Modified: branches/dlm-glue/src/super.c
===================================================================
--- branches/dlm-glue/src/super.c	2004-10-28 21:47:03 UTC (rev 1602)
+++ branches/dlm-glue/src/super.c	2004-10-28 23:02:46 UTC (rev 1603)
@@ -79,15 +79,9 @@
 spinlock_t osb_id_lock;
 __u32 osb_id;             /* Keeps track of next available OSB Id */
 
-char *node_name = NULL;
-__s32 node_number = OCFS_INVALID_NODE_NUM;
 __u32 debug_context = 0;
 __u32 debug_level = 0;
 __u32 debug_exclude = 0;
-char *ip_address = NULL;
-__u32 ip_port_v2 = 0;
-__u32 cs = 0;
-char *ocfs_hostname;
 
 #ifdef EVIL_TRACE
 __u64 debug_mask = 0;
@@ -128,31 +122,16 @@
 //MODULE_DESCRIPTION("Oracle Clustered FileSystem");
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-module_param (node_name, charp, 0);
-module_param (node_number, int, 0);
 module_param (debug_context, uint, 0);
 module_param (debug_level, uint, 0);
 module_param (debug_exclude, uint, 0);
-module_param (ip_address, charp, 0);
-module_param (ip_port_v2, uint, 0);
-module_param (cs, uint, 0);
 #else /* 2.6.x kernel */
-MODULE_PARM (node_name, "s");
-MODULE_PARM_DESC(node_name, "Name of this machine in the cluster");
-MODULE_PARM (node_number, "i");
-MODULE_PARM_DESC(node_number, "Slot number for this machine within volume");
 MODULE_PARM (debug_context, "i");
 MODULE_PARM_DESC(debug_context, "Debug context");
 MODULE_PARM (debug_level, "i");
 MODULE_PARM_DESC(debug_level, "Debug level");
 MODULE_PARM (debug_exclude, "i");
 MODULE_PARM_DESC(debug_exclude, "Process ID to exclude from tracing");
-MODULE_PARM (ip_address, "s");
-MODULE_PARM_DESC(ip_address, "IP address for the network dlm on this node");
-MODULE_PARM (ip_port_v2, "i");
-MODULE_PARM_DESC(ip_port_v2, "Port number for the network dlm on this node");
-MODULE_PARM (cs, "i");
-MODULE_PARM_DESC(cs, "Checksum");
 #endif /* Linux 2.4 stuff */
 
 
@@ -162,7 +141,6 @@
 static void ocfs_put_super (struct super_block *sb);
 static int ocfs_mount_volume (struct super_block *sb, int reclaim_id, struct inode *root);
 static void ocfs_dismount_volume(struct super_block *sb);
-static int ocfs_read_params(void);
 static int ocfs_initialize_mem_lists (void);
 static void ocfs_free_mem_lists (void);
 static void ocfs_delete_osb (ocfs_super * osb);
@@ -512,16 +490,7 @@
 
 	if (init_ocfs2_extent_maps())
 		return -ENOMEM;
-	
-	ocfs_hostname = kmalloc(strlen(system_utsname.nodename) + 1, GFP_KERNEL);
-	if (ocfs_hostname == NULL) {
-		status = -EINVAL;
-		goto leave;
-	}
 
-	strcpy(ocfs_hostname, system_utsname.nodename);
-	printk("ocfs2: hostname is %s\n", ocfs_hostname);
-	
 	ocfs_table_header = register_sysctl_table(ocfs_root_table, 0);
 	if (!ocfs_table_header) {
 		LOG_ERROR_STATUS(status = -ENOMEM);
@@ -533,10 +502,21 @@
 	INIT_LIST_HEAD (&(OcfsGlobalCtxt.osb_next));
 	INIT_LIST_HEAD (&(OcfsGlobalCtxt.osb_next));
 
-	/* Read remaining insmod params */
-	if ((status = ocfs_read_params ()) < 0)
-	    goto leave;
+	/* Ok, just use utsname for now. Eventually we need to
+	 * get this from the node config subsystem. */
+	OcfsGlobalCtxt.node_name = kmalloc(OCFS2_MAX_NODE_NAME_LENGTH,
+					   GFP_KERNEL);
+	if (!OcfsGlobalCtxt.node_name) {
+		status = -ENOMEM;
+		LOG_ERROR_STATUS(status);
+		goto leave;
+	}
+	memset(OcfsGlobalCtxt.node_name, 0, OCFS2_MAX_NODE_NAME_LENGTH);
+	strncpy(OcfsGlobalCtxt.node_name, system_utsname.nodename,
+		OCFS2_MAX_NODE_NAME_LENGTH - 1);
 
+	printk("ocfs2: node name is %s\n", OcfsGlobalCtxt.node_name);
+
 	/* Initialize the global data resource */
 	init_MUTEX (&(OcfsGlobalCtxt.global_res));
 	OCFS_SET_FLAG (OcfsGlobalCtxt.flags, OCFS_FLAG_GLBL_CTXT_RESOURCE_INITIALIZED);
@@ -587,34 +567,6 @@
 }				/* ocfs_driver_entry */
 
 /*
- * ocfs_read_params()
- *
- * Read insmod params
- */
-static int ocfs_read_params(void)
-{
-	int status = 0;
-
-	/* Read remaining insmod params */
-	if (node_number != OCFS_INVALID_NODE_NUM) {
-		// this will be validated later
-		OcfsGlobalCtxt.pref_node_num = node_number;
-		LOG_TRACE_ARGS("Preferred node number: %d\n", node_number);
-	}
-
-	if (node_name && strlen(node_name) < MAX_NODE_NAME_LENGTH) {
-		OcfsGlobalCtxt.node_name = node_name;
-		LOG_TRACE_ARGS ("Node name: %s\n", OcfsGlobalCtxt.node_name);
-	} else {
-		status = -EINVAL;
-		LOG_ERROR_STR ("'node_name' not set or too long");
-	}
-
-	return status;
-}				/* ocfs_read_params */
-
-
-/*
  * ocfs_driver_exit()
  *
  * Called on rmmod
@@ -643,6 +595,9 @@
 
 	exit_ocfs2_extent_maps();
 
+	if (OcfsGlobalCtxt.node_name)
+		kfree(OcfsGlobalCtxt.node_name);
+
 	printk("Unloaded OCFS Driver module\n");
 	LOG_EXIT ();
 	return;
@@ -948,6 +903,13 @@
 		goto leave;
 	}
 
+	/* load all node-local system inodes */
+	status = ocfs_init_local_system_inodes(osb);
+	if (status < 0) {
+		LOG_ERROR_STATUS(status);
+		goto leave;
+	}
+
 	status = ocfs2_register_hb_callbacks(osb);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status);
@@ -1271,13 +1233,6 @@
 	}
 	iput(inode);
 
-	/* 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 */
 
@@ -1332,7 +1287,6 @@
 			   OCFS2_MAJOR_REV_LEVEL ||
 			   le16_to_cpu(di->id2.i_super.s_minor_rev_level) !=
 			   OCFS2_MINOR_REV_LEVEL) {
-#warning dont know what is appropriate on minor rev difference
 			LOG_ERROR_ARGS("found superblock with bad version: "
 				       "found %u.%u, should be %u.%u\n",
 				       le16_to_cpu(di->id2.i_super.s_major_rev_level),



More information about the Ocfs2-commits mailing list