dlm: move plock code from gfs2
Subsystems (2)
David Teigland
maintainerPATCH 5/6 dlm: move plock code from gfs2
Move the code that handles cluster posix locks from gfs2 into the dlm so that it can be used by both gfs2 and ocfs2.
Signed-off-by David Teigland <[email protected]>
--- fs/dlm/Makefile | 1 + fs/dlm/dlm_internal.h | 2 + fs/dlm/main.c | 7 + fs/dlm/plock.c | 439 ++++++++++++++++++++++++++++++++++++++++ fs/gfs2/locking/dlm/Makefile | 2 +- fs/gfs2/locking/dlm/lock_dlm.h | 11 +- fs/gfs2/locking/dlm/main.c | 8 - fs/gfs2/locking/dlm/mount.c | 21 ++ fs/gfs2/locking/dlm/plock.c | 406 ------------------------------------- include/linux/Kbuild | 2 +- include/linux/dlm_plock.h | 50 +++++ include/linux/lock_dlm_plock.h | 41 ---- 12 files changed, 523 insertions(+), 467 deletions(-) create mode 100644 fs/dlm/plock.c delete mode 100644 fs/gfs2/locking/dlm/plock.c create mode 100644 include/linux/dlm_plock.h delete mode 100644 include/linux/lock_dlm_plock.h
fs/dlm/Makefile +1 -0
@@ -10,6 +10,7 @@ dlm-y := ast.o \ midcomms.o \ netlink.o \ lowcomms.o \ + plock.o \ rcom.o \ recover.o \ recoverd.o \
fs/dlm/dlm_internal.h +2 -0
@@ -582,6 +582,8 @@ static inline int dlm_no_directory(struct dlm_ls *ls)int dlm_netlink_init (void );void dlm_netlink_exit (void );void dlm_timeout_warn (struct dlm_lkb *lkb); +int dlm_plock_init (void ); +void dlm_plock_exit (void );#ifdef CONFIG_DLM_DEBUG int dlm_register_debugfs (void );
fs/dlm/main.c +7 -0
@@ -46,10 +46,16 @@ static int __init init_dlm(void)if (error) goto out_user; + error =dlm_plock_init (); +if (error) + goto out_netlink; +printk ("DLM (built %s %s) installed\n" , __DATE__, __TIME__);return 0 ; + out_netlink: +dlm_netlink_exit (); out_user:dlm_user_exit (); out_debug:
@@ -66,6 +72,7 @@ static int __init init_dlm(void) static void __exit exit_dlm(void) { +dlm_plock_exit ();dlm_netlink_exit ();dlm_user_exit ();dlm_config_exit ();
fs/dlm/plock.c new file +439 -0
439 lines not on this page · raw message
fs/gfs2/locking/dlm/Makefile +1 -1
@@ -1,3 +1,3 @@ obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += lock_dlm.o -lock_dlm-y := lock.o main.o mount.o sysfs.o thread.o plock.o +lock_dlm-y := lock.o main.o mount.o sysfs.o thread.o
fs/gfs2/locking/dlm/lock_dlm.h +1 -10
@@ -25,6 +25,7 @@#include <net/sock.h> #include <linux/dlm.h> +#include <linux/dlm_plock.h> #include <linux/lm_interface.h> /*
@@ -173,15 +174,5 @@ void gdlm_cancel(void *);int gdlm_hold_lvb (void *,char **);void gdlm_unhold_lvb (void *,char *); -/* plock.c */ - -int gdlm_plock_init (void ); -void gdlm_plock_exit (void ); -int gdlm_plock (void *,struct lm_lockname *,struct file *,int , -struct file_lock *); -int gdlm_plock_get (void *,struct lm_lockname *,struct file *, -struct file_lock *); -int gdlm_punlock (void *,struct lm_lockname *,struct file *, -struct file_lock *);#endif
fs/gfs2/locking/dlm/main.c +0 -8
@@ -30,13 +30,6 @@ static int __init init_lock_dlm(void)return error; } - error =gdlm_plock_init (); -if (error) { -gdlm_sysfs_exit (); -gfs2_unregister_lockproto (&gdlm_ops); -return error; - } -printk (KERN_INFO "Lock_DLM (built %s %s) installed\n" , __DATE__, __TIME__);return 0 ;
@@ -44,7 +37,6 @@ static int __init init_lock_dlm(void) static void __exit exit_lock_dlm(void) { -gdlm_plock_exit ();gdlm_sysfs_exit ();gfs2_unregister_lockproto (&gdlm_ops); }
fs/gfs2/locking/dlm/mount.c +21 -0
@@ -236,6 +236,27 @@ static void gdlm_withdraw(void *lockspace)gdlm_kobject_release (ls); } +static int gdlm_plock (void *lockspace,struct lm_lockname *name, +struct file *file,int cmd,struct file_lock *fl) +{ +struct gdlm_ls *ls = lockspace; +return dlm_posix_lock (ls->dlm_lockspace, name->ln_number, file, cmd, fl); +} + +static int gdlm_punlock (void *lockspace,struct lm_lockname *name, +struct file *file,struct file_lock *fl) +{ +struct gdlm_ls *ls = lockspace; +return dlm_posix_unlock (ls->dlm_lockspace, name->ln_number, file, fl); +} + +static int gdlm_plock_get (void *lockspace,struct lm_lockname *name, +struct file *file,struct file_lock *fl) +{ +struct gdlm_ls *ls = lockspace; +return dlm_posix_get (ls->dlm_lockspace, name->ln_number, file, fl); +} +const struct lm_lockops gdlm_ops = { .lm_proto_name ="lock_dlm" , .lm_mount = gdlm_mount,
fs/gfs2/locking/dlm/plock.c deleted +0 -406
406 lines not on this page · raw message
include/linux/Kbuild +1 -1
@@ -99,7 +99,7 @@ header-y += ixjuser.h header-y += jffs2.h header-y += keyctl.h header-y += limits.h -header-y += lock_dlm_plock.h +header-y += dlm_plock.h header-y += magic.h header-y += major.h header-y += matroxfb.h
include/linux/dlm_plock.h new file +50 -0
50 lines not on this page · raw message
include/linux/lock_dlm_plock.h deleted +0 -41
41 lines not on this page · raw message
Signature · 1 line
1.5.3.3