[Ocfs2-commits] smushran commits r2901 - branches/ocfs2-1.2/fs/ocfs2/dlm

svn-commits@oss.oracle.com svn-commits at oss.oracle.com
Thu Apr 20 14:38:51 CDT 2006


Author: smushran
Signed-off-by: mfasheh
Signed-off-by: khackel
Date: 2006-04-20 14:38:50 -0500 (Thu, 20 Apr 2006)
New Revision: 2901

Modified:
   branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h
   branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdebug.c
   branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdebug.h
   branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdomain.c
Log:
proc entry added to ocfs2_dlm to track number of dlm_lockres
Signed-off-by: mfasheh
Signed-off-by: khackel

Modified: branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h	2006-04-20 19:35:48 UTC (rev 2900)
+++ branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h	2006-04-20 19:38:50 UTC (rev 2901)
@@ -107,6 +107,8 @@
 	struct list_head master_list;
 	struct list_head mle_hb_events;
 
+	struct proc_dir_entry *dlm_proc;
+
 	/* these give a really vague idea of the system load */
 	atomic_t local_resources;
 	atomic_t remote_resources;

Modified: branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdebug.c
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdebug.c	2006-04-20 19:35:48 UTC (rev 2900)
+++ branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdebug.c	2006-04-20 19:38:50 UTC (rev 2901)
@@ -58,6 +58,9 @@
 					struct dlm_ctxt **dlm,
 					struct dlm_lock_resource **res);
 
+static int dlm_proc_stats(char *page, char **start, off_t off,
+			  int count, int *eof, void *data);
+
 typedef int (dlm_debug_func_t)(const char __user *data, unsigned int len);
 
 struct dlm_debug_funcs
@@ -114,6 +117,8 @@
 
 #define OCFS2_DLM_PROC_PATH "fs/ocfs2_dlm"
 #define DLM_DEBUG_PROC_NAME "debug"
+#define DLM_STAT_PROC_NAME  "stat"
+
 static struct proc_dir_entry *ocfs2_dlm_proc;
 
 void dlm_remove_proc(void)
@@ -140,6 +145,52 @@
 		entry->proc_fops = &dlm_debug_operations;
 }
 
+static int dlm_proc_stats(char *page, char **start, off_t off,
+			  int count, int *eof, void *data)
+{
+	int len;
+	struct dlm_ctxt *dlm = data;
+
+	len = sprintf(page, "local=%d, remote=%d, unknown=%d\n",
+		      atomic_read(&dlm->local_resources),
+		      atomic_read(&dlm->remote_resources),
+		      atomic_read(&dlm->unknown_resources));
+
+	if (len <= off + count)
+		*eof = 1;
+
+	*start = page + off;
+	len -= off;
+	if (len > count)
+		len = count;
+	if (len < 0)
+		len = 0;
+
+	return len;
+}
+
+void dlm_proc_add_domain(struct dlm_ctxt *dlm)
+{
+	struct proc_dir_entry *entry;
+
+	dlm->dlm_proc = proc_mkdir(dlm->name, ocfs2_dlm_proc);
+	if (dlm->dlm_proc) {
+		entry = create_proc_read_entry(DLM_STAT_PROC_NAME,
+					       S_IFREG | S_IRUGO, dlm->dlm_proc,
+					       dlm_proc_stats, (char *)dlm);
+		if (entry)
+			entry->owner = THIS_MODULE;
+	}
+}
+
+void dlm_proc_del_domain(struct dlm_ctxt *dlm)
+{
+	if (dlm->dlm_proc) {
+		remove_proc_entry(DLM_STAT_PROC_NAME, dlm->dlm_proc);
+		remove_proc_entry(dlm->name, ocfs2_dlm_proc);
+	}
+}
+
 /* lock resource printing is usually very important (printed
  * right before a BUG in some cases), but we'd like to be
  * able to shut it off if needed, hence the KERN_NOTICE level */

Modified: branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdebug.h
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdebug.h	2006-04-20 19:35:48 UTC (rev 2900)
+++ branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdebug.h	2006-04-20 19:38:50 UTC (rev 2901)
@@ -28,5 +28,7 @@
 void dlm_remove_proc(void);
 void dlm_init_proc(void);
 void dlm_dump_lock_resources(struct dlm_ctxt *dlm);
+void dlm_proc_add_domain(struct dlm_ctxt *dlm);
+void dlm_proc_del_domain(struct dlm_ctxt *dlm);
 
 #endif

Modified: branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdomain.c
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdomain.c	2006-04-20 19:35:48 UTC (rev 2900)
+++ branches/ocfs2-1.2/fs/ocfs2/dlm/dlmdomain.c	2006-04-20 19:38:50 UTC (rev 2901)
@@ -193,6 +193,8 @@
 
 static void dlm_free_ctxt_mem(struct dlm_ctxt *dlm)
 {
+	dlm_proc_del_domain(dlm);
+
 	if (dlm->lockres_hash)
 		free_page((unsigned long) dlm->lockres_hash);
 
@@ -1267,6 +1269,8 @@
 
 	INIT_LIST_HEAD(&dlm->dlm_eviction_callbacks);
 
+	dlm_proc_add_domain(dlm);
+
 	mlog(0, "context init: refcount %u\n",
 		  atomic_read(&dlm->dlm_refs.refcount));
 




More information about the Ocfs2-commits mailing list