[Ocfs2-commits] mfasheh commits r2216 - in trunk/fs/ocfs2: . cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue May 3 20:39:54 CDT 2005


Author: mfasheh
Signed-off-by: zab
Signed-off-by: jlbec
Signed-off-by: manish
Date: 2005-05-03 20:39:53 -0500 (Tue, 03 May 2005)
New Revision: 2216

Modified:
   trunk/fs/ocfs2/cluster/masklog.c
   trunk/fs/ocfs2/cluster/masklog.h
   trunk/fs/ocfs2/vote.c
Log:
* don't send raw errno values over the wire during ocfs2 voting

* add a vote level of logging, this should make dlmglue logging less verbose 
  and allow us to zone in on vote problems exclusively.

Signed-off-by: zab
Signed-off-by: jlbec
Signed-off-by: manish



Modified: trunk/fs/ocfs2/cluster/masklog.c
===================================================================
--- trunk/fs/ocfs2/cluster/masklog.c	2005-05-04 01:22:43 UTC (rev 2215)
+++ trunk/fs/ocfs2/cluster/masklog.c	2005-05-04 01:39:53 UTC (rev 2216)
@@ -208,6 +208,7 @@
 	set_a_string(SEQNUM);
 	set_a_string(NAMEI);
 	set_a_string(INODE);
+	set_a_string(VOTE);
 	set_a_string(ERROR);
 	set_a_string(NOTICE);
 	set_a_string(KTHREAD);

Modified: trunk/fs/ocfs2/cluster/masklog.h
===================================================================
--- trunk/fs/ocfs2/cluster/masklog.h	2005-05-04 01:22:43 UTC (rev 2215)
+++ trunk/fs/ocfs2/cluster/masklog.h	2005-05-04 01:39:53 UTC (rev 2216)
@@ -104,6 +104,7 @@
 #define ML_SEQNUM	0x0000000000200000ULL /* ocfs2 caching sequence #'s */
 #define ML_NAMEI	0x0000000000400000ULL /* ocfs2 directory / namespace */
 #define ML_INODE	0x0000000000800000ULL /* ocfs2 inode manipulation */
+#define ML_VOTE		0x0000000001000000ULL /* ocfs2 node messaging  */
 /* bits that are infrequently given and frequently matched in the high word */
 #define ML_ERROR	0x0000000100000000ULL /* sent to KERN_ERR */
 #define ML_NOTICE	0x0000000200000000ULL /* setn to KERN_NOTICE */

Modified: trunk/fs/ocfs2/vote.c
===================================================================
--- trunk/fs/ocfs2/vote.c	2005-05-04 01:22:43 UTC (rev 2215)
+++ trunk/fs/ocfs2/vote.c	2005-05-04 01:39:53 UTC (rev 2216)
@@ -35,7 +35,7 @@
 
 #include <dlm/dlmapi.h>
 
-#define MLOG_MASK_PREFIX ML_DLM_GLUE
+#define MLOG_MASK_PREFIX ML_VOTE
 #include <cluster/masklog.h>
 
 #include "ocfs.h"
@@ -70,10 +70,16 @@
 	/* may put stuff in here... */
 } ocfs2_vote_msg;
 
