[Ocfs2-commits] khackel commits r2430 - trunk/fs/ocfs2/dlm

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Jun 28 16:07:53 CDT 2005


Author: khackel
Signed-off-by: manish
Date: 2005-06-24 19:12:28 -0500 (Fri, 24 Jun 2005)
New Revision: 2430

Modified:
   trunk/fs/ocfs2/dlm/dlmast.c
   trunk/fs/ocfs2/dlm/dlmcommon.h
   trunk/fs/ocfs2/dlm/dlmlock.c
   trunk/fs/ocfs2/dlm/dlmmaster.c
   trunk/fs/ocfs2/dlm/dlmrecovery.c
   trunk/fs/ocfs2/dlm/dlmthread.c
   trunk/fs/ocfs2/dlm/dlmunlock.c
Log:
* eliminate DLM_ASSERT(x), replace with BUG_ON(!x)

Signed-off-by: manish



Modified: trunk/fs/ocfs2/dlm/dlmast.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmast.c	2005-06-24 23:00:06 UTC (rev 2429)
+++ trunk/fs/ocfs2/dlm/dlmast.c	2005-06-25 00:12:28 UTC (rev 2430)
@@ -70,7 +70,7 @@
 
 	if (lock->ml.highest_blocked == LKM_IVMODE)
 		return 0;
-	DLM_ASSERT(lock->ml.highest_blocked != LKM_NLMODE);
+	BUG_ON(lock->ml.highest_blocked == LKM_NLMODE);
 
 	if (lock->bast_pending && 
 	    list_empty(&lock->bast_list))
