Skip to contentSkip to conversation

Two more patches for 1.4

Ocfs2-devel New Sunil Mushran 2 participants 5 messages Jan 15, 2008 OCFS2

lore
Share & tools
lore
#0 lore raw

The first patch is a small fix in the workqueue backport. The second patch forward ports the dlm debugging we had in 1.2.

Sunil

#1 lore raw

PATCH 1/2 ocfs2: Fix backport patch commit bb43f1e0ae88a80c40499a0b27d1fc0090e40892

The workqueue backport patch was missing a one-liner.

---
 fs/ocfs2/dlm/dlmrecovery.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ocfs2/dlm/dlmrecovery.c +1 -1
index 3cf4f49..d6a46c7 100644
@@ -156,7 +156,7 @@ static inline void dlm_reset_recovery(struct dlm_ctxt *dlm)
 void dlm_dispatch_work(kapi_work_struct_t *work)
 {
 	struct dlm_ctxt *dlm =
-		container_of(work, struct dlm_ctxt, dispatched_work);
+		work_to_object(work, struct dlm_ctxt, dispatched_work);
 	LIST_HEAD(tmp_list);
 	struct dlm_work_item *item, *next;
 	dlm_workfunc_t *workfunc;
Signature · 1 line
1.5.2.5
#3 lore raw

PATCH 2/2 dlm: Forward ported the dlm debugging from 1.2 to 1.4

In reply to Sunil Mushran

This is a temporary patch and will be replaced with the new dlm debug infrastructure based on seqfiles and debugfs. We are adding this inorder to be able to debug dlm issues during 1.4 testing.

---
 fs/ocfs2/dlm/Makefile                    |    3 +-
 fs/ocfs2/dlm/dlmcommon.h                 |    9 +-
 fs/ocfs2/dlm/dlmdebug.c                  |  471 ++++++++++++++++++++++++++++--
 fs/ocfs2/dlm/{dlmdomain.h => dlmdebug.h} |   20 +-
 fs/ocfs2/dlm/dlmdomain.c                 |   11 +-
 fs/ocfs2/dlm/dlmdomain.h                 |    1 +
 fs/ocfs2/dlm/dlmmaster.c                 |    9 +-
 fs/ocfs2/dlm/dlmrecovery.c               |    8 +-
 8 files changed, 486 insertions(+), 46 deletions(-)
 copy fs/ocfs2/dlm/{dlmdomain.h => dlmdebug.h} (74%)
fs/ocfs2/dlm/Makefile +2 -1
index 0ecea70..47c3b53 100644
@@ -70,7 +70,8 @@ HEADERS += 			\
 	dlmdomain.h		\
 	dlmfsver.h		\
 	dlmver.h		\
-	userdlm.h
+	userdlm.h		\
+	dlmdebug.h
 
 DLM_OBJECTS = $(subst .c,.o,$(DLM_SOURCES))
 DLMFS_OBJECTS = $(subst .c,.o,$(DLMFS_SOURCES))
fs/ocfs2/dlm/dlmcommon.h +8 -1
index cddf85a..f3afb15 100644
@@ -117,6 +117,8 @@ struct dlm_ctxt
 	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;
@@ -878,6 +880,8 @@ int dlm_heartbeat_init(struct dlm_ctxt *dlm);
 void dlm_hb_node_down_cb(struct o2nm_node *node, int idx, void *data);
 void dlm_hb_node_up_cb(struct o2nm_node *node, int idx, void *data);
 
+int dlm_migrate_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
+			u8 target);
 int dlm_empty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res);
 int dlm_finish_migration(struct dlm_ctxt *dlm,
 			 struct dlm_lock_resource *res,
@@ -916,7 +920,9 @@ int dlm_dispatch_assert_master(struct dlm_ctxt *dlm,
 			       int ignore_higher,
 			       u8 request_from,
 			       u32 flags);
-
+void dlm_assert_master_worker(struct dlm_work_item *item, void *data);
+void dlm_request_all_locks_worker(struct dlm_work_item *item, void *data);
+void dlm_mig_lockres_worker(struct dlm_work_item *item, void *data);
 
 int dlm_send_one_lockres(struct dlm_ctxt *dlm,
 			 struct dlm_lock_resource *res,
@@ -947,6 +953,7 @@ int dlm_drop_lockres_ref(struct dlm_ctxt *dlm,
 void dlm_clean_master_list(struct dlm_ctxt *dlm,
 			   u8 dead_node);
 int dlm_lock_basts_flushed(struct dlm_ctxt *dlm, struct dlm_lock *lock);
+int dlm_dump_all_mles(const char __user *data, unsigned int len);
 int __dlm_lockres_has_locks(struct dlm_lock_resource *res);
 int __dlm_lockres_unused(struct dlm_lock_resource *res);
 
fs/ocfs2/dlm/dlmdebug.c +450 -21

526 lines not on this page · raw message

fs/ocfs2/dlm/dlmdebug.h renamed from fs/ocfs2/dlm/dlmdomain.h +9 -11
similarity index 74%
copy from fs/ocfs2/dlm/dlmdomain.h
copy to fs/ocfs2/dlm/dlmdebug.h
index 2f7f60b..dbe3a3d 100644
@@ -1,7 +1,7 @@
 /* -*- mode: c; c-basic-offset: 8; -*-
  * vim: noexpandtab sw=8 ts=8 sts=0:
  *
- * dlmdomain.h
+ * dlmdebug.h
  *
  * Copyright (C) 2004 Oracle.  All rights reserved.
  *
@@ -22,15 +22,13 @@
  *
  */
 
-#ifndef DLMDOMAIN_H
-#define DLMDOMAIN_H
-
-extern spinlock_t dlm_domain_lock;
-extern struct list_head dlm_domains;
-
-int dlm_joined(struct dlm_ctxt *dlm);
-int dlm_shutting_down(struct dlm_ctxt *dlm);
-void dlm_fire_domain_eviction_callbacks(struct dlm_ctxt *dlm,
-					int node_num);
+#ifndef DLMDEBUG_H
+#define DLMDEBUG_H
 
+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);
+void dlm_dump_work_queue(struct dlm_ctxt *dlm);
 #endif
fs/ocfs2/dlm/dlmdomain.c +9 -2
index 10b3e60..1d854d5 100644
@@ -41,6 +41,7 @@
 #include "dlmapi.h"
 #include "dlmcommon.h"
 
+#include "dlmdebug.h"
 #include "dlmdomain.h"
 
 #include "dlmver.h"
@@ -234,7 +235,7 @@ struct dlm_lock_resource * dlm_lookup_lockres(struct dlm_ctxt *dlm,
 	return res;
 }
 
-static struct dlm_ctxt * __dlm_lookup_domain_full(const char *domain, int len)
+struct dlm_ctxt * __dlm_lookup_domain_full(const char *domain, int len)
 {
 	struct dlm_ctxt *tmp = NULL;
 	struct list_head *iter;
@@ -255,7 +256,7 @@ static struct dlm_ctxt * __dlm_lookup_domain_full(const char *domain, int len)
 }
 
 /* For null terminated domain strings ONLY */
-static struct dlm_ctxt * __dlm_lookup_domain(const char *domain)
+struct dlm_ctxt * __dlm_lookup_domain(const char *domain)
 {
 	assert_spin_locked(&dlm_domain_lock);
 
@@ -285,6 +286,8 @@ static int dlm_wait_on_domain_helper(const char *domain)
 
 static void dlm_free_ctxt_mem(struct dlm_ctxt *dlm)
 {
+	dlm_proc_del_domain(dlm);
+
 	if (dlm->lockres_hash)
 		dlm_free_pagevec((void **)dlm->lockres_hash, DLM_HASH_PAGES);
 
@@ -1441,6 +1444,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
 	dlm->dlm_state = DLM_CTXT_NEW;
 
 	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));
@@ -1653,11 +1657,14 @@ static int __init dlm_init(void)
 		return -1;
 	}
 
+	dlm_init_proc();
+
 	return 0;
 }
 
 static void __exit dlm_exit (void)
 {
+	dlm_remove_proc();
 	dlm_unregister_net_handlers();
 	dlm_destroy_mle_cache();
 }
