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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Aug 19 13:40:36 CDT 2005


Author: khackel
Signed-off-by: mfasheh
Date: 2005-08-19 13:40:34 -0500 (Fri, 19 Aug 2005)
New Revision: 2534

Modified:
   trunk/fs/ocfs2/dlm/dlmcommon.h
   trunk/fs/ocfs2/dlm/dlmdomain.c
   trunk/fs/ocfs2/dlm/dlmmaster.c
   trunk/fs/ocfs2/dlm/dlmrecovery.c
Log:
* move all references to dlm_master_list_entry structure and
  functions local to dlmmaster.c where it belongs

Signed-off-by: mfasheh



Modified: trunk/fs/ocfs2/dlm/dlmcommon.h
===================================================================
--- trunk/fs/ocfs2/dlm/dlmcommon.h	2005-08-19 02:26:42 UTC (rev 2533)
+++ trunk/fs/ocfs2/dlm/dlmcommon.h	2005-08-19 18:40:34 UTC (rev 2534)
@@ -315,43 +315,8 @@
 }
 
 
-enum dlm_mle_type {
-	DLM_MLE_BLOCK,
-	DLM_MLE_MASTER,
-	DLM_MLE_MIGRATION
-};
 
-struct dlm_lock_name
-{
-	u8 len;
-	u8 name[DLM_LOCKID_NAME_MAX];
-};
 
