[Ocfs2-commits] zab commits r1918 - trunk/fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Feb 28 16:26:35 CST 2005
Author: zab
Signed-off-by: mfasheh
Date: 2005-02-28 16:26:34 -0600 (Mon, 28 Feb 2005)
New Revision: 1918
Modified:
trunk/fs/ocfs2/dlmglue.c
Log:
o handle multiple BAST arrival by only asking the vote thread for a down
convert if previously issued ones weren't low enough
Signed-off-by: mfasheh
Modified: trunk/fs/ocfs2/dlmglue.c
===================================================================
--- trunk/fs/ocfs2/dlmglue.c 2005-02-28 21:53:11 UTC (rev 1917)
+++ trunk/fs/ocfs2/dlmglue.c 2005-02-28 22:26:34 UTC (rev 1918)
@@ -181,7 +181,7 @@
static inline void ocfs2_generic_handle_downconvert_action(ocfs2_lock_res *lockres);
static inline void ocfs2_generic_handle_convert_action(ocfs2_lock_res *lockres);
static inline void ocfs2_generic_handle_attach_action(ocfs2_lock_res *lockres);
-static void ocfs2_generic_handle_bast(ocfs2_lock_res *lockres, int level);
+static int ocfs2_generic_handle_bast(ocfs2_lock_res *lockres, int level);
static inline void ocfs2_handle_meta_convert_action(struct inode *inode,
ocfs2_lock_res *lockres);
static void ocfs2_inc_inode_seq(ocfs_super *osb,
@@ -615,17 +615,29 @@
LOG_EXIT();
}
-static void ocfs2_generic_handle_bast(ocfs2_lock_res *lockres, int level)
+static int ocfs2_generic_handle_bast(ocfs2_lock_res *lockres, int level)
{
+ int needs_downconvert = 0;
LOG_ENTRY();
- spin_lock(&lockres->l_lock);
+ assert_spin_locked(&lockres->l_lock);
+
lockres->l_flags |= OCFS2_LOCK_BLOCKED;
- if (level > lockres->l_blocking)
+
+ if (level > lockres->l_blocking) {
+ /* only schedule a downconvert if we haven't already scheduled
+ * one that goes low enough to satisfy the level we're
+ * blocking. this also catches the case where we get
+ * duplicate BASTs */
+ if (ocfs2_highest_compat_lock_level(level) <
+ ocfs2_highest_compat_lock_level(lockres->l_blocking))
+ needs_downconvert = 1;
+
lockres->l_blocking = level;
- spin_unlock(&lockres->l_lock);
+ }
- LOG_EXIT();
+ LOG_EXIT_STATUS(needs_downconvert);
+ return needs_downconvert;
}
static void ocfs2_inode_bast_func(void *opaque, int level)
@@ -633,6 +645,7 @@
ocfs2_lock_res *lockres = opaque;
struct inode *inode;
ocfs_super *osb;
+ int needs_downconvert;
LOG_ENTRY();
@@ -646,13 +659,18 @@
OCFS_ASSERT(level > LKM_NLMODE);
- ocfs2_generic_handle_bast(lockres, level);
+ spin_lock(&lockres->l_lock);
- ocfs2_schedule_blocked_inode_lock(inode, lockres);
+ needs_downconvert = ocfs2_generic_handle_bast(lockres, level);
+ if (needs_downconvert)
+ ocfs2_schedule_blocked_inode_lock(inode, lockres);
+
+ spin_unlock(&lockres->l_lock);
+
ocfs2_kick_vote_thread(osb);
-
/* TODO: Is a wake_up call here really necessary? */
wake_up(&lockres->l_event);
+
LOG_EXIT();
}
@@ -701,15 +719,19 @@
{
ocfs2_lock_res *lockres = opaque;
ocfs_super *osb;
+ int needs_downconvert;
LOG_ENTRY();
osb = ocfs2_lock_res_super(lockres);
dprintk("Superblock BAST fired\n");
- ocfs2_generic_handle_bast(lockres, level);
+ spin_lock(&lockres->l_lock);
+ needs_downconvert = ocfs2_generic_handle_bast(lockres, level);
+ if (needs_downconvert)
+ ocfs2_schedule_blocked_lock(osb, lockres);
+ spin_unlock(&lockres->l_lock);
- ocfs2_schedule_blocked_lock(osb, lockres);
ocfs2_kick_vote_thread(osb);
wake_up(&lockres->l_event);
More information about the Ocfs2-commits
mailing list