+/* Responses are given these values to maintain backwards
+ * compatibility with older ocfs2 versions */
+#define OCFS2_RESPONSE_OK		(0)
+#define OCFS2_RESPONSE_BUSY		(-16)
+#define OCFS2_RESPONSE_BAD_MSG		(-22)
+
 typedef struct _ocfs2_response_msg
 {
 	ocfs2_msg_hdr r_hdr;
-	s32 r_response; /* this maps to '0' or a -value in errno.h */
+	s32 r_response;
 } ocfs2_response_msg;
 
 typedef struct _ocfs2_vote_work {
@@ -142,7 +148,7 @@
 
 static int ocfs2_process_delete_request(struct inode *inode)
 {
-	int response = -EBUSY;
+	int response = OCFS2_RESPONSE_BUSY;
 
 	mlog(0, "DELETE vote on inode %lu, read lnk_cnt = %u\n", inode->i_ino, 
 	     inode->i_nlink);
@@ -178,7 +184,7 @@
 
 	/* If we get here, then we're voting 'yes', so commit the
 	 * delete on our side. */
-	response = 0;
+	response = OCFS2_RESPONSE_OK;
 
 	spin_lock(&OCFS_I(inode)->ip_lock);
 	SET_INODE_DELETED(inode);
@@ -232,11 +238,11 @@
 	if (!ocfs2_is_valid_vote_request(request)) {
 		mlog(ML_ERROR, "Invalid vote request %d from node %u\n",
 		     request, node_num);
-		vote_response = -EINVAL;
+		vote_response = OCFS2_RESPONSE_BAD_MSG;
 		goto respond;
 	}
 
-	vote_response = 0;
+	vote_response = OCFS2_RESPONSE_OK;
 
 	switch (request) {
 	case OCFS2_VOTE_REQ_UMOUNT:
@@ -283,7 +289,7 @@
 	default:
 		mlog(ML_ERROR, "node %u, invalid request: %u\n",
 		     node_num, request);
-		vote_response = -EINVAL;
+		vote_response = OCFS2_RESPONSE_BAD_MSG;
 	}
 
 respond:
@@ -364,14 +370,13 @@
 	mlog_exit_void();
 }
 
-
 static int ocfs2_vote_thread_lists_empty(ocfs_super *osb)
 {
 	int empty = 0;
 
 	spin_lock(&osb->vote_task_lock);
-       if (list_empty(&osb->blocked_lock_list) &&
-	   list_empty(&osb->vote_list))
+	if (list_empty(&osb->blocked_lock_list) &&
+	    list_empty(&osb->vote_list))
 		empty = 1;
 
 	spin_unlock(&osb->vote_task_lock);
@@ -713,6 +718,27 @@
 	return w;
 }
 
+/* Translate response codes into local node errno values */
+static inline int ocfs2_translate_response(int response)
+{
+	int ret;
+
+	switch (response) {
+	case OCFS2_RESPONSE_OK:
+		ret = 0;
+		break;
+
+	case OCFS2_RESPONSE_BUSY:
+		ret = -EBUSY;
+		break;
+
+	default:
+		ret = -EINVAL;
+	}
+
+	return ret;
+}
+
 static int ocfs2_handle_response_message(net_msg *msg,
 					 u32 len,
 					 void *data)
@@ -727,7 +753,7 @@
 
 	response_id = ntohl(resp->r_hdr.h_response_id);
 	node_num = ntohl(resp->r_hdr.h_node_num);
-	response_status = ntohl(resp->r_response);
+	response_status = ocfs2_translate_response(ntohl(resp->r_response));
 
 	mlog(0, "received response message:\n");
 	mlog(0, "h_response_id = %u\n", response_id);
@@ -776,11 +802,13 @@
 	memcpy(&work->w_msg, msg->buf, sizeof(ocfs2_vote_msg));
 
 	mlog(0, "scheduling vote request:\n");
-	mlog(0, "h_response_id = %u\n", work->w_msg.v_hdr.h_response_id);
-	mlog(0, "h_request = %u\n", work->w_msg.v_hdr.h_request);
-	mlog(0, "h_blkno = %"MLFu64"\n", work->w_msg.v_hdr.h_blkno);
-	mlog(0, "h_generation = %u\n", work->w_msg.v_hdr.h_generation);
-	mlog(0, "h_node_num = %u\n", work->w_msg.v_hdr.h_node_num);
+	mlog(0, "h_response_id = %u\n",
+	     ntohl(work->w_msg.v_hdr.h_response_id));
+	mlog(0, "h_request = %u\n", ntohl(work->w_msg.v_hdr.h_request));
+	mlog(0, "h_blkno = %"MLFu64"\n",
+	     be64_to_cpu(work->w_msg.v_hdr.h_blkno));
+	mlog(0, "h_generation = %u\n", ntohl(work->w_msg.v_hdr.h_generation));
+	mlog(0, "h_node_num = %u\n", ntohl(work->w_msg.v_hdr.h_node_num));
 
 	spin_lock(&osb->vote_task_lock);
 	list_add_tail(&work->w_list, &osb->vote_list);



More information about the Ocfs2-commits mailing list