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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Apr 22 14:51:24 CDT 2004


Author: mfasheh
Date: 2004-04-22 13:51:22 -0500 (Thu, 22 Apr 2004)
New Revision: 862

Modified:
   trunk/src/hash.c
   trunk/src/inc/ocfs.h
   trunk/src/nm.c
   trunk/src/osb.c
   trunk/src/super.c
Log:
* Turn hashlock and osb_res into real struct semaphores instead of
  recursive ocfs_sems. This was trivially easy.

* Get rid of ipc_ctxt_res as it was never used.

* Remove an unused goto label in process_vote.



Modified: trunk/src/hash.c
===================================================================
--- trunk/src/hash.c	2004-04-22 01:35:22 UTC (rev 861)
+++ trunk/src/hash.c	2004-04-22 18:51:22 UTC (rev 862)
@@ -190,7 +190,7 @@
 	ht->freelist = NULL;
 	ht->lastfree = NULL;
 
-	ocfs_init_sem (&(ht->hashlock));
+	init_MUTEX (&(ht->hashlock));
 
 	size = ht->size * sizeof (HASHBUCKET);
 	ht->buckets = (HASHBUCKET *) ocfs_malloc (size);
@@ -292,7 +292,7 @@
 	bucket = &(ht->buckets[slot]);
 
 	/* Acquire Lock */
