Merge the lock_dlm module into GFS2
Hi,
So this is a pretty large patch... my current plan is to be ready to push this into the next -nmw tree (i.e. first patch after the next merge window), but we'll see if it makes it in time.
The reason for posting this now when its not yet in its final form is to give a heads up at whats coming up. Please let me know if you've got any comments about it so far.
There will, no doubt, be a few more changes required after some further testing, but even in its current (alpha) form it is possible to mount, use & umount a filesystem. If you do test this though, you may have to chop out the line in the cman initscript which tries to load lock_dlm.
Steve.
----------------------------------------------------------------------
From 351b4a4b2bebe7636eb01c524c5e1d6ff8bcd4b5 Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <[email protected]>
Date: Mon, 1 Dec 2008 14:06:57 +0000
Subject: [PATCH] [GFS2] Merge the lock_dlm module into GFS2
Before I go any further, to avoid any posible confusion, let me say that this is not merging the DLM into GFS2, but only the previously separate interface module.
This is a large patch, but most of it is deleting code, and of the remainder, a lot of it is just moving code from one place to another. In order to allow the building of GFS2 for single node use with not dependencies on the DLM or networking, etc, the previous config option for lock_dlm is turned into a boolean.
The main reasons for doing this change, are to reduce duplication between the lock module and GFS2 (glocks contain much of the information which lock_nolock used to keep on its own behalf before) and to make the code simpler and faster. Since we now use the glock pointer as the reference which we pass to the DLM, that removes not one, but _two_ lookups for each reply we receive from the DLM.
Although the glock has grown slightly in size, its much smaller then the previous combined glock and struct gdlm_lock were, and only one allocation is required, rather than two. There are some further optimisations which could be done in the future in regards to the generation of the lock name which is passed to the DLM.
In addition, a couple of bugs are fixed. Firstly the string name of the lock was too short, causing the NULL to be written into the following field of the structure. That never mattered since that field was the "length" of the string which was initialised after the string name. Following that point, the string was only ever used as a fixed size array of bytes, so that the missing NULL didn't matter. That bug is fixed in this patch.
Also we add a dependancy on HOTPLUG since we require this in order to send the uevents with which we communication with gfs_controld.
fs/gfs2/Kconfig +10 -7
@@ -1,6 +1,10 @@ config GFS2_FS tristate "GFS2 file system support" depends on EXPERIMENTAL && (64BIT || (LSF && LBD)) + select DLM if GFS2_FS_LOCKING_DLM + select CONFIGFS_FS if GFS2_FS_LOCKING_DLM + select SYSFS if GFS2_FS_LOCKING_DLM + select IP_SCTP if DLM_SCTP select FS_POSIX_ACL select CRC32 help
@@ -18,17 +22,16 @@ config GFS2_FS the locking module below. Documentation and utilities for GFS2 can be found here: http://sources.redhat.com/cluster - The "nolock" lock module is now built in to GFS2 by default. + The "nolock" lock module is now built in to GFS2 by default. If + you want to use the DLM, be sure to enable HOTPLUG and IPv4/6 + networking. config GFS2_FS_LOCKING_DLM - tristate "GFS2 DLM locking module" - depends on GFS2_FS && SYSFS && NET && INET && (IPV6 || IPV6=n) - select IP_SCTP if DLM_SCTP - select CONFIGFS_FS - select DLM + bool "GFS2 DLM locking" + depends on (GFS2_FS != n) && NET && INET && (IPV6 || IPV6=n) && HOTPLUG help Multiple node locking module for GFS2 - Most users of GFS2 will require this module. It provides the locking + Most users of GFS2 will require this. It provides the locking interface between GFS2 and the DLM, which is required to use GFS2 in a cluster environment.
fs/gfs2/Makefile +2 -2
@@ -1,9 +1,9 @@ obj-$(CONFIG_GFS2_FS) += gfs2.o gfs2-y := acl.o bmap.o dir.o eaops.o eattr.o glock.o \ - glops.o inode.o log.o lops.o locking.o main.o meta_io.o \ + glops.o inode.o log.o lops.o main.o meta_io.o \ mount.o ops_address.o ops_dentry.o ops_export.o ops_file.o \ ops_fstype.o ops_inode.o ops_super.o quota.o \ recovery.o rgrp.o super.o sys.o trans.o util.o -obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += locking/dlm/ +gfs2-$(CONFIG_GFS2_FS_LOCKING_DLM) += lock_dlm.o
fs/gfs2/acl.c +0 -1
@@ -15,7 +15,6 @@#include <linux/posix_acl.h> #include <linux/posix_acl_xattr.h> #include <linux/gfs2_ondisk.h> -#include <linux/lm_interface.h> #include "gfs2.h" #include "incore.h"
fs/gfs2/bmap.c +0 -1
@@ -13,7 +13,6 @@#include <linux/buffer_head.h> #include <linux/gfs2_ondisk.h> #include <linux/crc32.h> -#include <linux/lm_interface.h> #include "gfs2.h" #include "incore.h"
fs/gfs2/dir.c +0 -1
@@ -60,7 +60,6 @@#include <linux/gfs2_ondisk.h> #include <linux/crc32.h> #include <linux/vmalloc.h> -#include <linux/lm_interface.h> #include "gfs2.h" #include "incore.h"
fs/gfs2/eaops.c +0 -1
@@ -14,7 +14,6 @@#include <linux/capability.h> #include <linux/xattr.h> #include <linux/gfs2_ondisk.h> -#include <linux/lm_interface.h> #include <asm/uaccess.h> #include "gfs2.h"
fs/gfs2/eattr.c +0 -1
@@ -13,7 +13,6 @@#include <linux/buffer_head.h> #include <linux/xattr.h> #include <linux/gfs2_ondisk.h> -#include <linux/lm_interface.h> #include <asm/uaccess.h> #include "gfs2.h"
fs/gfs2/glock.c +74 -174
389 lines not on this page · raw message
fs/gfs2/glock.h +123 -4
152 lines not on this page · raw message
fs/gfs2/glops.c +0 -14
@@ -12,7 +12,6 @@#include <linux/completion.h> #include <linux/buffer_head.h> #include <linux/gfs2_ondisk.h> -#include <linux/lm_interface.h> #include <linux/bio.h> #include "gfs2.h"
@@ -390,18 +389,6 @@ static int trans_go_demote_ok(const struct gfs2_glock *gl)return 0 ; } -/** -* quota_go_demote_ok - Check to see if it's ok to unlock a quota glock -* @gl: the glock -* -* Returns: 1 if it's ok -*/ - -static int quota_go_demote_ok (const struct gfs2_glock *gl) -{ -return !atomic_read (&gl->gl_lvb_count); -} -const struct gfs2_glock_operations gfs2_meta_glops = { .go_xmote_th = meta_go_sync, .go_type =LM_TYPE_META ,
@@ -448,7 +435,6 @@ const struct gfs2_glock_operations gfs2_nondisk_glops = { };const struct gfs2_glock_operations gfs2_quota_glops = { - .go_demote_ok = quota_go_demote_ok, .go_type =LM_TYPE_QUOTA , };
fs/gfs2/incore.h +56 -5
103 lines not on this page · raw message
fs/gfs2/inode.c +6 -7
@@ -16,7 +16,6 @@#include <linux/sort.h> #include <linux/gfs2_ondisk.h> #include <linux/crc32.h> -#include <linux/lm_interface.h> #include <linux/security.h> #include <linux/time.h>
@@ -137,16 +136,16 @@ void gfs2_set_iop(struct inode *inode)if (S_ISREG (mode)) { inode->i_op = &gfs2_file_iops; -if (sdp->sd_args.ar_localflocks) - inode->i_fop = &gfs2_file_fops_nolock; +if (gfs2_localflocks (sdp)) + inode->i_fop = gfs2_file_fops_nolock;else - inode->i_fop = &gfs2_file_fops; + inode->i_fop = gfs2_file_fops; }else if (S_ISDIR (mode)) { inode->i_op = &gfs2_dir_iops; -if (sdp->sd_args.ar_localflocks) - inode->i_fop = &gfs2_dir_fops_nolock; +if (gfs2_localflocks (sdp)) + inode->i_fop = gfs2_dir_fops_nolock;else - inode->i_fop = &gfs2_dir_fops; + inode->i_fop = gfs2_dir_fops; }else if (S_ISLNK (mode)) { inode->i_op = &gfs2_symlink_iops; }else {
fs/gfs2/inode.h +18 -4
@@ -101,12 +101,26 @@ void gfs2_dinode_print(const struct gfs2_inode *ip);extern const struct inode_operations gfs2_file_iops;extern const struct inode_operations gfs2_dir_iops;extern const struct inode_operations gfs2_symlink_iops; -extern const struct file_operations gfs2_file_fops; -extern const struct file_operations gfs2_dir_fops; -extern const struct file_operations gfs2_file_fops_nolock; -extern const struct file_operations gfs2_dir_fops_nolock; +extern const struct file_operations *gfs2_file_fops_nolock; +extern const struct file_operations *gfs2_dir_fops_nolock;extern void gfs2_set_inode_flags (struct inode *inode); + +#ifdef CONFIG_GFS2_FS_LOCKING_DLM +extern const struct file_operations *gfs2_file_fops; +extern const struct file_operations *gfs2_dir_fops; +static inline int gfs2_localflocks (const struct gfs2_sbd *sdp) +{ +return sdp->sd_args.ar_localflocks; +} +#else /* Single node only */ +#define gfs2_file_fops NULL +#define gfs2_dir_fops NULL +static inline int gfs2_localflocks (const struct gfs2_sbd *sdp) +{ +return 1 ; +} +#endif /* CONFIG_GFS2_FS_LOCKING_DLM */ #endif /* __INODE_DOT_H__ */
fs/gfs2/lock_dlm.c new file +239 -0
239 lines not on this page · raw message
fs/gfs2/locking.c deleted +0 -232
232 lines not on this page · raw message
fs/gfs2/locking/dlm/Makefile deleted +0 -3
@@ -1,3 +0,0 @@ -obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += lock_dlm.o -lock_dlm-y := lock.o main.o mount.o sysfs.o thread.o -
fs/gfs2/locking/dlm/lock.c deleted +0 -708
708 lines not on this page · raw message
fs/gfs2/locking/dlm/lock_dlm.h deleted +0 -166
166 lines not on this page · raw message
fs/gfs2/locking/dlm/main.c deleted +0 -48
48 lines not on this page · raw message
fs/gfs2/locking/dlm/mount.c deleted +0 -276
276 lines not on this page · raw message
fs/gfs2/locking/dlm/sysfs.c deleted +0 -226
226 lines not on this page · raw message
fs/gfs2/locking/dlm/thread.c deleted +0 -68
68 lines not on this page · raw message
fs/gfs2/log.c +0 -1
@@ -14,7 +14,6 @@#include <linux/buffer_head.h> #include <linux/gfs2_ondisk.h> #include <linux/crc32.h> -#include <linux/lm_interface.h> #include <linux/delay.h> #include <linux/kthread.h> #include <linux/freezer.h>
fs/gfs2/lops.c +0 -1
@@ -13,7 +13,6 @@#include <linux/completion.h> #include <linux/buffer_head.h> #include <linux/gfs2_ondisk.h> -#include <linux/lm_interface.h> #include "gfs2.h" #include "incore.h"
fs/gfs2/main.c +0 -3
@@ -14,7 +14,6 @@#include <linux/module.h> #include <linux/init.h> #include <linux/gfs2_ondisk.h> -#include <linux/lm_interface.h> #include <asm/atomic.h> #include "gfs2.h"
@@ -41,8 +40,6 @@ static void gfs2_init_glock_once(void *foo)INIT_HLIST_NODE (&gl->gl_list);spin_lock_init (&gl->gl_spin);INIT_LIST_HEAD (&gl->gl_holders); - gl->gl_lvb =NULL ; -atomic_set (&gl->gl_lvb_count,0 );INIT_LIST_HEAD (&gl->gl_lru);INIT_LIST_HEAD (&gl->gl_ail_list);atomic_set (&gl->gl_ail_count,0 );
fs/gfs2/meta_io.c +0 -1
@@ -19,7 +19,6 @@#include <linux/delay.h> #include <linux/bio.h> #include <linux/gfs2_ondisk.h> -#include <linux/lm_interface.h> #include "gfs2.h" #include "incore.h"
fs/gfs2/mount.c +0 -1
@@ -12,7 +12,6 @@#include <linux/completion.h> #include <linux/buffer_head.h> #include <linux/gfs2_ondisk.h> -#include <linux/lm_interface.h> #include <linux/parser.h> #include "gfs2.h"
fs/gfs2/ops_address.c +0 -1
@@ -19,7 +19,6 @@#include <linux/writeback.h> #include <linux/swap.h> #include <linux/gfs2_ondisk.h> -#include <linux/lm_interface.h> #include <linux/backing-dev.h> #include "gfs2.h"
fs/gfs2/ops_dentry.c +0 -1
@@ -13,7 +13,6 @@#include <linux/buffer_head.h> #include <linux/gfs2_ondisk.h> #include <linux/crc32.h> -#include <linux/lm_interface.h> #include "gfs2.h" #include "incore.h"
fs/gfs2/ops_export.c +0 -1
@@ -14,7 +14,6 @@#include <linux/exportfs.h> #include <linux/gfs2_ondisk.h> #include <linux/crc32.h> -#include <linux/lm_interface.h> #include "gfs2.h" #include "incore.h"
fs/gfs2/ops_file.c +22 -52
140 lines not on this page · raw message
fs/gfs2/ops_fstype.c +94 -40
16 lines not on this page · raw message
fs/gfs2/sys.c +176 -6
182 lines not on this page · raw message
include/linux/lm_interface.h deleted +0 -277
277 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.5.5.1
Part of the diff is not shown here. View the raw message.