Skip to contentSkip to conversation

GFS2: The DLM interface module

PATCH In review Steven Whitehouse 1 participant 1 message Apr 21, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 14/16 GFS2: The DLM interface module

[PATCH 14/16] GFS2: The DLM interface module

The interface between GFS2 and the DLM. This is the bit which is actually part of GFS2.

 fs/gfs2/locking/dlm/Makefile   |    3 
 fs/gfs2/locking/dlm/lock.c     |  538 +++++++++++++++++++++++++++++++++++++++++
 fs/gfs2/locking/dlm/lock_dlm.h |  191 ++++++++++++++
 fs/gfs2/locking/dlm/main.c     |   64 ++++
 fs/gfs2/locking/dlm/mount.c    |  255 +++++++++++++++++++
 fs/gfs2/locking/dlm/plock.c    |  298 ++++++++++++++++++++++
 fs/gfs2/locking/dlm/sysfs.c    |  218 ++++++++++++++++
 fs/gfs2/locking/dlm/thread.c   |  352 ++++++++++++++++++++++++++
 include/linux/lock_dlm_plock.h |   40 +++
 9 files changed, 1959 insertions(+)
fs/gfs2/locking/dlm/main.c new file +64 -0
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
+ * Copyright (C) 2004-2005 Red Hat, Inc.  All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ */
+
+#include <linux/init.h>
+
+#include "lock_dlm.h"
+
+extern int gdlm_drop_count;
+extern int gdlm_drop_period;
+
+extern struct lm_lockops gdlm_ops;
+
+int __init init_lock_dlm(void)
+{
+	int error;
+
+	error = gfs_register_lockproto(&gdlm_ops);
+	if (error) {
+		printk(KERN_WARNING "lock_dlm:  can't register protocol: %d\n",
+		       error);
+		return error;
+	}
+
+	error = gdlm_sysfs_init();
+	if (error) {
+		gfs_unregister_lockproto(&gdlm_ops);
+		return error;
+	}
+
+	error = gdlm_plock_init();
+	if (error) {
+		gdlm_sysfs_exit();
+		gfs_unregister_lockproto(&gdlm_ops);
+		return error;
+	}
+
+	gdlm_drop_count = GDLM_DROP_COUNT;
+	gdlm_drop_period = GDLM_DROP_PERIOD;
+
+	printk(KERN_INFO
+	       "Lock_DLM (built %s %s) installed\n", __DATE__, __TIME__);
+	return 0;
+}
+
+void __exit exit_lock_dlm(void)
+{
+	gdlm_plock_exit();
+	gdlm_sysfs_exit();
+	gfs_unregister_lockproto(&gdlm_ops);
+}
+
+module_init(init_lock_dlm);
+module_exit(exit_lock_dlm);
+
+MODULE_DESCRIPTION("GFS DLM Locking Module");
+MODULE_AUTHOR("Red Hat, Inc.");
+MODULE_LICENSE("GPL");
+
fs/gfs2/locking/dlm/lock.c new file +538 -0

538 lines not on this page · raw message

fs/gfs2/locking/dlm/mount.c new file +255 -0

255 lines not on this page · raw message

fs/gfs2/locking/dlm/plock.c new file +298 -0

298 lines not on this page · raw message

fs/gfs2/locking/dlm/sysfs.c new file +218 -0

218 lines not on this page · raw message

fs/gfs2/locking/dlm/thread.c new file +352 -0

352 lines not on this page · raw message

fs/gfs2/locking/dlm/lock_dlm.h new file +191 -0

191 lines not on this page · raw message

fs/gfs2/locking/dlm/Makefile new file +3 -0
@@ -0,0 +1,3 @@
+obj-$(CONFIG_GFS2_FS) += lock_dlm.o
+lock_dlm-y := lock.o main.o mount.o sysfs.o thread.o plock.o
+
include/linux/lock_dlm_plock.h new file +40 -0
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2005 Red Hat, Inc.  All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ */
+
+#ifndef __LOCK_DLM_PLOCK_DOT_H__
+#define __LOCK_DLM_PLOCK_DOT_H__
+
+#define GDLM_PLOCK_MISC_NAME		"lock_dlm_plock"
+
+#define GDLM_PLOCK_VERSION_MAJOR	1
+#define GDLM_PLOCK_VERSION_MINOR	0
+#define GDLM_PLOCK_VERSION_PATCH	0
+
+enum {
+	GDLM_PLOCK_OP_LOCK = 1,
+	GDLM_PLOCK_OP_UNLOCK,
+	GDLM_PLOCK_OP_GET,
+};
+
+struct gdlm_plock_info {
+	__u32 version[3];
+	__u8 optype;
+	__u8 ex;
+	__u8 wait;
+	__u8 pad;
+	__u32 pid;
+	__s32 nodeid;
+	__s32 rv;
+	__u32 fsid;
+	__u64 number;
+	__u64 start;
+	__u64 end;
+};
+
+#endif
+