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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Feb 28 19:22:21 CST 2005


Author: khackel
Signed-off-by: mfasheh
Date: 2005-02-28 19:22:20 -0600 (Mon, 28 Feb 2005)
New Revision: 1924

Modified:
   trunk/fs/ocfs2/dlm/dlmast.c
   trunk/fs/ocfs2/dlm/dlmconvert.c
   trunk/fs/ocfs2/dlm/dlmlock.c
   trunk/fs/ocfs2/dlm/dlmmod.c
   trunk/fs/ocfs2/dlm/dlmmod.h
   trunk/fs/ocfs2/dlm/dlmrecovery.c
   trunk/fs/ocfs2/dlm/dlmthread.c
   trunk/fs/ocfs2/dlm/dlmunlock.c
Log:
* Merged 1912:1913 from dlm-reco-mig branch:
	- [1912] added node iterator, flags cleanup
	- [1913] dlm_migratable_lock substructure

Signed-off-by: mfasheh


Modified: trunk/fs/ocfs2/dlm/dlmast.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmast.c	2005-03-01 00:23:12 UTC (rev 1923)
+++ trunk/fs/ocfs2/dlm/dlmast.c	2005-03-01 01:22:20 UTC (rev 1924)
@@ -72,19 +72,19 @@
 		/* this node is the lockres master */
 		if (lksb->flags & DLM_LKSB_GET_LVB) {
 			dlmprintk("getting lvb from lockres for %s node\n",
-				  lock->node == dlm->group_index ? "master" :
+				  lock->ml.node == dlm->group_index ? "master" :
 				  "remote");
 			memcpy(lksb->lvb, res->lvb, DLM_LVB_LEN);
 		} else if (lksb->flags & DLM_LKSB_PUT_LVB) {
 			dlmprintk("setting lvb from lockres for %s node\n",
-				  lock->node == dlm->group_index ? "master" :
+				  lock->ml.node == dlm->group_index ? "master" :
 				  "remote");
 			memcpy(res->lvb, lksb->lvb, DLM_LVB_LEN);
 		}
 	}
 
 	ret = 0;
-	if (lock->node != dlm->group_index) {
+	if (lock->ml.node != dlm->group_index) {
 		/* lock request came from another node
 		 * go do the ast over there */
 		ret = dlm_send_proxy_ast(dlm, res, lock, DLM_AST, 0);
@@ -107,7 +107,7 @@
 
 	dlmprintk0("\n");
 
-	if (lock->node != dlm->group_index) {
+	if (lock->ml.node != dlm->group_index) {
 		ret = dlm_send_proxy_ast(dlm, res, lock, 
 					 DLM_BAST, blocked_type);
 		goto leave;
@@ -115,7 +115,7 @@
 
 	if (!fn) {
 		dlmprintk("eek! lock has no bast %.*s!  cookie=%llu\n", 
-		       res->lockname.len, res->lockname.name, lock->cookie);
+		       res->lockname.len, res->lockname.name, lock->ml.cookie);
 		ret = -EINVAL;
 		goto leave;
 	}
@@ -195,7 +195,7 @@
 	lock = NULL;
 	list_for_each(iter, head) {
 		lock = list_entry (iter, dlm_lock, list);
-		if (lock->cookie == cookie)
+		if (lock->ml.cookie == cookie)
 			goto do_ast;
 	}
 
@@ -207,7 +207,7 @@
 
 	list_for_each(iter, head) {
 		lock = list_entry (iter, dlm_lock, list);
-		if (lock->cookie == cookie)
+		if (lock->ml.cookie == cookie)
 			goto do_ast;
 	}
 
@@ -227,10 +227,10 @@
 		list_del(&lock->list);
 		list_add_tail(&lock->list, &res->granted);
 		dlmprintk("ast: adding to granted list... type=%d, "
-			  "convert_type=%d\n", lock->type, lock->convert_type);
-		if (lock->convert_type != LKM_IVMODE) {
-			lock->type = lock->convert_type;
-			lock->convert_type = LKM_IVMODE;
+			  "convert_type=%d\n", lock->ml.type, lock->ml.convert_type);
+		if (lock->ml.convert_type != LKM_IVMODE) {
+			lock->ml.type = lock->ml.convert_type;
+			lock->ml.convert_type = LKM_IVMODE;
 		} else {
 			// should already be there....
 		}
@@ -244,13 +244,13 @@
 		}
 		status = dlm_do_ast(dlm, res, lock);
 		dlmprintk("ast done: now... type=%d, convert_type=%d\n",
-			  lock->type, lock->convert_type);
+			  lock->ml.type, lock->ml.convert_type);
 	} else {
 		dlmprintk("bast: before... type=%d, convert_type=%d\n",
-			  lock->type, lock->convert_type);
+			  lock->ml.type, lock->ml.convert_type);
 		status = dlm_do_bast(dlm, res, lock, past->blocked_type);
 		dlmprintk("bast: after... type=%d, convert_type=%d\n",
-			  lock->type, lock->convert_type);
+			  lock->ml.type, lock->ml.convert_type);
 	}
 
 	if (status < 0)