-	ocfs_down_sem (&(ht->hashlock), true);
+	down (&(ht->hashlock));
 	lockacqrd = true;
 
 	while (bucket) {
@@ -371,7 +371,7 @@
 bail:
 	/* Release Lock */
 	if (lockacqrd)
-		ocfs_up_sem (&(ht->hashlock));
+		up(&(ht->hashlock));
 
 	LOG_EXIT_LONG (ret);
 	return ret;
@@ -402,7 +402,7 @@
 	bucket = &(ht->buckets[slot]);
 
 	/* Acquire Lock */
-	ocfs_down_sem (&(ht->hashlock), true);
+	down (&(ht->hashlock));
 	lockacqrd = true;
 
 	while (bucket) {
@@ -442,7 +442,7 @@
 bail:
 	/* Release Lock */
 	if (lockacqrd)
-		ocfs_up_sem (&(ht->hashlock));
+		up (&(ht->hashlock));
 
 	LOG_EXIT_LONG (ret);
 	return ret;
@@ -468,7 +468,7 @@
 	bucket = &(ht->buckets[slot]);
 
 	/* Acquire Lock */
-	ocfs_down_sem (&(ht->hashlock), true);
+	down (&(ht->hashlock));
 	lockacqrd = true;
 
 	while (bucket) {
@@ -487,7 +487,7 @@
 bail:
 	/* Release Lock */
 	if (lockacqrd)
-		ocfs_up_sem (&(ht->hashlock));
+		up (&(ht->hashlock));
 
 	LOG_EXIT_LONG (ret);
 	return ret;
@@ -516,7 +516,7 @@
 		goto bail;
 
 	/* Acquire Lock */
-	ocfs_down_sem (&(ht->hashlock), true);
+	down (&(ht->hashlock));
 	lockacqrd = true;
 
 	for (slot = 0; slot < ht->size; ++slot) {
@@ -545,7 +545,7 @@
 bail:
 	/* Release Lock */
 	if (lockacqrd)
-		ocfs_up_sem (&(ht->hashlock));
+		up (&(ht->hashlock));
 
 	LOG_EXIT ();
 	return;

Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h	2004-04-22 01:35:22 UTC (rev 861)
+++ trunk/src/inc/ocfs.h	2004-04-22 18:51:22 UTC (rev 862)
@@ -1448,7 +1448,7 @@
 	__u32 inithash;
 	__u32 newbuckets;		/* Used for statistics */
 	__u32 reusedbuckets;	/* Used for statistics */
-	ocfs_sem hashlock;
+	struct semaphore hashlock;
 	HASHBUCKET *lastfree;
 	HASHBUCKET *freelist;
 	HASHBUCKET *buckets;
@@ -1902,7 +1902,7 @@
 struct _ocfs_super
 {
 	ocfs_obj_id obj_id;
-	ocfs_sem osb_res;	/* resource to protect the ocfs_super */
+	struct semaphore osb_res; /* resource to protect the ocfs_super */
 	struct list_head osb_next;	/* list of ocfs_super(s) */
 	__u32 osb_id;		/* id used by the proc interface */
 	struct completion dlm_complete;
@@ -2041,7 +2041,6 @@
 
 typedef struct _ocfs_ipc_ctxt
 {
-	ocfs_sem ipc_ctxt_res;
 	__u32 dlm_msg_size;
 	__u16 version;
 	bool init;

Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c	2004-04-22 01:35:22 UTC (rev 861)
+++ trunk/src/nm.c	2004-04-22 18:51:22 UTC (rev 862)
@@ -845,7 +845,7 @@
 		inode = NULL;
 	else
 		inode = ocfs_get_inode_from_offset(osb, lock_id, fe_off, NULL);
-skip_inode:
+
 	if (inode) {
 		/* we only need i_sem for some of the operations
 		 * below, but due to lock ordering, we want to take it

Modified: trunk/src/osb.c
===================================================================
--- trunk/src/osb.c	2004-04-22 01:35:22 UTC (rev 861)
+++ trunk/src/osb.c	2004-04-22 18:51:22 UTC (rev 862)
@@ -72,11 +72,11 @@
 	}
 
 
-	ocfs_init_sem (&(osb->osb_res));
 	ocfs_init_sem (&(osb->dir_alloc_lock));
 	ocfs_init_sem (&(osb->file_alloc_lock));
 	ocfs_init_sem (&(osb->vol_alloc_lock));
 
+	init_MUTEX (&(osb->osb_res));
 	init_MUTEX (&(osb->recovery_lock));
 	init_MUTEX (&(osb->comm_lock));
 	init_MUTEX (&(osb->trans_lock));
@@ -473,7 +473,6 @@
 	for (i=0; i<32; i++)
 		ocfs_recover_oin_locks(osb, i);
 
-	ocfs_del_sem (&(osb->osb_res));
 	for(i = 0; i < osb->cfg_numblocks; i++)
 		if (osb->cfg_bhs[i])
 			brelse(osb->cfg_bhs[i]);

Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c	2004-04-22 01:35:22 UTC (rev 861)
+++ trunk/src/super.c	2004-04-22 18:51:22 UTC (rev 862)
@@ -256,7 +256,7 @@
 
 	LOG_EXIT_STATUS(status);
 	return status;
-}
+}				/* __ocfs_read_super */
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static int ocfs_read_super (struct super_block *sb, void *data, int silent)
@@ -873,7 +873,7 @@
 	}
 	spin_unlock (&osb_id_lock);
 
-	ocfs_down_sem (&(osb->osb_res), true);
+	down(&(osb->osb_res));
 
 	/* Launch the NM thread for the mounted volume */
 	osb->dlm_task = NULL;
@@ -882,7 +882,7 @@
 	if (child_pid < 0) {
 		LOG_ERROR_ARGS ("unable to launch ocfs2nm thread, error=%d",
 				child_pid);
-		ocfs_up_sem (&(osb->osb_res));
+		up (&(osb->osb_res));
 		status = -EFAIL;
 		goto leave;
 	} else {
@@ -893,6 +893,7 @@
 	osb->commit = (ocfs_commit_task *)ocfs_malloc(sizeof(ocfs_commit_task));
 	if (osb->commit == NULL) {
 		LOG_ERROR_STATUS(status = -ENOMEM);
+		up (&(osb->osb_res));
 		goto leave;
 	}
 	memset(osb->commit, 0, sizeof(ocfs_commit_task));
@@ -903,14 +904,14 @@
 	if (child_pid < 0) {
 		LOG_ERROR_ARGS ("unable to launch ocfs2commit thread, error=%d",
 				child_pid);
-		ocfs_up_sem (&(osb->osb_res));
+		up (&(osb->osb_res));
 		status = -EFAIL;
 		goto leave;
 	} else {
 		init_completion (&osb->commit->c_complete);
 	}
 
-	ocfs_up_sem (&(osb->osb_res));
+	up (&(osb->osb_res));
 
 	/* Add proc entry for this volume */
 	ocfs_proc_add_volume (osb);
@@ -952,7 +953,7 @@
 
 	/*  Join or Form the cluster... */
 	LOG_TRACE_STR ("ocfs_vol_member_reconfig...");
-	ocfs_down_sem (&(osb->osb_res), true);
+	down(&(osb->osb_res));
 	osb->hbm = DISK_HBEAT_COMM_ON;
 	
 	down (&(osb->publish_lock));
@@ -964,7 +965,7 @@
 	status = ocfs_create_root_oin (osb, NULL);
 	if (status >= 0)
 		osb->vol_state = VOLUME_ENABLED;
-	ocfs_up_sem (&(osb->osb_res));
+	up (&(osb->osb_res));
 	if (status < 0) {
 		LOG_ERROR_STATUS (status);
 		goto leave;
@@ -994,9 +995,9 @@
 	/* Read the publish sector for this node and cleanup dirent being */
 	/* modified when we crashed. */
 	LOG_TRACE_STR ("ocfs_check_volume...");
-	ocfs_down_sem (&(osb->osb_res), true);
+	down(&(osb->osb_res));
 	status = ocfs_check_volume (osb);
-	ocfs_up_sem (&(osb->osb_res));
+	up (&(osb->osb_res));
 	if (status < 0) {
 		LOG_ERROR_STATUS (status);
 		goto leave;
@@ -1067,7 +1068,7 @@
 		schedule();
 	}
 
-	ocfs_down_sem (&(osb->osb_res), true);
+	down(&(osb->osb_res));
 	AcquiredOSB = true;
 
 #ifdef UMOUNT_CHECK
@@ -1147,7 +1148,7 @@
 
 	osb->vol_state = VOLUME_DISMOUNTED;
 	if (AcquiredOSB) {
-		ocfs_up_sem (&(osb->osb_res));
+		up (&(osb->osb_res));
 		AcquiredOSB = false;
 	}
 
@@ -1182,7 +1183,7 @@
 
 leave:
 	if (AcquiredOSB) {
-		ocfs_up_sem (&(osb->osb_res));
+		up (&(osb->osb_res));
 		AcquiredOSB = false;
 	}
 



More information about the Ocfs2-commits mailing list