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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Nov 1 16:50:21 CST 2004


Author: mfasheh
Date: 2004-11-01 16:50:19 -0600 (Mon, 01 Nov 2004)
New Revision: 1611

Modified:
   branches/dlm-glue/src/dlmglue.c
Log:
* Allow us to downconvert metadata locks to compatible levels while
  there are still compatible holders



Modified: branches/dlm-glue/src/dlmglue.c
===================================================================
--- branches/dlm-glue/src/dlmglue.c	2004-11-01 22:08:21 UTC (rev 1610)
+++ branches/dlm-glue/src/dlmglue.c	2004-11-01 22:50:19 UTC (rev 1611)
@@ -158,6 +158,9 @@
 				    int new_level,
 				    int lvb);
 static void ocfs2_process_blocked_inode(struct inode *inode);
+static inline int ocfs2_can_downconvert_meta_lock(struct inode *inode,
+						  ocfs2_lock *lock,
+						  int new_level);
 static int ocfs2_process_blocked_meta(struct inode *inode,
 				      int *requeue);
 static int ocfs2_process_blocked_data(struct inode *inode,
@@ -1255,6 +1258,23 @@
 	return status;
 }
 
+static inline int ocfs2_can_downconvert_meta_lock(struct inode *inode,
+						  ocfs2_lock *lock,
+						  int new_level)
+{
+	int ret;
+
+	OCFS_ASSERT(new_level == LKM_NLMODE || new_level == LKM_PRMODE);
+	if (new_level == LKM_PRMODE)
+		ret = !lock->l_ex_holders && 
+			ocfs_inode_fully_checkpointed(inode);
+	else /* Must be NLMODE we're converting to. */
+		ret = !lock->l_ro_holders && !lock->l_ex_holders &&
+			ocfs_inode_fully_checkpointed(inode);
+
+	return ret;
+}
+
 static int ocfs2_process_blocked_meta(struct inode *inode,
 				      int *requeue)
 {
@@ -1273,10 +1293,8 @@
 	OCFS_ASSERT(lock->l_level == LKM_EXMODE || 
 		    lock->l_level == LKM_PRMODE);
 
-	if (!lock->l_ro_holders
-	    && !lock->l_ex_holders
-	    && ocfs_inode_fully_checkpointed(inode)) {
-		new_level = ocfs2_highest_compat_lock_level(lock->l_blocking);
+	new_level = ocfs2_highest_compat_lock_level(lock->l_blocking);
+	if (ocfs2_can_downconvert_meta_lock(inode, lock, new_level)) {
 		if (lock->l_level == LKM_EXMODE) {
 			__ocfs2_stuff_meta_lvb(inode);
 			set_lvb = 1;
@@ -1321,8 +1339,8 @@
 	}
 	/* If it's a PR we're blocking, then only
 	 * requeue if we've got anyone doing write (ex) I/O */
-	if ((lock->l_blocking == LKM_PRMODE) 
-		   && lock->l_ex_holders) {
+	if (lock->l_blocking == LKM_PRMODE &&
+	    lock->l_ex_holders) {
 		spin_unlock(&lockres->lr_lock);
 		*requeue++;
 		return 0;



More information about the Ocfs2-commits mailing list