@@ -279,7 +279,7 @@
 	size_t iovlen = 1;
 
 	dlmprintk("res %.*s, to=%u, type=%d, blocked_type=%d\n",
-		  res->lockname.len, res->lockname.name, lock->node, 
+		  res->lockname.len, res->lockname.name, lock->ml.node, 
 		  type, blocked_type);
 
 	memset(&past, 0, sizeof(dlm_proxy_ast));
@@ -288,7 +288,7 @@
 	past.blocked_type = blocked_type;
 	past.namelen = res->lockname.len;
 	strncpy(past.name, res->lockname.name, past.namelen);
-	past.cookie = lock->cookie;
+	past.cookie = lock->ml.cookie;
 
 	iov[0].iov_len = sizeof(dlm_proxy_ast);
 	iov[0].iov_base = &past;
@@ -301,7 +301,7 @@
 	}
 
 	ret = -EINVAL;
-	inode = nm_get_group_node_by_index(dlm->group, lock->node);
+	inode = nm_get_group_node_by_index(dlm->group, lock->ml.node);
 	if (inode) {
 		dlm_proxy_ast_to_net(&past);
 		ret = net_send_message_iov(DLM_PROXY_AST_MSG, dlm->key, 

Modified: trunk/fs/ocfs2/dlm/dlmconvert.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmconvert.c	2005-03-01 00:23:12 UTC (rev 1923)
+++ trunk/fs/ocfs2/dlm/dlmconvert.c	2005-03-01 01:22:20 UTC (rev 1924)
@@ -110,13 +110,13 @@
 	struct list_head *iter;
 	dlm_lock *tmplock=NULL;
 
-	dlmprintk("type=%d, convert_type=%d, new convert_type=%d\n", lock->type,
-		  lock->convert_type, type);
+	dlmprintk("type=%d, convert_type=%d, new convert_type=%d\n", lock->ml.type,
+		  lock->ml.convert_type, type);
 
 	spin_lock(&lock->spinlock);
 
 	/* already converting? */
-	if (lock->convert_type != LKM_IVMODE) {
+	if (lock->ml.convert_type != LKM_IVMODE) {
 		dlmprintk0("attempted to convert a lock with a lock conversion "
 			   "pending\n");
 		status = DLM_DENIED;
@@ -131,11 +131,11 @@
 	}
 
 	if (flags & LKM_VALBLK) {
-		switch (lock->type) {
+		switch (lock->ml.type) {
 			case LKM_EXMODE:
 				/* EX + LKM_VALBLK + convert == set lvb */
 				dlmprintk("will set lvb: converting %s->%s\n",
-					dlm_lock_mode_name(lock->type), 
+					dlm_lock_mode_name(lock->ml.type), 
 					dlm_lock_mode_name(type));
 				lock->lksb->flags |= DLM_LKSB_PUT_LVB;
 				break;
@@ -145,14 +145,14 @@
 				if (type > LKM_NLMODE) {
 					dlmprintk("will fetch new value into "
 						  "lvb: converting %s->%s\n",
-						dlm_lock_mode_name(lock->type),
+						dlm_lock_mode_name(lock->ml.type),
 					       	dlm_lock_mode_name(type));
 					lock->lksb->flags |= DLM_LKSB_GET_LVB;
 				} else {
 					dlmprintk("will NOT fetch new value "
 						  "into lvb: converting "
 						  "%s->%s\n",
-						dlm_lock_mode_name(lock->type),
+						dlm_lock_mode_name(lock->ml.type),
 					       	dlm_lock_mode_name(type));
 					flags &= ~(LKM_VALBLK);
 				}
@@ -162,7 +162,7 @@
 
 	
 	/* in-place downconvert? */
-	if (type <= lock->type)
+	if (type <= lock->ml.type)
 		goto grant;
 
 	/* upconvert from here on */
@@ -171,16 +171,16 @@
 		tmplock = list_entry(iter, dlm_lock, list);
 		if (tmplock == lock)
 			continue;
-		if (!dlm_lock_compatible(tmplock->type, type))
+		if (!dlm_lock_compatible(tmplock->ml.type, type))
 			goto switch_queues;
 	}
 
 	list_for_each(iter, &res->converting) {
 		tmplock = list_entry(iter, dlm_lock, list);
-		if (!dlm_lock_compatible(tmplock->type, type))
+		if (!dlm_lock_compatible(tmplock->ml.type, type))
 			goto switch_queues;
 		/* existing conversion requests take precedence */
-		if (!dlm_lock_compatible(tmplock->convert_type, type))
+		if (!dlm_lock_compatible(tmplock->ml.convert_type, type))
 			goto switch_queues;
 	}
 
@@ -191,9 +191,9 @@
 		  res->lockname.name, dlm_lock_mode_name(type));
 	/* immediately grant the new lock type */
 	lock->lksb->status = DLM_NORMAL;
-	if (lock->node == dlm->group_index)
+	if (lock->ml.node == dlm->group_index)
 		dlmprintk0("doing in-place convert for nonlocal lock\n");
-	lock->type = type;
+	lock->ml.type = type;
 	status = DLM_NORMAL;
 	*call_ast = 1;
 	goto unlock_exit;
@@ -202,14 +202,14 @@
 	if (flags & LKM_NOQUEUE) {
 		dlmprintk("failed to convert NOQUEUE lock %.*s from "
 			  "%d to %d...\n", res->lockname.len, 
-			  res->lockname.name, lock->type, type);
+			  res->lockname.name, lock->ml.type, type);
 		status = DLM_NOTQUEUED;
 		goto unlock_exit;
 	}
 	dlmprintk("res %.*s, queueing...\n", res->lockname.len,
 		  res->lockname.name);
 
-	lock->convert_type = type;
+	lock->ml.convert_type = type;
 	list_del(&lock->list);
 	list_add_tail(&lock->list, &res->converting);
 
@@ -232,8 +232,8 @@
 {
 	dlm_status status;
 	
-	dlmprintk("type=%d, convert_type=%d, busy=%d\n", lock->type, 
-		  lock->convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS);
+	dlmprintk("type=%d, convert_type=%d, busy=%d\n", lock->ml.type, 
+		  lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS);
 	
 	spin_lock(&res->spinlock);
 	if (res->state & DLM_LOCK_RES_RECOVERING) {
@@ -248,20 +248,20 @@
 	/* move lock to local convert queue */
 	list_del(&lock->list);
 	list_add_tail(&lock->list, &res->converting);
-	if (lock->convert_type != LKM_IVMODE) {
+	if (lock->ml.convert_type != LKM_IVMODE) {
 		dlmprintk0("error! converting a remote lock that is already "
 			   "converting!\n");
 		/* TODO: return correct error */
 		BUG();
 	}
-	lock->convert_type = type;
+	lock->ml.convert_type = type;
 
 	if (flags & LKM_VALBLK) {
-		if (lock->type == LKM_EXMODE) {
+		if (lock->ml.type == LKM_EXMODE) {
 			flags |= LKM_PUT_LVB;
 			lock->lksb->flags |= DLM_LKSB_PUT_LVB;
 		} else {
-			if (lock->convert_type == LKM_NLMODE) {
+			if (lock->ml.convert_type == LKM_NLMODE) {
 				dlmprintk0("erm, no point in specifying "
 					   "LKM_VALBLK if converting to NL\n");
 				flags &= ~LKM_VALBLK;
@@ -284,7 +284,7 @@
 	if (status != DLM_NORMAL) {
 		list_del(&lock->list);
 		list_add_tail(&lock->list, &res->granted);
-		lock->convert_type = LKM_IVMODE;
+		lock->ml.convert_type = LKM_IVMODE;
 		lock->lksb->flags &= ~(DLM_LKSB_GET_LVB|DLM_LKSB_PUT_LVB);
 	}
 bail:
@@ -321,7 +321,7 @@
 	memset(&convert, 0, sizeof(dlm_convert_lock));
 	convert.node_idx = dlm->group_index;
 	convert.requested_type = type;
-	convert.cookie = lock->cookie;
+	convert.cookie = lock->ml.cookie;
 	convert.namelen = res->lockname.len;
 	convert.flags = flags;
 	strncpy(convert.name, res->lockname.name, convert.namelen);
@@ -408,8 +408,8 @@
 	spin_lock(&res->spinlock);
 	list_for_each(iter, &res->granted) {
 		lock = list_entry(iter, dlm_lock, list);
-		if (lock->cookie == cnv->cookie &&
-		    lock->node == cnv->node_idx) {
+		if (lock->ml.cookie == cnv->cookie &&
+		    lock->ml.node == cnv->node_idx) {
 			found = 1;
 			break;
 		}

Modified: trunk/fs/ocfs2/dlm/dlmlock.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmlock.c	2005-03-01 00:23:12 UTC (rev 1923)
+++ trunk/fs/ocfs2/dlm/dlmlock.c	2005-03-01 01:22:20 UTC (rev 1924)
@@ -70,14 +70,14 @@
 	list_for_each(iter, &res->granted) {
 		tmplock = list_entry(iter, dlm_lock, list);
 
-		if (!dlm_lock_compatible(tmplock->type, lock->type))
+		if (!dlm_lock_compatible(tmplock->ml.type, lock->ml.type))
 			return 0;
 	}
 
 	list_for_each(iter, &res->converting) {
 		tmplock = list_entry(iter, dlm_lock, list);
 
-		if (!dlm_lock_compatible(tmplock->type, lock->type))
+		if (!dlm_lock_compatible(tmplock->ml.type, lock->ml.type))
 			return 0;
 	}
 
@@ -102,7 +102,7 @@
 	DLM_ASSERT(dlm);
 	DLM_ASSERT(lock->lksb);
 
-	dlmprintk("type=%d\n", lock->type);
+	dlmprintk("type=%d\n", lock->ml.type);
 
 	spin_lock(&res->spinlock);
 	__dlm_wait_on_lockres(res);
@@ -147,7 +147,7 @@
 {
 	dlm_status status = DLM_DENIED;
 
-	dlmprintk("type=%d\n", lock->type);
+	dlmprintk("type=%d\n", lock->ml.type);
 	dlmprintk("lockres %.*s, flags = 0x%x\n", res->lockname.len,
 		  res->lockname.name, flags);
 
@@ -202,8 +202,8 @@
 
 	memset(&create, 0, sizeof(create));
 	create.node_idx = dlm->group_index;
-	create.requested_type = lock->type;
-	create.cookie = lock->cookie;
+	create.requested_type = lock->ml.type;
+	create.cookie = lock->ml.cookie;
 	create.namelen = res->lockname.len;
 	create.flags = flags;
 	strncpy(create.name, res->lockname.name, create.namelen);
@@ -229,6 +229,22 @@
 	return ret;
 }
 
+void dlm_init_lock(dlm_lock *newlock, int type, u8 node, u64 cookie)
+{
+	memset(newlock, 0, sizeof(dlm_lock));
+	INIT_LIST_HEAD(&newlock->list);
+	INIT_LIST_HEAD(&newlock->ast_list);
+	spin_lock_init(&newlock->spinlock);
+	newlock->ml.type = type;
+	newlock->ml.convert_type = LKM_IVMODE;
+	newlock->ml.highest_blocked = LKM_IVMODE;
+	newlock->ml.node = node;
+	newlock->ast = NULL;
+	newlock->bast = NULL;
+	newlock->astdata = NULL;
+	newlock->ml.cookie = cookie;
+}
+
 /* handler for lock creation net message
  * locking:
  *   caller needs:  none
@@ -271,20 +287,11 @@
 	if (!lksb)
 		goto leave;
 
-	memset(newlock, 0, sizeof(dlm_lock));
-	INIT_LIST_HEAD(&newlock->list);
-	INIT_LIST_HEAD(&newlock->ast_list);
-	spin_lock_init(&newlock->spinlock);
-	newlock->type = create->requested_type;
-	newlock->convert_type = LKM_IVMODE;
-	newlock->highest_blocked = LKM_IVMODE;
-	newlock->node = create->node_idx;
-	newlock->ast = NULL;
-	newlock->bast = NULL;
-	newlock->astdata = NULL;
-	newlock->cookie = create->cookie;
+	memset(lksb, 0, sizeof(dlm_lockstatus));
 
-	memset(lksb, 0, sizeof(dlm_lockstatus));
+	dlm_init_lock(newlock, create->requested_type, 
+		      create->node_idx, create->cookie);
+
 	newlock->lksb = lksb;
 	lksb->lockid = newlock;
 	lksb->flags |= DLM_LKSB_KERNEL_ALLOCATED;

Modified: trunk/fs/ocfs2/dlm/dlmmod.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmmod.c	2005-03-01 00:23:12 UTC (rev 1923)
+++ trunk/fs/ocfs2/dlm/dlmmod.c	2005-03-01 01:22:20 UTC (rev 1924)
@@ -246,16 +246,16 @@
 		INIT_LIST_HEAD(&lock->ast_list);
 		spin_lock_init(&lock->spinlock);
 		lock->lockres = res;
-		lock->type = mode;
-		lock->convert_type = LKM_IVMODE;
-		lock->highest_blocked = LKM_IVMODE;
-		lock->node = dlm->group_index;
+		lock->ml.type = mode;
+		lock->ml.convert_type = LKM_IVMODE;
+		lock->ml.highest_blocked = LKM_IVMODE;
+		lock->ml.node = dlm->group_index;
 		lock->ast = ast;
 		lock->bast = bast;
 		lock->astdata = data;
 		lock->lksb = lksb;
 
-		dlm_get_next_cookie(lock->node, &lock->cookie);
+		dlm_get_next_cookie(lock->ml.node, &lock->ml.cookie);
 
 		if (flags & LKM_VALBLK) {
 			dlmprintk("LKM_VALBLK passed by caller\n");
@@ -939,9 +939,9 @@
 				lock = list_entry(iter2, dlm_lock, list);
 				spin_lock(&lock->spinlock);
 				dlmprintk("    type=%d, conv=%d, node=%u, "
-					  "cookie=%llu\n", lock->type, 
-					  lock->convert_type, lock->node, 
-					  lock->cookie);
+					  "cookie=%llu\n", lock->ml.type, 
+					  lock->ml.convert_type, lock->ml.node, 
+					  lock->ml.cookie);
 				spin_unlock(&lock->spinlock);
 			}
 			dlmprintk0("  converting queue: \n");
@@ -949,9 +949,9 @@
 				lock = list_entry(iter2, dlm_lock, list);
 				spin_lock(&lock->spinlock);
 				dlmprintk("    type=%d, conv=%d, node=%u, "
-					  "cookie=%llu\n", lock->type, 
-					  lock->convert_type, lock->node, 
-					  lock->cookie);
+					  "cookie=%llu\n", lock->ml.type, 
+					  lock->ml.convert_type, lock->ml.node, 
+					  lock->ml.cookie);
 				spin_unlock(&lock->spinlock);
 			}
 			dlmprintk0("  blocked queue: \n");
@@ -959,9 +959,9 @@
 				lock = list_entry(iter2, dlm_lock, list);
 				spin_lock(&lock->spinlock);
 				dlmprintk("    type=%d, conv=%d, node=%u, "
-					  "cookie=%llu\n", lock->type, 
-					  lock->convert_type, lock->node, 
-					  lock->cookie);
+					  "cookie=%llu\n", lock->ml.type, 
+					  lock->ml.convert_type, lock->ml.node, 
+					  lock->ml.cookie);
 				spin_unlock(&lock->spinlock);
 			}
 			spin_unlock(&res->spinlock);

Modified: trunk/fs/ocfs2/dlm/dlmmod.h
===================================================================
--- trunk/fs/ocfs2/dlm/dlmmod.h	2005-03-01 00:23:12 UTC (rev 1923)
+++ trunk/fs/ocfs2/dlm/dlmmod.h	2005-03-01 01:22:20 UTC (rev 1924)
@@ -249,22 +249,35 @@
 
 typedef struct _dlm_lockstatus dlm_lockstatus;
 
+typedef struct _dlm_migratable_lock
+{
+	u64 cookie;
+
+	/* these 3 are just padding for the in-memory structure, but 
+	 * list and flags are actually used when sent over the wire */ 
+	u16 pad1;
+	u8 list;  // 0=granted, 1=converting, 2=blocked
+	u8 flags; 
+
+	s8 type;
+	s8 convert_type;
+	s8 highest_blocked;
+	u8 node;
+} dlm_migratable_lock;  // 16 bytes
+
 typedef struct _dlm_lock
 {
+	dlm_migratable_lock ml;
+
 	struct list_head list;
 	struct list_head ast_list;
 	dlm_lock_resource *lockres;
 	spinlock_t spinlock;
 
-	s8 type;
-	s8 convert_type;
-	s8 highest_blocked;
-	u8 node;
-
-	dlm_astlockfunc_t *ast;     // ast and bast must be callable while holding a spinlock!
+	// ast and bast must be callable while holding a spinlock!
+	dlm_astlockfunc_t *ast;     
 	dlm_bastlockfunc_t *bast;
 	void *astdata;
-	u64 cookie;
 	dlm_lockstatus *lksb;
 } dlm_lock;
 
@@ -630,6 +643,7 @@
 
 void __dlm_wait_on_lockres(dlm_lock_resource *res);
 
+void dlm_init_lock(dlm_lock *newlock, int type, u8 node, u64 cookie);
 
 
 

Modified: trunk/fs/ocfs2/dlm/dlmrecovery.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmrecovery.c	2005-03-01 00:23:12 UTC (rev 1923)
+++ trunk/fs/ocfs2/dlm/dlmrecovery.c	2005-03-01 01:22:20 UTC (rev 1924)
@@ -706,7 +706,7 @@
 		spin_lock_init(&lock->spinlock);
 		lock->type = info->type;
 		lock->convert_type = info->convert_type;
-		lock->node = dlm->group_index;
+		lock->ml.node = dlm->group_index;
 		//atomic_set(&lock->ast_lock, 0);
 		//atomic_set(&lock->bast_lock, 0);
 		lock->ast = NULL;
@@ -802,21 +802,21 @@
 			} else if (res->owner == dlm->group_index) {
 				list_for_each_safe(iter2, tmpiter, &res->granted) {
 					lock = list_entry (iter2, dlm_lock, list);
-					if (lock->node == dead_node) {
+					if (lock->ml.node == dead_node) {
 						list_del(&lock->list);
 						kfree(lock);
 					}
 				}
 				list_for_each_safe(iter2, tmpiter, &res->converting) {
 					lock = list_entry (iter2, dlm_lock, list);
-					if (lock->node == dead_node) {
+					if (lock->ml.node == dead_node) {
 						list_del(&lock->list);
 						kfree(lock);
 					}
 				}
 				list_for_each_safe(iter2, tmpiter, &res->blocked) {
 					lock = list_entry (iter2, dlm_lock, list);
-					if (lock->node == dead_node) {
+					if (lock->ml.node == dead_node) {
 						list_del(&lock->list);
 						kfree(lock);
 					}

Modified: trunk/fs/ocfs2/dlm/dlmthread.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmthread.c	2005-03-01 00:23:12 UTC (rev 1923)
+++ trunk/fs/ocfs2/dlm/dlmthread.c	2005-03-01 01:22:20 UTC (rev 1924)
@@ -57,7 +57,7 @@
 
 static int dlm_thread(void *data);
 
-#define dlm_lock_is_remote(dlm, lock)     ((lock)->node != (dlm)->group_index)
+#define dlm_lock_is_remote(dlm, lock)     ((lock)->ml.node != (dlm)->group_index)
 
 /*
  * DLM THREAD
@@ -99,7 +99,7 @@
 		  res->lockname.name);
 
 	target = list_entry(res->converting.next, dlm_lock, list);
-	if (target->convert_type == LKM_IVMODE) {
+	if (target->ml.convert_type == LKM_IVMODE) {
 		dlmprintk0("eeek!!! converting a lock with no "
 			   "convert_type!!!!\n");
 		BUG();
@@ -109,11 +109,11 @@
 		lock = list_entry(iter, dlm_lock, list);
 		if (lock==target)
 			continue;
-		if (!dlm_lock_compatible(lock->type, target->convert_type)) {
-			if (lock->highest_blocked == LKM_IVMODE)
+		if (!dlm_lock_compatible(lock->ml.type, target->ml.convert_type)) {
+			if (lock->ml.highest_blocked == LKM_IVMODE)
 				list_add(&lock->ast_list, &bast_list);
-			if (lock->highest_blocked < target->convert_type)
-				lock->highest_blocked = target->convert_type;
+			if (lock->ml.highest_blocked < target->ml.convert_type)
+				lock->ml.highest_blocked = target->ml.convert_type;
 		}
 	}
 	head = &res->converting;
@@ -121,26 +121,26 @@
 		lock = list_entry(iter, dlm_lock, list);
 		if (lock==target)
 			continue;
-		if (!dlm_lock_compatible(lock->type, target->convert_type)) {
-			if (lock->highest_blocked == LKM_IVMODE)
+		if (!dlm_lock_compatible(lock->ml.type, target->ml.convert_type)) {
+			if (lock->ml.highest_blocked == LKM_IVMODE)
 				list_add(&lock->ast_list, &bast_list);
-			if (lock->highest_blocked < target->convert_type)
-				lock->highest_blocked = target->convert_type;
+			if (lock->ml.highest_blocked < target->ml.convert_type)
+				lock->ml.highest_blocked = target->ml.convert_type;
 		}
 	}
 	
 	/* we can convert the lock */
 	if (list_empty(&bast_list)) {
 		spin_lock(&target->spinlock);
-		DLM_ASSERT(target->highest_blocked == LKM_IVMODE);	
+		DLM_ASSERT(target->ml.highest_blocked == LKM_IVMODE);	
 		
 		dlmprintk("calling ast for converting lock: %.*s, have: %d, "
 			  "granting: %d, node: %u\n", res->lockname.len, 
-			  res->lockname.name, target->type, 
-			  target->convert_type, target->node);
+			  res->lockname.name, target->ml.type, 
+			  target->ml.convert_type, target->ml.node);
 
-		target->type = target->convert_type;
-		target->convert_type = LKM_IVMODE;
+		target->ml.type = target->ml.convert_type;
+		target->ml.convert_type = LKM_IVMODE;
 		list_del(&target->list);
 		list_add_tail(&target->list, &res->granted);
 
@@ -166,11 +166,11 @@
 		lock = list_entry(iter, dlm_lock, list);
 		if (lock==target)
 			continue;
-		if (!dlm_lock_compatible(lock->type, target->type)) {
-			if (lock->highest_blocked == LKM_IVMODE)
+		if (!dlm_lock_compatible(lock->ml.type, target->ml.type)) {
+			if (lock->ml.highest_blocked == LKM_IVMODE)
 				list_add(&lock->ast_list, &bast_list);
-			if (lock->highest_blocked < target->type)
-				lock->highest_blocked = target->type;
+			if (lock->ml.highest_blocked < target->ml.type)
+				lock->ml.highest_blocked = target->ml.type;
 		}
 	}
 
@@ -179,11 +179,11 @@
 		lock = list_entry(iter, dlm_lock, list);
 		if (lock==target)
 			continue;
-		if (!dlm_lock_compatible(lock->type, target->type)) {
-			if (lock->highest_blocked == LKM_IVMODE)
+		if (!dlm_lock_compatible(lock->ml.type, target->ml.type)) {
+			if (lock->ml.highest_blocked == LKM_IVMODE)
 				list_add(&lock->ast_list, &bast_list);
-			if (lock->highest_blocked < target->type)
-				lock->highest_blocked = target->type;
+			if (lock->ml.highest_blocked < target->ml.type)
+				lock->ml.highest_blocked = target->ml.type;
 		}
 	}
 	
@@ -191,13 +191,13 @@
 	 * possible if converting list empty) */
 	if (list_empty(&bast_list)) {
 		spin_lock(&target->spinlock);
-		DLM_ASSERT(target->highest_blocked == LKM_IVMODE);
+		DLM_ASSERT(target->ml.highest_blocked == LKM_IVMODE);
 		
 		dlmprintk("calling ast for blocked lock: %.*s, granting: %d, "
 			  "node: %u\n", res->lockname.len, res->lockname.name, 
-			  target->type, target->node);
+			  target->ml.type, target->ml.node);
 
-		// target->type is already correct
+		// target->ml.type is already correct
 		list_del(&target->list);
 		list_add_tail(&target->list, &res->granted);
 
@@ -216,9 +216,9 @@
 	list_for_each_safe(iter, tmpiter, &bast_list) {
 		lock = list_entry(iter, dlm_lock, ast_list);
 		spin_lock(&lock->spinlock);
-		DLM_ASSERT(lock->highest_blocked > LKM_IVMODE);
-		hi = lock->highest_blocked;
-		lock->highest_blocked = LKM_IVMODE;
+		DLM_ASSERT(lock->ml.highest_blocked > LKM_IVMODE);
+		hi = lock->ml.highest_blocked;
+		lock->ml.highest_blocked = LKM_IVMODE;
 		list_del(&lock->ast_list);
 		spin_unlock(&lock->spinlock);
 

Modified: trunk/fs/ocfs2/dlm/dlmunlock.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmunlock.c	2005-03-01 00:23:12 UTC (rev 1923)
+++ trunk/fs/ocfs2/dlm/dlmunlock.c	2005-03-01 01:22:20 UTC (rev 1924)
@@ -202,7 +202,7 @@
 	memset(&unlock, 0, sizeof(unlock));
 	unlock.node_idx = dlm->group_index;
 	unlock.flags = flags;
-	unlock.cookie = lock->cookie;
+	unlock.cookie = lock->ml.cookie;
 	unlock.namelen = res->lockname.len;
 	strncpy(unlock.name, res->lockname.name, unlock.namelen);
 
@@ -299,8 +299,8 @@
 	for (i=0; i<3; i++) {
 		list_for_each(iter, queue) {
 			lock = list_entry(iter, dlm_lock, list);
-			if (lock->cookie == unlock->cookie &&
-		    	    lock->node == unlock->node_idx) {
+			if (lock->ml.cookie == unlock->cookie &&
+		    	    lock->ml.node == unlock->node_idx) {
 				found = 1;
 				break;
 			}



More information about the Ocfs2-commits mailing list