aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlm/dlmdebug.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/dlm/dlmdebug.c')
-rw-r--r--fs/ocfs2/dlm/dlmdebug.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
index 64239b37e5d4..62e2a4cbf60d 100644
--- a/fs/ocfs2/dlm/dlmdebug.c
+++ b/fs/ocfs2/dlm/dlmdebug.c
@@ -30,6 +30,7 @@
30#include <linux/utsname.h> 30#include <linux/utsname.h>
31#include <linux/sysctl.h> 31#include <linux/sysctl.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/debugfs.h>
33 34
34#include "cluster/heartbeat.h" 35#include "cluster/heartbeat.h"
35#include "cluster/nodemanager.h" 36#include "cluster/nodemanager.h"
@@ -37,8 +38,8 @@
37 38
38#include "dlmapi.h" 39#include "dlmapi.h"
39#include "dlmcommon.h" 40#include "dlmcommon.h"
40
41#include "dlmdomain.h" 41#include "dlmdomain.h"
42#include "dlmdebug.h"
42 43
43#define MLOG_MASK_PREFIX ML_DLM 44#define MLOG_MASK_PREFIX ML_DLM
44#include "cluster/masklog.h" 45#include "cluster/masklog.h"
@@ -266,3 +267,50 @@ const char *dlm_errname(enum dlm_status err)
266 return dlm_errnames[err]; 267 return dlm_errnames[err];
267} 268}
268EXPORT_SYMBOL_GPL(dlm_errname); 269EXPORT_SYMBOL_GPL(dlm_errname);
270
271
272#ifdef CONFIG_DEBUG_FS
273
274static struct dentry *dlm_debugfs_root = NULL;
275
276#define DLM_DEBUGFS_DIR "o2dlm"
277
278/* subroot - domain dir */
279int dlm_create_debugfs_subroot(struct dlm_ctxt *dlm)
280{
281 dlm->dlm_debugfs_subroot = debugfs_create_dir(dlm->name,
282 dlm_debugfs_root);
283 if (!dlm->dlm_debugfs_subroot) {
284 mlog_errno(-ENOMEM);
285 goto bail;
286 }
287
288 return 0;
289bail:
290 dlm_destroy_debugfs_subroot(dlm);
291 return -ENOMEM;
292}
293
294void dlm_destroy_debugfs_subroot(struct dlm_ctxt *dlm)
295{
296 if (dlm->dlm_debugfs_subroot)
297 debugfs_remove(dlm->dlm_debugfs_subroot);
298}
299
300/* debugfs root */
301int dlm_create_debugfs_root(void)
302{
303 dlm_debugfs_root = debugfs_create_dir(DLM_DEBUGFS_DIR, NULL);
304 if (!dlm_debugfs_root) {
305 mlog_errno(-ENOMEM);
306 return -ENOMEM;
307 }
308 return 0;
309}
310
311void dlm_destroy_debugfs_root(void)
312{
313 if (dlm_debugfs_root)
314 debugfs_remove(dlm_debugfs_root);
315}
316#endif /* CONFIG_DEBUG_FS */