@@ -94,11 +94,11 @@
 {
 	mlog_entry_void();
 
-	DLM_ASSERT(dlm);
-	DLM_ASSERT(lock);
+	BUG_ON(!dlm);
+	BUG_ON(!lock);
 
 	assert_spin_locked(&dlm->ast_lock);
-	DLM_ASSERT(list_empty(&lock->ast_list));
+	BUG_ON(!list_empty(&lock->ast_list));
 	if (lock->ast_pending)
 		mlog(0, "lock has an ast getting flushed right now\n");
 
@@ -121,8 +121,8 @@
 {
 	mlog_entry_void();
 
-	DLM_ASSERT(dlm);
-	DLM_ASSERT(lock);
+	BUG_ON(!dlm);
+	BUG_ON(!lock);
 
 	spin_lock(&dlm->ast_lock);
 	__dlm_queue_ast(dlm, lock);
@@ -134,11 +134,11 @@
 {
 	mlog_entry_void();
 
-	DLM_ASSERT(dlm);
-	DLM_ASSERT(lock);
+	BUG_ON(!dlm);
+	BUG_ON(!lock);
 	assert_spin_locked(&dlm->ast_lock);
 
-	DLM_ASSERT(list_empty(&lock->bast_list));
+	BUG_ON(!list_empty(&lock->bast_list));
 	if (lock->bast_pending)
 		mlog(0, "lock has a bast getting flushed right now\n");
 
@@ -154,8 +154,8 @@
 {
 	mlog_entry_void();
 
-	DLM_ASSERT(dlm);
-	DLM_ASSERT(lock);
+	BUG_ON(!dlm);
+	BUG_ON(!lock);
 
 	spin_lock(&dlm->ast_lock);
 	__dlm_queue_bast(dlm, lock);
@@ -166,7 +166,7 @@
 			   dlm_lock *lock)
 {
 	dlm_lockstatus *lksb = lock->lksb;
-	DLM_ASSERT(lksb);
+	BUG_ON(!lksb);
 
 	/* only updates if this node masters the lockres */
 	if (res->owner == dlm->node_num) {
@@ -200,7 +200,7 @@
 
 	lksb = lock->lksb;
 	fn = lock->ast;
-	DLM_ASSERT(lock->ml.node == dlm->node_num);
+	BUG_ON(lock->ml.node != dlm->node_num);
 
 	dlm_update_lvb(dlm, res, lock);
 	(*fn)(lock->astdata);
@@ -216,7 +216,7 @@
 	mlog_entry_void();
 
 	lksb = lock->lksb;
-	DLM_ASSERT(lock->ml.node != dlm->node_num);
+	BUG_ON(lock->ml.node == dlm->node_num);
 
 	lksbflags = lksb->flags;
 	dlm_update_lvb(dlm, res, lock);
@@ -234,7 +234,7 @@
 
 	mlog_entry_void();
 
-	DLM_ASSERT(lock->ml.node == dlm->node_num);
+	BUG_ON(lock->ml.node != dlm->node_num);
 	
 	(*fn)(lock->astdata, blocked_type);
 }
@@ -303,7 +303,7 @@
 	}
 
 	/* cannot get a proxy ast message if this node owns it */
-	DLM_ASSERT(res->owner != dlm->node_num);
+	BUG_ON(res->owner == dlm->node_num);
 
 	mlog(0, "lockres %.*s\n", res->lockname.len, res->lockname.name);
 
@@ -367,7 +367,7 @@
 
 		/* if we requested the lvb, fetch it into our lksb now */
 		if (flags & LKM_GET_LVB) {
-			DLM_ASSERT(lock->lksb->flags & DLM_LKSB_GET_LVB);
+			BUG_ON(!(lock->lksb->flags & DLM_LKSB_GET_LVB));
 			memcpy(lock->lksb->lvb, past->lvb, DLM_LVB_LEN);
 		}
 	}

Modified: trunk/fs/ocfs2/dlm/dlmcommon.h
===================================================================
--- trunk/fs/ocfs2/dlm/dlmcommon.h	2005-06-24 23:00:06 UTC (rev 2429)
+++ trunk/fs/ocfs2/dlm/dlmcommon.h	2005-06-25 00:12:28 UTC (rev 2430)
@@ -27,9 +27,6 @@
 
 #include <linux/kref.h>
 
-#define DLM_ASSERT(x)     BUG_ON(!(x))
-
-
 #define DLM_HB_NODE_DOWN_PRI     (0xf000000)
 #define DLM_HB_NODE_UP_PRI       (0x8000000)  
 
@@ -802,8 +799,8 @@
 {
 	int i, nr = mr->total_locks;
 	
-	DLM_ASSERT(nr >= 0);
-	DLM_ASSERT(nr <= DLM_MAX_MIGRATABLE_LOCKS);
+	BUG_ON(nr < 0);
+	BUG_ON(nr > DLM_MAX_MIGRATABLE_LOCKS);
 	
 	mr->total_locks = htonl(mr->total_locks);
 	mr->mig_cookie = cpu_to_be64(mr->mig_cookie);
@@ -820,8 +817,8 @@
 	mr->mig_cookie = be64_to_cpu(mr->mig_cookie);
 
 	nr = mr->total_locks;
-	DLM_ASSERT(nr >= 0);
-	DLM_ASSERT(nr <= DLM_MAX_MIGRATABLE_LOCKS);
+	BUG_ON(nr < 0);
+	BUG_ON(nr > DLM_MAX_MIGRATABLE_LOCKS);
 
 	for (i=0; i<nr; i++)
 		dlm_migratable_lock_to_host(&(mr->ml[i]));

Modified: trunk/fs/ocfs2/dlm/dlmlock.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmlock.c	2005-06-24 23:00:06 UTC (rev 2429)
+++ trunk/fs/ocfs2/dlm/dlmlock.c	2005-06-25 00:12:28 UTC (rev 2430)
@@ -285,12 +285,12 @@
 	lock = container_of(kref, dlm_lock, lock_refs);
 
 	lksb = lock->lksb;
-	DLM_ASSERT(lksb->lockid == lock);
-	DLM_ASSERT(list_empty(&lock->list));
-	DLM_ASSERT(list_empty(&lock->ast_list));
-	DLM_ASSERT(list_empty(&lock->bast_list));
-	DLM_ASSERT(!lock->ast_pending);
-	DLM_ASSERT(!lock->bast_pending);
+	BUG_ON(lksb->lockid != lock);
+	BUG_ON(!list_empty(&lock->list));
+	BUG_ON(!list_empty(&lock->ast_list));
+	BUG_ON(!list_empty(&lock->bast_list));
+	BUG_ON(lock->ast_pending);
+	BUG_ON(lock->bast_pending);
 
 	dlm_lock_detach_lockres(lock);
 	
@@ -393,7 +393,7 @@
 	char *name;
 	unsigned int namelen;
 
-	DLM_ASSERT(dlm);
+	BUG_ON(!dlm);
 
 	mlog_entry_void();
 

Modified: trunk/fs/ocfs2/dlm/dlmmaster.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmmaster.c	2005-06-24 23:00:06 UTC (rev 2429)
+++ trunk/fs/ocfs2/dlm/dlmmaster.c	2005-06-25 00:12:28 UTC (rev 2430)
@@ -274,14 +274,14 @@
 	mle->new_master = O2NM_MAX_NODES;
 
 	if (mle->type == DLM_MLE_MASTER) {
-		DLM_ASSERT(res);
+		BUG_ON(!res);
 		mle->u.res = res;
 	} else if (mle->type == DLM_MLE_BLOCK) {
-		DLM_ASSERT(name);
+		BUG_ON(!name);
 		memcpy(mle->u.name.name, name, namelen);
 		mle->u.name.len = namelen;
 	} else /* DLM_MLE_MIGRATION */ {
-		DLM_ASSERT(name);
+		BUG_ON(!name);
 		memcpy(mle->u.name.name, name, namelen);
 		mle->u.name.len = namelen;
 	}
@@ -717,7 +717,7 @@
 	
 	mlog(0, "lockres mastered by %u\n", res->owner);
 	/* make sure we never continue without this */
-	DLM_ASSERT(res->owner != O2NM_MAX_NODES);
+	BUG_ON(res->owner == O2NM_MAX_NODES);
 
 	/* master is known, detach if not already detached */
 	dlm_mle_detach_hb_events(dlm, mle);
@@ -1035,7 +1035,7 @@
 	memset(&request, 0, sizeof(request));
 	request.node_idx = dlm->node_num;
 
-	DLM_ASSERT(mle->type != DLM_MLE_MIGRATION);
+	BUG_ON(mle->type == DLM_MLE_MIGRATION);
 
 	if (mle->type == DLM_MLE_BLOCK) {
 		request.namelen = mle->u.name.len;
@@ -1338,7 +1338,7 @@
 	dlm_node_iter iter;
 	int ret = 0;
 
-	DLM_ASSERT(namelen <= O2NM_MAX_NAME_LEN);
+	BUG_ON(namelen > O2NM_MAX_NAME_LEN);
 
 	/* note that if this nodemap is empty, it returns 0 */
 	dlm_node_iter_init(nodemap, &iter);
@@ -1446,7 +1446,7 @@
 	res = __dlm_lookup_lockres(dlm, name, namelen);
 	if (res) {
 		spin_lock(&res->spinlock);
-		DLM_ASSERT(!(res->state & DLM_LOCK_RES_RECOVERING));
+		BUG_ON(res->state & DLM_LOCK_RES_RECOVERING);
 		if (!mle) {
 			if (res->owner != assert->node_idx) {
 				mlog(ML_ERROR, "assert_master from "
@@ -1864,7 +1864,7 @@
 	/* need to set MIGRATING flag on lockres.  this is done by 
 	 * ensuring that all asts have been flushed for this lockres. */
 	spin_lock(&res->spinlock);
-	DLM_ASSERT(!(res->migration_pending));
+	BUG_ON(res->migration_pending);
 	res->migration_pending = 1;
 	/* strategy is to reserve an extra ast then release 
 	 * it below, letting the release do all of the work */
@@ -1904,7 +1904,7 @@
 
 	assert_spin_locked(&res->spinlock);
 
-	DLM_ASSERT(res->owner != dlm->node_num);
+	BUG_ON(res->owner == dlm->node_num);
 
 	for (i=0; i<3; i++) {
 		list_for_each_safe(iter, iter2, queue) {
@@ -1913,10 +1913,10 @@
 				mlog(0, "putting lock for node %u\n",
 				     lock->ml.node);
 				/* be extra careful */
-				DLM_ASSERT(list_empty(&lock->ast_list));
-				DLM_ASSERT(list_empty(&lock->bast_list));
-				DLM_ASSERT(!lock->ast_pending);
-				DLM_ASSERT(!lock->bast_pending);
+				BUG_ON(!list_empty(&lock->ast_list));
+				BUG_ON(!list_empty(&lock->bast_list));
+				BUG_ON(lock->ast_pending);
+				BUG_ON(lock->bast_pending);
 				list_del_init(&lock->list);
 				dlm_lock_put(lock);
 			}
@@ -2184,9 +2184,9 @@
 	list_for_each_safe(iter, iter2, &dlm->master_list) {
 		mle = list_entry(iter, dlm_master_list_entry, list);
 		
-		DLM_ASSERT((mle->type == DLM_MLE_BLOCK) ||
-			   (mle->type == DLM_MLE_MASTER) ||
-			   (mle->type == DLM_MLE_MIGRATION));
+		BUG_ON(mle->type != DLM_MLE_BLOCK &&
+		       mle->type != DLM_MLE_MASTER &&
+		       mle->type != DLM_MLE_MIGRATION);
 
 		/* MASTER mles are initiated locally.  the waiting
 		 * process will notice the node map change
@@ -2356,7 +2356,7 @@
 void __dlm_lockres_reserve_ast(dlm_lock_resource *res)
 {
 	assert_spin_locked(&res->spinlock);
-	DLM_ASSERT(!(res->state & DLM_LOCK_RES_MIGRATING));
+	BUG_ON(res->state & DLM_LOCK_RES_MIGRATING);
 
 	atomic_inc(&res->asts_reserved);
 }
@@ -2384,7 +2384,7 @@
 		return;
 	}
 
-	DLM_ASSERT(!(res->state & DLM_LOCK_RES_MIGRATING));
+	BUG_ON(res->state & DLM_LOCK_RES_MIGRATING);
 	res->migration_pending = 0;
 	res->state |= DLM_LOCK_RES_MIGRATING;
 	spin_unlock(&res->spinlock);

Modified: trunk/fs/ocfs2/dlm/dlmrecovery.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmrecovery.c	2005-06-24 23:00:06 UTC (rev 2429)
+++ trunk/fs/ocfs2/dlm/dlmrecovery.c	2005-06-25 00:12:28 UTC (rev 2430)
@@ -143,7 +143,7 @@
 
 		/* already have ref on dlm to avoid having
 		 * it disappear.  just double-check. */
-		DLM_ASSERT(item->dlm == dlm);
+		BUG_ON(item->dlm != dlm);
 	
 		/* this is allowed to sleep and
 		 * call network stuff */
@@ -399,7 +399,7 @@
 	 * process is the only one to change the list */
 	list_for_each(iter, &dlm->reco.node_data) {
 		ndata = list_entry (iter, dlm_reco_node_data, list);
-		DLM_ASSERT(ndata->state == DLM_RECO_NODE_DATA_INIT);
+		BUG_ON(ndata->state != DLM_RECO_NODE_DATA_INIT);
 		ndata->state = DLM_RECO_NODE_DATA_REQUESTING;
 
 		mlog(0, "requesting lock info from node %u\n", 
@@ -420,7 +420,7 @@
 			case DLM_RECO_NODE_DATA_INIT:
 			case DLM_RECO_NODE_DATA_FINALIZE_SENT:
 			case DLM_RECO_NODE_DATA_REQUESTED:
-				DLM_ASSERT(0);
+				BUG();
 				break;
 			case DLM_RECO_NODE_DATA_DEAD:
 				mlog(0, "node %u died after requesting "
@@ -555,7 +555,7 @@
 		if (num >= O2NM_MAX_NODES) {
 			break;
 		}
-		DLM_ASSERT(num != dead_node);
+		BUG_ON(num == dead_node);
 
 		ndata = kcalloc(1, sizeof(*ndata), GFP_KERNEL);
 		if (!ndata) {
@@ -630,7 +630,7 @@
 		return -EINVAL;
 
 	dlm_lock_request_to_host(lr);
-	DLM_ASSERT(lr->dead_node == dlm->reco.dead_node);
+	BUG_ON(lr->dead_node != dlm->reco.dead_node);
 
 	item = kcalloc(1, sizeof(*item), GFP_KERNEL);
 	if (!item) {
@@ -673,8 +673,8 @@
 	dlm = item->dlm;
 	dead_node = item->u.ral.dead_node;
 	reco_master = item->u.ral.reco_master;
-	DLM_ASSERT(dead_node == dlm->reco.dead_node);
-	DLM_ASSERT(reco_master == dlm->reco.new_master);
+	BUG_ON(dead_node != dlm->reco.dead_node);
+	BUG_ON(reco_master != dlm->reco.new_master);
 	
 	mres = (dlm_migratable_lockres *)data;
 
@@ -744,7 +744,7 @@
 	mlog(0, "got DATA DONE: dead_node=%u, reco.dead_node=%u, "
 	     "node_idx=%u, this node=%u\n", done->dead_node, 
 	     dlm->reco.dead_node, done->node_idx, dlm->node_num);
-	DLM_ASSERT(done->dead_node == dlm->reco.dead_node);
+	BUG_ON(done->dead_node != dlm->reco.dead_node);
 
 	spin_lock(&dlm_reco_state_lock);
 	list_for_each(iter, &dlm->reco.node_data) {
@@ -844,7 +844,7 @@
 	u8 orig_flags = mres->flags, 
 	   orig_master = mres->master;
 
-	DLM_ASSERT(mres->num_locks <= DLM_MAX_MIGRATABLE_LOCKS);
+	BUG_ON(mres->num_locks > DLM_MAX_MIGRATABLE_LOCKS);
 	if (!mres->num_locks)
 		return 0;
 
@@ -853,7 +853,7 @@
 
 	/* add an all-done flag if we reached the last lock */ 
 	orig_flags = mres->flags;
-	DLM_ASSERT(total_locks <= mres_total_locks);
+	BUG_ON(total_locks > mres_total_locks);
 	if (total_locks == mres_total_locks)
 		mres->flags |= DLM_MRES_ALL_DONE;
 
@@ -926,8 +926,8 @@
 			 * this means this node had a pending LVB change
 			 * when the master died.  we should send his lvb
 			 * over and attach it to the lksb on the other side */
-			DLM_ASSERT(ml->type == LKM_EXMODE);
-			DLM_ASSERT(mres->lvb[0] == 0);
+			BUG_ON(ml->type != LKM_EXMODE);
+			BUG_ON(mres->lvb[0] != 0);
 			memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN);
 		}
 	}
@@ -950,7 +950,7 @@
 	dlm_lock *lock;
 	int ret = 0;
 
-	DLM_ASSERT(flags & (DLM_MRES_RECOVERY|DLM_MRES_MIGRATION));
+	BUG_ON(!(flags & (DLM_MRES_RECOVERY|DLM_MRES_MIGRATION)));
 
 	mlog(0, "sending to %u\n", send_to);
 
@@ -1031,12 +1031,12 @@
 	
 	dlm_migratable_lockres_to_host(mres);
 	
-	DLM_ASSERT(mres->flags & (DLM_MRES_RECOVERY|DLM_MRES_MIGRATION));
+	BUG_ON(!(mres->flags & (DLM_MRES_RECOVERY|DLM_MRES_MIGRATION)));
 
 	real_master = mres->master;
 	if (real_master == DLM_LOCK_RES_OWNER_UNKNOWN) {
 		/* cannot migrate a lockres with no master */	
-		DLM_ASSERT(mres->flags & DLM_MRES_RECOVERY);
+		BUG_ON(!(mres->flags & DLM_MRES_RECOVERY));
 	}
 
 	mlog(0, "%s message received from node %u\n", 
@@ -1108,7 +1108,7 @@
 	ret = 0;
 	if (mres->master == DLM_LOCK_RES_OWNER_UNKNOWN) {
 		/* migration cannot have an unknown master */
-		DLM_ASSERT(mres->flags & DLM_MRES_RECOVERY);
+		BUG_ON(!(mres->flags & DLM_MRES_RECOVERY));
 		mlog(0, "recovery has passed me a lockres with an "
 			  "unknown owner.. will need to requery: "
 			  "%.*s\n", mres->lockname_len, mres->lockname);
@@ -1271,8 +1271,8 @@
 	if (ret < 0)
 		mlog_errno(ret);
 	else {
-		DLM_ASSERT(status >= 0);
-		DLM_ASSERT(status <= DLM_LOCK_RES_OWNER_UNKNOWN);
+		BUG_ON(status < 0);
+		BUG_ON(status > DLM_LOCK_RES_OWNER_UNKNOWN);
 		*real_master = (u8) (status & 0xff);
 		mlog(0, "node %u responded to master requery with %u\n",
 			  nodenum, *real_master);
@@ -1327,8 +1327,8 @@
 							 int list_num)
 {
 	struct list_head *ret;
-	DLM_ASSERT(list_num >= 0);
-	DLM_ASSERT(list_num <= 2);
+	BUG_ON(list_num < 0);
+	BUG_ON(list_num > 2);
 	ret = &(res->granted);
 	ret += list_num;
 	return ret;
@@ -1375,7 +1375,7 @@
 	mlog(0, "running %d locks for this lockres\n", mres->num_locks);
 	for (i=0; i<mres->num_locks; i++) {
 		ml = &(mres->ml[i]);
-		DLM_ASSERT(ml->highest_blocked == LKM_IVMODE);
+		BUG_ON(ml->highest_blocked != LKM_IVMODE);
 		newlock = NULL;
 		lksb = NULL;
 		
@@ -1386,7 +1386,7 @@
 		 * do not allocate a new lock structure. */
 		if (ml->node == dlm->node_num) {
 			/* MIGRATION ONLY! */
-			DLM_ASSERT(mres->flags & DLM_MRES_MIGRATION);
+			BUG_ON(!(mres->flags & DLM_MRES_MIGRATION));
 			
 			spin_lock(&res->spinlock);
 			list_for_each(iter, queue) {
@@ -1405,7 +1405,7 @@
 				     ml->cookie);
 				BUG();
 			}
-			DLM_ASSERT(lock->ml.node == ml->node);
+			BUG_ON(lock->ml.node != ml->node);
 			
 			/* see NOTE above about why we do not update 
 			 * to match the master here */
@@ -1430,7 +1430,7 @@
 		dlm_lock_attach_lockres(newlock, res);
 		
 		if (ml->convert_type != LKM_IVMODE) {
-			DLM_ASSERT(queue == &res->converting);
+			BUG_ON(queue != &res->converting);
 			newlock->ml.convert_type = ml->convert_type;
 		}
 		lksb->flags |= (ml->flags & 

Modified: trunk/fs/ocfs2/dlm/dlmthread.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmthread.c	2005-06-24 23:00:06 UTC (rev 2429)
+++ trunk/fs/ocfs2/dlm/dlmthread.c	2005-06-25 00:12:28 UTC (rev 2430)
@@ -269,9 +269,9 @@
 	 * recovering/in-progress, it is fine to reserve asts and
 	 * basts right before queueing them all throughout */
 	assert_spin_locked(&res->spinlock);
-	DLM_ASSERT(!(res->state & (DLM_LOCK_RES_MIGRATING|
-				   DLM_LOCK_RES_RECOVERING|
-				   DLM_LOCK_RES_IN_PROGRESS)));
+	BUG_ON((res->state & (DLM_LOCK_RES_MIGRATING|
+			      DLM_LOCK_RES_RECOVERING|
+			      DLM_LOCK_RES_IN_PROGRESS)));
 
 converting:
 	if (list_empty(&res->converting))
@@ -325,7 +325,7 @@
 	/* we can convert the lock */
 	if (can_grant) {
 		spin_lock(&target->spinlock);
-		DLM_ASSERT(target->ml.highest_blocked == LKM_IVMODE);	
+		BUG_ON(target->ml.highest_blocked != LKM_IVMODE);	
 		
 		mlog(0, "calling ast for converting lock: %.*s, have: %d, "
 		     "granting: %d, node: %u\n", res->lockname.len, 
@@ -337,7 +337,7 @@
 		list_del_init(&target->list);
 		list_add_tail(&target->list, &res->granted);
 
-		DLM_ASSERT(target->lksb);
+		BUG_ON(!target->lksb);
 		target->lksb->status = DLM_NORMAL;
 
 		spin_unlock(&target->spinlock);
@@ -389,7 +389,7 @@
 	 * possible if converting list empty) */
 	if (can_grant) {
 		spin_lock(&target->spinlock);
-		DLM_ASSERT(target->ml.highest_blocked == LKM_IVMODE);
+		BUG_ON(target->ml.highest_blocked != LKM_IVMODE);
 		
 		mlog(0, "calling ast for blocked lock: %.*s, granting: %d, "
 		     "node: %u\n", res->lockname.len, res->lockname.name, 
@@ -399,7 +399,7 @@
 		list_del_init(&target->list);
 		list_add_tail(&target->list, &res->granted);
 
-		DLM_ASSERT(target->lksb);
+		BUG_ON(!target->lksb);
 		target->lksb->status = DLM_NORMAL;
 		
 		spin_unlock(&target->spinlock);
@@ -511,7 +511,7 @@
 		res = lock->lockres;
 		mlog(0, "delivering an ast for this lockres\n");
 
-		DLM_ASSERT(lock->ast_pending);
+		BUG_ON(!lock->ast_pending);
 
 		/* remove from list (including ref) */
 		list_del_init(&lock->ast_list);
@@ -549,11 +549,11 @@
 		dlm_lock_get(lock);
 		res = lock->lockres;
 
-		DLM_ASSERT(lock->bast_pending);
+		BUG_ON(!lock->bast_pending);
 
 		/* get the highest blocked lock, and reset */
 		spin_lock(&lock->spinlock);
-		DLM_ASSERT(lock->ml.highest_blocked > LKM_IVMODE);
+		BUG_ON(lock->ml.highest_blocked <= LKM_IVMODE);
 		hi = lock->ml.highest_blocked;
 		lock->ml.highest_blocked = LKM_IVMODE;
 		spin_unlock(&lock->spinlock);
@@ -629,7 +629,7 @@
 		
 			/* peel a lockres off, remove it from the list,
 			 * unset the dirty flag and drop the dlm lock */
-			DLM_ASSERT(res);
+			BUG_ON(!res);
 			dlm_lockres_get(res);
 			
 			spin_lock(&res->spinlock);
@@ -642,7 +642,7 @@
 			 * dirty_list in this gap, but that is ok */
 
 			spin_lock(&res->spinlock);
-			DLM_ASSERT(res->owner == dlm->node_num);
+			BUG_ON(res->owner != dlm->node_num);
 			
 			/* it is now ok to move lockreses in these states
 			 * to the dirty list, assuming that they will only be

Modified: trunk/fs/ocfs2/dlm/dlmunlock.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmunlock.c	2005-06-24 23:00:06 UTC (rev 2429)
+++ trunk/fs/ocfs2/dlm/dlmunlock.c	2005-06-25 00:12:28 UTC (rev 2430)
@@ -106,9 +106,9 @@
 	     flags & LKM_VALBLK);
 
 	if (master_node)
-		DLM_ASSERT(res->owner == dlm->node_num);
+		BUG_ON(res->owner != dlm->node_num);
 	else
-		DLM_ASSERT(res->owner != dlm->node_num);
+		BUG_ON(res->owner == dlm->node_num);
 
 	spin_lock(&dlm->spinlock);
 	/* We want to be sure that we're not freeing a lock
@@ -205,9 +205,9 @@
 leave:
 	res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
 	if (!dlm_lock_on_list(&res->converting, lock))
-		DLM_ASSERT(lock->ml.convert_type == LKM_IVMODE);
+		BUG_ON(lock->ml.convert_type != LKM_IVMODE);
 	else 
-		DLM_ASSERT(lock->ml.convert_type != LKM_IVMODE);
+		BUG_ON(lock->ml.convert_type == LKM_IVMODE);
 	spin_unlock(&lock->spinlock);
 	spin_unlock(&res->spinlock);
 	wake_up(&res->wq);
@@ -215,7 +215,7 @@
 	/* let the caller's final dlm_lock_put handle the actual kfree */
 	if (actions & DLM_UNLOCK_FREE_LOCK) {
 		/* this should always be coupled with list removal */
-		DLM_ASSERT(actions & DLM_UNLOCK_REMOVE_LOCK);
+		BUG_ON(!(actions & DLM_UNLOCK_REMOVE_LOCK));
 		mlog(0, "lock %"MLFu64" should be gone now! refs=%d\n",
 		     lock->ml.cookie, atomic_read(&lock->lock_refs.refcount)-1);
 		dlm_lock_put(lock);
@@ -567,11 +567,11 @@
 		return DLM_BADPARAM;
 
 	lock = lksb->lockid;
-	DLM_ASSERT(lock);
+	BUG_ON(!lock);
 	dlm_lock_get(lock);
 
 	res = lock->lockres;
-	DLM_ASSERT(res);
+	BUG_ON(!res);
 	dlm_lockres_get(res);
 retry:
 	call_ast = 0;



More information about the Ocfs2-commits mailing list