-/* good god this needs to be trimmed down */
-struct dlm_master_list_entry
-{
-	struct list_head list;
-	struct list_head hb_events;
-	struct dlm_ctxt *dlm;
-	spinlock_t spinlock;
-	wait_queue_head_t wq;
-	atomic_t woken;
-	struct kref mle_refs;
-	unsigned long maybe_map[BITS_TO_LONGS(O2NM_MAX_NODES)];
-	unsigned long vote_map[BITS_TO_LONGS(O2NM_MAX_NODES)];
-	unsigned long response_map[BITS_TO_LONGS(O2NM_MAX_NODES)];
-	unsigned long node_map[BITS_TO_LONGS(O2NM_MAX_NODES)];
-	u8 master;
-	u8 new_master;
-	enum dlm_mle_type type;
-	struct o2hb_callback_func mle_hb_up;
-	struct o2hb_callback_func mle_hb_down;
-	union {
-		struct dlm_lock_resource *res;
-		struct dlm_lock_name name;
-	} u;
-};
-
 struct dlm_node_iter
 {
 	unsigned long node_map[BITS_TO_LONGS(O2NM_MAX_NODES)];
@@ -806,7 +771,6 @@
 int dlm_reco_data_done_handler(o2net_msg *msg, u32 len, void *data);
 int dlm_begin_reco_handler(o2net_msg *msg, u32 len, void *data);
 int dlm_finalize_reco_handler(o2net_msg *msg, u32 len, void *data);
-void dlm_print_one_mle(struct dlm_master_list_entry *mle);
 
 int dlm_dispatch_assert_master(struct dlm_ctxt *dlm,
 			       struct dlm_lock_resource *res,
@@ -844,14 +808,7 @@
 
 int dlm_init_mle_cache(void);
 void dlm_destroy_mle_cache(void);
-void dlm_mle_node_down(struct dlm_ctxt *dlm,
-		       struct dlm_master_list_entry *mle,
-		       struct o2nm_node *node,
-		       int idx);
-void dlm_mle_node_up(struct dlm_ctxt *dlm,
-		     struct dlm_master_list_entry *mle,
-		     struct o2nm_node *node,
-		     int idx);
+void dlm_hb_event_notify_attached(struct dlm_ctxt *dlm, int idx, int node_up);
 int dlm_do_assert_master(struct dlm_ctxt *dlm,
 			 const char *lockname,
 			 unsigned int namelen,
@@ -916,30 +873,7 @@
 	return 0;
 }
 
-static inline int dlm_mle_equal(struct dlm_ctxt *dlm,
-				struct dlm_master_list_entry *mle,
-				const char *name,
-				unsigned int namelen)
-{
-	struct dlm_lock_resource *res;
 
-	if (dlm != mle->dlm)
-		return 0;
-
-	if (mle->type == DLM_MLE_BLOCK ||
-	    mle->type == DLM_MLE_MIGRATION) {
-		if (namelen != mle->u.name.len ||
-    	    	    memcmp(name, mle->u.name.name, namelen)!=0)
-			return 0;
-	} else {
-		res = mle->u.res;
-		if (namelen != res->lockname.len ||
-		    memcmp(res->lockname.name, name, namelen) != 0)
-			return 0;
-	}
-	return 1;
-}
-
 static inline enum dlm_status dlm_err_to_dlm_status(int err)
 {
 	enum dlm_status ret;

Modified: trunk/fs/ocfs2/dlm/dlmdomain.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmdomain.c	2005-08-19 02:26:42 UTC (rev 2533)
+++ trunk/fs/ocfs2/dlm/dlmdomain.c	2005-08-19 18:40:34 UTC (rev 2534)
@@ -390,8 +390,6 @@
 	struct dlm_ctxt *dlm = data;
 	unsigned int node;
 	struct dlm_exit_domain *exit_msg = (struct dlm_exit_domain *) msg->buf;
-	struct dlm_master_list_entry *mle;
-	struct list_head *iter;
 
 	mlog_entry("%p %u %p", msg, len, data);
 
@@ -406,11 +404,8 @@
 	clear_bit(node, dlm->domain_map);
 	__dlm_print_nodes(dlm);
 
-	/* notify any mles attached to the heartbeat events */
-	list_for_each(iter, &dlm->mle_hb_events) {
-		mle = list_entry(iter, struct dlm_master_list_entry, hb_events);
-		dlm_mle_node_down(dlm, mle, NULL, node);
-	}
+	/* notify anything attached to the heartbeat events */
+	dlm_hb_event_notify_attached(dlm, node, 0);
 
 	spin_unlock(&dlm->spinlock);
 
@@ -617,8 +612,6 @@
 {
 	struct dlm_assert_joined *assert;
 	struct dlm_ctxt *dlm = NULL;
-	struct dlm_master_list_entry *mle;
-	struct list_head *iter;
 
 	assert = (struct dlm_assert_joined *) msg->buf;
 
@@ -640,11 +633,8 @@
 
 		__dlm_print_nodes(dlm);
 
-		/* notify any mles attached to the heartbeat events */
-		list_for_each(iter, &dlm->mle_hb_events) {
-			mle = list_entry(iter, struct dlm_master_list_entry, hb_events);
-			dlm_mle_node_up(dlm, mle, NULL, assert->node_idx);
-		}
+		/* notify anything attached to the heartbeat events */
+		dlm_hb_event_notify_attached(dlm, assert->node_idx, 1);
 
 		spin_unlock(&dlm->spinlock);
 	}

Modified: trunk/fs/ocfs2/dlm/dlmmaster.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmmaster.c	2005-08-19 02:26:42 UTC (rev 2533)
+++ trunk/fs/ocfs2/dlm/dlmmaster.c	2005-08-19 18:40:34 UTC (rev 2534)
@@ -52,7 +52,77 @@
 #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_MASTER)
 #include "cluster/masklog.h"
 
+enum dlm_mle_type {
+	DLM_MLE_BLOCK,
+	DLM_MLE_MASTER,
+	DLM_MLE_MIGRATION
+};
 
+struct dlm_lock_name
+{
+	u8 len;
+	u8 name[DLM_LOCKID_NAME_MAX];
+};
+
+struct dlm_master_list_entry
+{
+	struct list_head list;
+	struct list_head hb_events;
+	struct dlm_ctxt *dlm;
+	spinlock_t spinlock;
+	wait_queue_head_t wq;
+	atomic_t woken;
+	struct kref mle_refs;
+	unsigned long maybe_map[BITS_TO_LONGS(O2NM_MAX_NODES)];
+	unsigned long vote_map[BITS_TO_LONGS(O2NM_MAX_NODES)];
+	unsigned long response_map[BITS_TO_LONGS(O2NM_MAX_NODES)];
+	unsigned long node_map[BITS_TO_LONGS(O2NM_MAX_NODES)];
+	u8 master;
+	u8 new_master;
+	enum dlm_mle_type type;
+	struct o2hb_callback_func mle_hb_up;
+	struct o2hb_callback_func mle_hb_down;
+	union {
+		struct dlm_lock_resource *res;
+		struct dlm_lock_name name;
+	} u;
+};
+
+void dlm_print_one_mle(struct dlm_master_list_entry *mle);
+
+void dlm_mle_node_down(struct dlm_ctxt *dlm,
+		       struct dlm_master_list_entry *mle,
+		       struct o2nm_node *node,
+		       int idx);
+void dlm_mle_node_up(struct dlm_ctxt *dlm,
+		     struct dlm_master_list_entry *mle,
+		     struct o2nm_node *node,
+		     int idx);
+
+static inline int dlm_mle_equal(struct dlm_ctxt *dlm,
+				struct dlm_master_list_entry *mle,
+				const char *name,
+				unsigned int namelen)
+{
+	struct dlm_lock_resource *res;
+
+	if (dlm != mle->dlm)
+		return 0;
+
+	if (mle->type == DLM_MLE_BLOCK ||
+	    mle->type == DLM_MLE_MIGRATION) {
+		if (namelen != mle->u.name.len ||
+    	    	    memcmp(name, mle->u.name.name, namelen)!=0)
+			return 0;
+	} else {
+		res = mle->u.res;
+		if (namelen != res->lockname.len ||
+		    memcmp(res->lockname.name, name, namelen) != 0)
+			return 0;
+	}
+	return 1;
+}
+
 void dlm_print_one_mle(struct dlm_master_list_entry *mle)
 {
 	int i = 0, refs;
@@ -332,7 +402,23 @@
 	return 0;
 }
 
+void dlm_hb_event_notify_attached(struct dlm_ctxt *dlm, int idx, int node_up)
+{
+	struct dlm_master_list_entry *mle;
+	struct list_head *iter;
 
+	assert_spin_locked(&dlm->spinlock);
+	
+	list_for_each(iter, &dlm->mle_hb_events) {
+		mle = list_entry(iter, struct dlm_master_list_entry, 
+				 hb_events);
+		if (node_up)
+			dlm_mle_node_up(dlm, mle, NULL, idx);
+		else
+			dlm_mle_node_down(dlm, mle, NULL, idx);
+	}
+}
+
 void dlm_mle_node_down(struct dlm_ctxt *dlm, struct dlm_master_list_entry *mle,
 		       struct o2nm_node *node, int idx)
 {
@@ -343,12 +429,6 @@
 	else
 		clear_bit(idx, mle->node_map);
 
-#if 0
-	if (test_bit(idx, mle->recovery_map))
-		mlog(0, "node %u already added to recovery map!\n", idx);
-	else
-		set_bit(idx, mle->recovery_map);
-#endif
 	spin_unlock(&mle->spinlock);
 }
 
@@ -357,18 +437,10 @@
 {
 	spin_lock(&mle->spinlock);
 
-#if 0
-	if (test_bit(idx, mle->recovery_map))
-		mlog(ML_ERROR, "node up message on node in recovery (%u)!\n",
-		     idx);
+	if (test_bit(idx, mle->node_map))
+		mlog(0, "node %u already in node map!\n", idx);
 	else
-#endif
-	{
-		if (test_bit(idx, mle->node_map))
-			mlog(0, "node %u already in node map!\n", idx);
-		else
-			set_bit(idx, mle->node_map);
-	}
+		set_bit(idx, mle->node_map);
 
 	spin_unlock(&mle->spinlock);
 }

Modified: trunk/fs/ocfs2/dlm/dlmrecovery.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmrecovery.c	2005-08-19 02:26:42 UTC (rev 2533)
+++ trunk/fs/ocfs2/dlm/dlmrecovery.c	2005-08-19 18:40:34 UTC (rev 2534)
@@ -1775,9 +1775,6 @@
 
 void __dlm_hb_node_down(struct dlm_ctxt *dlm, int idx)
 {
-	struct dlm_master_list_entry *mle;
-	struct list_head *iter;
-
 	assert_spin_locked(&dlm->spinlock);
 
 	/* check to see if the node is already considered dead */
@@ -1808,13 +1805,9 @@
 	if (!test_bit(idx, dlm->recovery_map))
 		dlm_do_local_recovery_cleanup(dlm, idx);
 
-	/* notify any mles attached to the heartbeat events */
-	list_for_each(iter, &dlm->mle_hb_events) {
-		mle = list_entry(iter, struct dlm_master_list_entry, hb_events);
-		dlm_mle_node_down(dlm, mle, NULL, idx);
-	}
+	/* notify anything attached to the heartbeat events */
+	dlm_hb_event_notify_attached(dlm, idx, 0);
 
-
 	mlog(0, "node %u being removed from domain map!\n", idx);
 	clear_bit(idx, dlm->domain_map);
 	/* wake up migration waiters if a node goes down.
@@ -1845,8 +1838,6 @@
 void dlm_hb_node_up_cb(struct o2nm_node *node, int idx, void *data)
 {
 	struct dlm_ctxt *dlm = data;
-	struct dlm_master_list_entry *mle;
-	struct list_head *iter;
 
 	if (!dlm_grab(dlm))
 		return;
@@ -1856,10 +1847,7 @@
 	set_bit(idx, dlm->live_nodes_map);
 
 	/* notify any mles attached to the heartbeat events */
-	list_for_each(iter, &dlm->mle_hb_events) {
-		mle = list_entry(iter, struct dlm_master_list_entry, hb_events);
-		dlm_mle_node_up(dlm, mle, node, idx);
-	}
+	dlm_hb_event_notify_attached(dlm, idx, 1);
 
 	spin_unlock(&dlm->spinlock);
 



More information about the Ocfs2-commits mailing list