fs/ocfs2/dlm/dlmdomain.h +1 -0
index 2f7f60b..1cb2715 100644
@@ -28,6 +28,7 @@
 extern spinlock_t dlm_domain_lock;
 extern struct list_head dlm_domains;
 
+struct dlm_ctxt * __dlm_lookup_domain(const char *domain);
 int dlm_joined(struct dlm_ctxt *dlm);
 int dlm_shutting_down(struct dlm_ctxt *dlm);
 void dlm_fire_domain_eviction_callbacks(struct dlm_ctxt *dlm,
fs/ocfs2/dlm/dlmmaster.c +4 -5
index a668840..c8e5d84 100644
@@ -98,7 +98,6 @@ static void dlm_mle_node_up(struct dlm_ctxt *dlm,
 			    struct o2nm_node *node,
 			    int idx);
 
-static void dlm_assert_master_worker(struct dlm_work_item *item, void *data);
 static int dlm_do_assert_master(struct dlm_ctxt *dlm,
 				struct dlm_lock_resource *res,
 				void *nodemap, u32 flags);
@@ -186,7 +185,7 @@ static void dlm_print_one_mle(struct dlm_master_list_entry *mle)
 	printk("\n");
 }
 
-#if 0
+
 /* Code here is included but defined out as it aids debugging */
 
 static void dlm_dump_mles(struct dlm_ctxt *dlm)
@@ -214,7 +213,7 @@ int dlm_dump_all_mles(const char __user *data, unsigned int len)
 }
 EXPORT_SYMBOL_GPL(dlm_dump_all_mles);
 
-#endif  /*  0  */
+
 
 
 static struct kmem_cache *dlm_mle_cache = NULL;
@@ -2119,7 +2118,7 @@ int dlm_dispatch_assert_master(struct dlm_ctxt *dlm,
 	return 0;
 }
 
-static void dlm_assert_master_worker(struct dlm_work_item *item, void *data)
+void dlm_assert_master_worker(struct dlm_work_item *item, void *data)
 {
 	struct dlm_ctxt *dlm = data;
 	int ret = 0;
@@ -2470,7 +2469,7 @@ leave:
  */
 
 
-static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
+int dlm_migrate_lockres(struct dlm_ctxt *dlm,
 			       struct dlm_lock_resource *res,
 			       u8 target)
 {
fs/ocfs2/dlm/dlmrecovery.c +3 -5
index d6a46c7..d2f01d4 100644
@@ -49,6 +49,7 @@
 #include "dlmapi.h"
 #include "dlmcommon.h"
 #include "dlmdomain.h"
+#include "dlmdebug.h"
 
 #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_RECOVERY)
 #include "cluster/masklog.h"
@@ -92,9 +93,6 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm,
 static void dlm_reco_ast(void *astdata);
 static void dlm_reco_bast(void *astdata, int blocked_type);
 static void dlm_reco_unlock_ast(void *astdata, enum dlm_status st);
-static void dlm_request_all_locks_worker(struct dlm_work_item *item,
-					 void *data);
-static void dlm_mig_lockres_worker(struct dlm_work_item *item, void *data);
 static int dlm_lockres_master_requery(struct dlm_ctxt *dlm,
 				      struct dlm_lock_resource *res,
 				      u8 *real_master);
@@ -862,7 +860,7 @@ int dlm_request_all_locks_handler(struct o2net_msg *msg, u32 len, void *data,
 	return 0;
 }
 
-static void dlm_request_all_locks_worker(struct dlm_work_item *item, void *data)
+void dlm_request_all_locks_worker(struct dlm_work_item *item, void *data)
 {
 	struct dlm_migratable_lockres *mres;
 	struct dlm_lock_resource *res;
@@ -1462,7 +1460,7 @@ leave:
 }
 
 
-static void dlm_mig_lockres_worker(struct dlm_work_item *item, void *data)
+void dlm_mig_lockres_worker(struct dlm_work_item *item, void *data)
 {
 	struct dlm_ctxt *dlm = data;
 	struct dlm_migratable_lockres *mres;
Signature · 1 line
1.5.2.5