[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [RFC] gfs2 and gfs1 kernel modules clean up



Hi guys,

as of yesterday we did merge both gfs2 and gfs (from CVS HEAD) into the
Ubuntu kernel tree.

Here are 3 patches to tidy up a bit. 2 are against gfs2 git tree and one
against gfs-kernel CVS HEAD as of today.

(the git part can also be pulled from
http://people.ubuntu.com/~fabbione/archives/gfs2-2.6.git and it should
*hopefully* work)

commit 053a537be2c7f7edcd84feac60f0f910dc310b2c
Author: Fabio M. Di Nitto <fabbione ubuntu com>
Date:   Wed Jul 19 15:38:33 2006 +0200

    [GFS2] Move lm_interface.h to include/linux
    
    GFS and GFS2 now share lm_interface.h.
    
    GFS built from CVS HEAD does some "dirty" tricks to have lm_interface.h
    at build time.
    
    Move lm_interface.h in a sensible location and reflect the change
    in gfs2.
    
    Signed-off-by: Fabio M. Di Nitto <fabbione ubuntu com>

053a537be2c7f7edcd84feac60f0f910dc310b2c
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 3993178..25261a4 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -15,9 +15,9 @@ #include <linux/buffer_head.h>
 #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 "lm_interface.h"
 #include "incore.h"
 #include "acl.h"
 #include "eaops.h"
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 98fa07c..827f54e 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -14,9 +14,9 @@ #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "bmap.h"
 #include "glock.h"
diff --git a/fs/gfs2/daemon.c b/fs/gfs2/daemon.c
index 1453605..1929771 100644
--- a/fs/gfs2/daemon.c
+++ b/fs/gfs2/daemon.c
@@ -15,9 +15,9 @@ #include <linux/buffer_head.h>
 #include <linux/kthread.h>
 #include <linux/delay.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "daemon.h"
 #include "glock.h"
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index f62223b..cbbe478 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -61,9 +61,9 @@ #include <linux/sort.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
 #include <linux/vmalloc.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "dir.h"
 #include "glock.h"
diff --git a/fs/gfs2/eaops.c b/fs/gfs2/eaops.c
index 3ace242..1b46aca 100644
--- a/fs/gfs2/eaops.c
+++ b/fs/gfs2/eaops.c
@@ -14,10 +14,10 @@ #include <linux/completion.h>
 #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"
-#include "lm_interface.h"
 #include "incore.h"
 #include "acl.h"
 #include "eaops.h"
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index 9673693..e447ad3 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -14,10 +14,10 @@ #include <linux/completion.h>
 #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"
-#include "lm_interface.h"
 #include "incore.h"
 #include "acl.h"
 #include "eaops.h"
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 0381d4c..d23b378 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -18,10 +18,10 @@ #include <linux/jhash.h>
 #include <linux/kref.h>
 #include <linux/kallsyms.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 #include <asm/uaccess.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "glock.h"
 #include "glops.h"
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index a01874c..0d1fbf4 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -13,9 +13,9 @@ #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "bmap.h"
 #include "glock.h"
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index e76f345..f816588 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -15,10 +15,10 @@ #include <linux/buffer_head.h>
 #include <linux/posix_acl.h>
 #include <linux/sort.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 #include <linux/crc32.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "acl.h"
 #include "bmap.h"
diff --git a/fs/gfs2/lm.c b/fs/gfs2/lm.c
index f45c0ff..b1d0b5d 100644
--- a/fs/gfs2/lm.c
+++ b/fs/gfs2/lm.c
@@ -14,9 +14,9 @@ #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/delay.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "glock.h"
 #include "lm.h"
diff --git a/fs/gfs2/lm_interface.h b/fs/gfs2/lm_interface.h
deleted file mode 100644
index 9d34bf3..0000000
--- a/fs/gfs2/lm_interface.h
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
- * Copyright (C) 2004-2006 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 __LM_INTERFACE_DOT_H__
-#define __LM_INTERFACE_DOT_H__
-
-/*
- * Opaque handles represent the lock module's lockspace structure, the lock
- * module's lock structures, and GFS's file system (superblock) structure.
- */
-
-typedef void lm_lockspace_t;
-typedef void lm_lock_t;
-typedef void lm_fsdata_t;
-
-typedef void (*lm_callback_t) (lm_fsdata_t *fsdata, unsigned int type,
-			       void *data);
-
-/*
- * lm_mount() flags
- *
- * LM_MFLAG_SPECTATOR
- * GFS is asking to join the filesystem's lockspace, but it doesn't want to
- * modify the filesystem.  The lock module shouldn't assign a journal to the FS
- * mount.  It shouldn't send recovery callbacks to the FS mount.  If the node
- * dies or withdraws, all locks can be wiped immediately.
- */
-
-#define LM_MFLAG_SPECTATOR	0x00000001
-
-/*
- * lm_lockstruct flags
- *
- * LM_LSFLAG_LOCAL
- * The lock_nolock module returns LM_LSFLAG_LOCAL to GFS, indicating that GFS
- * can make single-node optimizations.
- */
-
-#define LM_LSFLAG_LOCAL		0x00000001
-
-/*
- * lm_lockname types
- */
-
-#define LM_TYPE_RESERVED	0x00
-#define LM_TYPE_NONDISK		0x01
-#define LM_TYPE_INODE		0x02
-#define LM_TYPE_RGRP		0x03
-#define LM_TYPE_META		0x04
-#define LM_TYPE_IOPEN		0x05
-#define LM_TYPE_FLOCK		0x06
-#define LM_TYPE_PLOCK		0x07
-#define LM_TYPE_QUOTA		0x08
-#define LM_TYPE_JOURNAL		0x09
-
-/*
- * lm_lock() states
- *
- * SHARED is compatible with SHARED, not with DEFERRED or EX.
- * DEFERRED is compatible with DEFERRED, not with SHARED or EX.
- */
-
-#define LM_ST_UNLOCKED		0
-#define LM_ST_EXCLUSIVE		1
-#define LM_ST_DEFERRED		2
-#define LM_ST_SHARED		3
-
-/*
- * lm_lock() flags
- *
- * LM_FLAG_TRY
- * Don't wait to acquire the lock if it can't be granted immediately.
- *
- * LM_FLAG_TRY_1CB
- * Send one blocking callback if TRY is set and the lock is not granted.
- *
- * LM_FLAG_NOEXP
- * GFS sets this flag on lock requests it makes while doing journal recovery.
- * These special requests should not be blocked due to the recovery like
- * ordinary locks would be.
- *
- * LM_FLAG_ANY
- * A SHARED request may also be granted in DEFERRED, or a DEFERRED request may
- * also be granted in SHARED.  The preferred state is whichever is compatible
- * with other granted locks, or the specified state if no other locks exist.
- *
- * LM_FLAG_PRIORITY
- * Override fairness considerations.  Suppose a lock is held in a shared state
- * and there is a pending request for the deferred state.  A shared lock
- * request with the priority flag would be allowed to bypass the deferred
- * request and directly join the other shared lock.  A shared lock request
- * without the priority flag might be forced to wait until the deferred
- * requested had acquired and released the lock.
- */
-
-#define LM_FLAG_TRY		0x00000001
-#define LM_FLAG_TRY_1CB		0x00000002
-#define LM_FLAG_NOEXP		0x00000004
-#define LM_FLAG_ANY		0x00000008
-#define LM_FLAG_PRIORITY	0x00000010
-
-/*
- * lm_lock() and lm_async_cb return flags
- *
- * LM_OUT_ST_MASK
- * Masks the lower two bits of lock state in the returned value.
- *
- * LM_OUT_CACHEABLE
- * The lock hasn't been released so GFS can continue to cache data for it.
- *
- * LM_OUT_CANCELED
- * The lock request was canceled.
- *
- * LM_OUT_ASYNC
- * The result of the request will be returned in an LM_CB_ASYNC callback.
- */
-
-#define LM_OUT_ST_MASK		0x00000003
-#define LM_OUT_CACHEABLE	0x00000004
-#define LM_OUT_CANCELED		0x00000008
-#define LM_OUT_ASYNC		0x00000080
-#define LM_OUT_ERROR		0x00000100
-
-/*
- * lm_callback_t types
- *
- * LM_CB_NEED_E LM_CB_NEED_D LM_CB_NEED_S
- * Blocking callback, a remote node is requesting the given lock in
- * EXCLUSIVE, DEFERRED, or SHARED.
- *
- * LM_CB_NEED_RECOVERY
- * The given journal needs to be recovered.
- *
- * LM_CB_DROPLOCKS
- * Reduce the number of cached locks.
- *
- * LM_CB_ASYNC
- * The given lock has been granted.
- */
-
-#define LM_CB_NEED_E		257
-#define LM_CB_NEED_D		258
-#define LM_CB_NEED_S		259
-#define LM_CB_NEED_RECOVERY	260
-#define LM_CB_DROPLOCKS		261
-#define LM_CB_ASYNC		262
-
-/*
- * lm_recovery_done() messages
- */
-
-#define LM_RD_GAVEUP		308
-#define LM_RD_SUCCESS		309
-
-
-struct lm_lockname {
-	uint64_t ln_number;
-	unsigned int ln_type;
-};
-
-#define lm_name_equal(name1, name2) \
-	(((name1)->ln_number == (name2)->ln_number) && \
-	 ((name1)->ln_type == (name2)->ln_type)) \
-
-struct lm_async_cb {
-	struct lm_lockname lc_name;
-	int lc_ret;
-};
-
-struct lm_lockstruct;
-
-struct lm_lockops {
-	char lm_proto_name[256];
-
-	/*
-	 * Mount/Unmount
-	 */
-
-	int (*lm_mount) (char *table_name, char *host_data,
-			 lm_callback_t cb, lm_fsdata_t *fsdata,
-			 unsigned int min_lvb_size, int flags,
-			 struct lm_lockstruct *lockstruct,
-			 struct kobject *fskobj);
-
-	void (*lm_others_may_mount) (lm_lockspace_t *lockspace);
-
-	void (*lm_unmount) (lm_lockspace_t *lockspace);
-
-	void (*lm_withdraw) (lm_lockspace_t *lockspace);
-
-	/*
-	 * Lock oriented operations
-	 */
-
-	int (*lm_get_lock) (lm_lockspace_t *lockspace,
-			    struct lm_lockname *name, lm_lock_t **lockp);
-
-	void (*lm_put_lock) (lm_lock_t *lock);
-
-	unsigned int (*lm_lock) (lm_lock_t *lock, unsigned int cur_state,
-				 unsigned int req_state, unsigned int flags);
-
-	unsigned int (*lm_unlock) (lm_lock_t *lock, unsigned int cur_state);
-
-	void (*lm_cancel) (lm_lock_t *lock);
-
-	int (*lm_hold_lvb) (lm_lock_t *lock, char **lvbp);
-	void (*lm_unhold_lvb) (lm_lock_t *lock, char *lvb);
-	void (*lm_sync_lvb) (lm_lock_t *lock, char *lvb);
-
-	/*
-	 * Posix Lock oriented operations
-	 */
-
-	int (*lm_plock_get) (lm_lockspace_t *lockspace,
-			     struct lm_lockname *name,
-			     struct file *file, struct file_lock *fl);
-
-	int (*lm_plock) (lm_lockspace_t *lockspace,
-			 struct lm_lockname *name,
-			 struct file *file, int cmd, struct file_lock *fl);
-
-	int (*lm_punlock) (lm_lockspace_t *lockspace,
-			   struct lm_lockname *name,
-			   struct file *file, struct file_lock *fl);
-
-	/*
-	 * Client oriented operations
-	 */
-
-	void (*lm_recovery_done) (lm_lockspace_t *lockspace, unsigned int jid,
-				  unsigned int message);
-
-	struct module *lm_owner;
-};
-
-/*
- * lm_mount() return values
- *
- * ls_jid - the journal ID this node should use
- * ls_first - this node is the first to mount the file system
- * ls_lvb_size - size in bytes of lock value blocks
- * ls_lockspace - lock module's context for this file system
- * ls_ops - lock module's functions
- * ls_flags - lock module features
- */
-
-struct lm_lockstruct {
-	unsigned int ls_jid;
-	unsigned int ls_first;
-	unsigned int ls_lvb_size;
-	lm_lockspace_t *ls_lockspace;
-	struct lm_lockops *ls_ops;
-	int ls_flags;
-};
-
-void __init gfs2_init_lmh(void);
-
-/*
- * Lock module bottom interface.  A lock module makes itself available to GFS
- * with these functions.
- *
- * For the time being, we copy the gfs1 lock module bottom interface so the
- * same lock modules can be used with both gfs1 and gfs2 (it won't be possible
- * to load both gfs1 and gfs2 at once.)  Eventually the lock modules will fork
- * for gfs1/gfs2 and this API can change to the gfs2_ prefix.
- */
-
-int gfs_register_lockproto(struct lm_lockops *proto);
-
-void gfs_unregister_lockproto(struct lm_lockops *proto);
-
-/*
- * Lock module top interface.  GFS calls these functions when mounting or
- * unmounting a file system.
- */
-
-int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
-			 lm_callback_t cb, lm_fsdata_t *fsdata,
-			 unsigned int min_lvb_size, int flags,
-			 struct lm_lockstruct *lockstruct,
-			 struct kobject *fskobj);
-
-void gfs2_unmount_lockproto(struct lm_lockstruct *lockstruct);
-
-void gfs2_withdraw_lockproto(struct lm_lockstruct *lockstruct);
-
-#endif /* __LM_INTERFACE_DOT_H__ */
-
diff --git a/fs/gfs2/locking.c b/fs/gfs2/locking.c
index 1831928..aa55e43 100644
--- a/fs/gfs2/locking.c
+++ b/fs/gfs2/locking.c
@@ -16,8 +16,7 @@ #include <linux/sched.h>
 #include <linux/kmod.h>
 #include <linux/fs.h>
 #include <linux/delay.h>
-
-#include "lm_interface.h"
+#include <linux/lm_interface.h>
 
 struct lmh_wrapper {
 	struct list_head lw_list;
diff --git a/fs/gfs2/locking/dlm/lock_dlm.h b/fs/gfs2/locking/dlm/lock_dlm.h
index 530c2f5..c8a7ef1 100644
--- a/fs/gfs2/locking/dlm/lock_dlm.h
+++ b/fs/gfs2/locking/dlm/lock_dlm.h
@@ -24,9 +24,8 @@ #include <linux/kobject.h>
 #include <linux/fcntl.h>
 #include <linux/wait.h>
 #include <net/sock.h>
-
 #include <linux/dlm.h>
-#include "../../lm_interface.h"
+#include <linux/lm_interface.h>
 
 /*
  * Internally, we prefix things with gdlm_ and GDLM_ (for gfs-dlm) since a
diff --git a/fs/gfs2/locking/nolock/main.c b/fs/gfs2/locking/nolock/main.c
index 97ffac5..b2e6c2e 100644
--- a/fs/gfs2/locking/nolock/main.c
+++ b/fs/gfs2/locking/nolock/main.c
@@ -14,8 +14,7 @@ #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/fs.h>
 #include <linux/smp_lock.h>
-
-#include "../../lm_interface.h"
+#include <linux/lm_interface.h>
 
 struct nolock_lockspace {
 	unsigned int nl_lvb_size;
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 60fdc94..24c336a 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -13,10 +13,10 @@ #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 #include <linux/crc32.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "bmap.h"
 #include "glock.h"
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index af03bf3..1a918e7 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -13,9 +13,9 @@ #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "glock.h"
 #include "log.h"
diff --git a/fs/gfs2/lvb.c b/fs/gfs2/lvb.c
index e88e9cc..5fdc088 100644
--- a/fs/gfs2/lvb.c
+++ b/fs/gfs2/lvb.c
@@ -13,9 +13,9 @@ #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "lvb.h"
 
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index c112943..e069e4c 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -15,9 +15,9 @@ #include <linux/buffer_head.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "ops_fstype.h"
 #include "sys.h"
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 42dfd32..8def564 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -18,9 +18,9 @@ #include <linux/writeback.h>
 #include <linux/swap.h>
 #include <linux/delay.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "glock.h"
 #include "glops.h"
diff --git a/fs/gfs2/mount.c b/fs/gfs2/mount.c
index 0d4b230..8968345 100644
--- a/fs/gfs2/mount.c
+++ b/fs/gfs2/mount.c
@@ -13,9 +13,9 @@ #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "mount.h"
 #include "sys.h"
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 031270a..88dfdbd 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -17,9 +17,9 @@ #include <linux/pagevec.h>
 #include <linux/mpage.h>
 #include <linux/fs.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "bmap.h"
 #include "glock.h"
diff --git a/fs/gfs2/ops_dentry.c b/fs/gfs2/ops_dentry.c
index fd55979..6963874 100644
--- a/fs/gfs2/ops_dentry.c
+++ b/fs/gfs2/ops_dentry.c
@@ -15,9 +15,9 @@ #include <linux/buffer_head.h>
 #include <linux/smp_lock.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "dir.h"
 #include "glock.h"
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index 6354f47..f9e4589 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -14,9 +14,9 @@ #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "dir.h"
 #include "glock.h"
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 26f1d32..8219db2 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -19,13 +19,13 @@ #include <linux/mm.h>
 #include <linux/smp_lock.h>
 #include <linux/fs.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 #include <linux/ext2_fs.h>
 #include <linux/crc32.h>
 #include <linux/iflags.h>
 #include <asm/uaccess.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "bmap.h"
 #include "dir.h"
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index a86ce67..b267964 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -16,9 +16,9 @@ #include <linux/vmalloc.h>
 #include <linux/blkdev.h>
 #include <linux/kthread.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "daemon.h"
 #include "glock.h"
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index caecafe..19c2d4a 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -18,11 +18,11 @@ #include <linux/mm.h>
 #include <linux/xattr.h>
 #include <linux/posix_acl.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 #include <linux/crc32.h>
 #include <asm/uaccess.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "acl.h"
 #include "bmap.h"
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c
index 50ea7f2..e13866f 100644
--- a/fs/gfs2/ops_super.c
+++ b/fs/gfs2/ops_super.c
@@ -19,10 +19,10 @@ #include <linux/mount.h>
 #include <linux/kthread.h>
 #include <linux/delay.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 #include <linux/crc32.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "glock.h"
 #include "inode.h"
diff --git a/fs/gfs2/ops_vm.c b/fs/gfs2/ops_vm.c
index 08709f1..2711b48 100644
--- a/fs/gfs2/ops_vm.c
+++ b/fs/gfs2/ops_vm.c
@@ -15,9 +15,9 @@ #include <linux/buffer_head.h>
 #include <linux/mm.h>
 #include <linux/pagemap.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "bmap.h"
 #include "glock.h"
diff --git a/fs/gfs2/page.c b/fs/gfs2/page.c
index b93caf2..c84743a 100644
--- a/fs/gfs2/page.c
+++ b/fs/gfs2/page.c
@@ -15,9 +15,9 @@ #include <linux/buffer_head.h>
 #include <linux/pagemap.h>
 #include <linux/mm.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "bmap.h"
 #include "inode.h"
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 3ca65c3..562ac24 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -44,9 +44,9 @@ #include <linux/buffer_head.h>
 #include <linux/sort.h>
 #include <linux/fs.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "bmap.h"
 #include "glock.h"
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 7aabc03..ff5e254 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -14,9 +14,9 @@ #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "bmap.h"
 #include "glock.h"
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 65eea0b..b185508 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -14,9 +14,9 @@ #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/fs.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "glock.h"
 #include "glops.h"
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index f2d2876..00f1053 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -14,9 +14,9 @@ #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/crc32.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "bmap.h"
 #include "dir.h"
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 3c4cb45..303547c 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -15,10 +15,10 @@ #include <linux/buffer_head.h>
 #include <linux/module.h>
 #include <linux/kobject.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 #include <asm/uaccess.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "lm.h"
 #include "sys.h"
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 05e0b72..f44d68b 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -13,10 +13,10 @@ #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 #include <linux/kallsyms.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "glock.h"
 #include "log.h"
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index 39e67b1..fbc82c4 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -14,10 +14,10 @@ #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/crc32.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 #include <asm/uaccess.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "glock.h"
 #include "lm.h"
diff --git a/include/linux/lm_interface.h b/include/linux/lm_interface.h
new file mode 100644
index 0000000..9d34bf3
--- /dev/null
+++ b/include/linux/lm_interface.h
@@ -0,0 +1,295 @@
+/*
+ * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
+ * Copyright (C) 2004-2006 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 __LM_INTERFACE_DOT_H__
+#define __LM_INTERFACE_DOT_H__
+
+/*
+ * Opaque handles represent the lock module's lockspace structure, the lock
+ * module's lock structures, and GFS's file system (superblock) structure.
+ */
+
+typedef void lm_lockspace_t;
+typedef void lm_lock_t;
+typedef void lm_fsdata_t;
+
+typedef void (*lm_callback_t) (lm_fsdata_t *fsdata, unsigned int type,
+			       void *data);
+
+/*
+ * lm_mount() flags
+ *
+ * LM_MFLAG_SPECTATOR
+ * GFS is asking to join the filesystem's lockspace, but it doesn't want to
+ * modify the filesystem.  The lock module shouldn't assign a journal to the FS
+ * mount.  It shouldn't send recovery callbacks to the FS mount.  If the node
+ * dies or withdraws, all locks can be wiped immediately.
+ */
+
+#define LM_MFLAG_SPECTATOR	0x00000001
+
+/*
+ * lm_lockstruct flags
+ *
+ * LM_LSFLAG_LOCAL
+ * The lock_nolock module returns LM_LSFLAG_LOCAL to GFS, indicating that GFS
+ * can make single-node optimizations.
+ */
+
+#define LM_LSFLAG_LOCAL		0x00000001
+
+/*
+ * lm_lockname types
+ */
+
+#define LM_TYPE_RESERVED	0x00
+#define LM_TYPE_NONDISK		0x01
+#define LM_TYPE_INODE		0x02
+#define LM_TYPE_RGRP		0x03
+#define LM_TYPE_META		0x04
+#define LM_TYPE_IOPEN		0x05
+#define LM_TYPE_FLOCK		0x06
+#define LM_TYPE_PLOCK		0x07
+#define LM_TYPE_QUOTA		0x08
+#define LM_TYPE_JOURNAL		0x09
+
+/*
+ * lm_lock() states
+ *
+ * SHARED is compatible with SHARED, not with DEFERRED or EX.
+ * DEFERRED is compatible with DEFERRED, not with SHARED or EX.
+ */
+
+#define LM_ST_UNLOCKED		0
+#define LM_ST_EXCLUSIVE		1
+#define LM_ST_DEFERRED		2
+#define LM_ST_SHARED		3
+
+/*
+ * lm_lock() flags
+ *
+ * LM_FLAG_TRY
+ * Don't wait to acquire the lock if it can't be granted immediately.
+ *
+ * LM_FLAG_TRY_1CB
+ * Send one blocking callback if TRY is set and the lock is not granted.
+ *
+ * LM_FLAG_NOEXP
+ * GFS sets this flag on lock requests it makes while doing journal recovery.
+ * These special requests should not be blocked due to the recovery like
+ * ordinary locks would be.
+ *
+ * LM_FLAG_ANY
+ * A SHARED request may also be granted in DEFERRED, or a DEFERRED request may
+ * also be granted in SHARED.  The preferred state is whichever is compatible
+ * with other granted locks, or the specified state if no other locks exist.
+ *
+ * LM_FLAG_PRIORITY
+ * Override fairness considerations.  Suppose a lock is held in a shared state
+ * and there is a pending request for the deferred state.  A shared lock
+ * request with the priority flag would be allowed to bypass the deferred
+ * request and directly join the other shared lock.  A shared lock request
+ * without the priority flag might be forced to wait until the deferred
+ * requested had acquired and released the lock.
+ */
+
+#define LM_FLAG_TRY		0x00000001
+#define LM_FLAG_TRY_1CB		0x00000002
+#define LM_FLAG_NOEXP		0x00000004
+#define LM_FLAG_ANY		0x00000008
+#define LM_FLAG_PRIORITY	0x00000010
+
+/*
+ * lm_lock() and lm_async_cb return flags
+ *
+ * LM_OUT_ST_MASK
+ * Masks the lower two bits of lock state in the returned value.
+ *
+ * LM_OUT_CACHEABLE
+ * The lock hasn't been released so GFS can continue to cache data for it.
+ *
+ * LM_OUT_CANCELED
+ * The lock request was canceled.
+ *
+ * LM_OUT_ASYNC
+ * The result of the request will be returned in an LM_CB_ASYNC callback.
+ */
+
+#define LM_OUT_ST_MASK		0x00000003
+#define LM_OUT_CACHEABLE	0x00000004
+#define LM_OUT_CANCELED		0x00000008
+#define LM_OUT_ASYNC		0x00000080
+#define LM_OUT_ERROR		0x00000100
+
+/*
+ * lm_callback_t types
+ *
+ * LM_CB_NEED_E LM_CB_NEED_D LM_CB_NEED_S
+ * Blocking callback, a remote node is requesting the given lock in
+ * EXCLUSIVE, DEFERRED, or SHARED.
+ *
+ * LM_CB_NEED_RECOVERY
+ * The given journal needs to be recovered.
+ *
+ * LM_CB_DROPLOCKS
+ * Reduce the number of cached locks.
+ *
+ * LM_CB_ASYNC
+ * The given lock has been granted.
+ */
+
+#define LM_CB_NEED_E		257
+#define LM_CB_NEED_D		258
+#define LM_CB_NEED_S		259
+#define LM_CB_NEED_RECOVERY	260
+#define LM_CB_DROPLOCKS		261
+#define LM_CB_ASYNC		262
+
+/*
+ * lm_recovery_done() messages
+ */
+
+#define LM_RD_GAVEUP		308
+#define LM_RD_SUCCESS		309
+
+
+struct lm_lockname {
+	uint64_t ln_number;
+	unsigned int ln_type;
+};
+
+#define lm_name_equal(name1, name2) \
+	(((name1)->ln_number == (name2)->ln_number) && \
+	 ((name1)->ln_type == (name2)->ln_type)) \
+
+struct lm_async_cb {
+	struct lm_lockname lc_name;
+	int lc_ret;
+};
+
+struct lm_lockstruct;
+
+struct lm_lockops {
+	char lm_proto_name[256];
+
+	/*
+	 * Mount/Unmount
+	 */
+
+	int (*lm_mount) (char *table_name, char *host_data,
+			 lm_callback_t cb, lm_fsdata_t *fsdata,
+			 unsigned int min_lvb_size, int flags,
+			 struct lm_lockstruct *lockstruct,
+			 struct kobject *fskobj);
+
+	void (*lm_others_may_mount) (lm_lockspace_t *lockspace);
+
+	void (*lm_unmount) (lm_lockspace_t *lockspace);
+
+	void (*lm_withdraw) (lm_lockspace_t *lockspace);
+
+	/*
+	 * Lock oriented operations
+	 */
+
+	int (*lm_get_lock) (lm_lockspace_t *lockspace,
+			    struct lm_lockname *name, lm_lock_t **lockp);
+
+	void (*lm_put_lock) (lm_lock_t *lock);
+
+	unsigned int (*lm_lock) (lm_lock_t *lock, unsigned int cur_state,
+				 unsigned int req_state, unsigned int flags);
+
+	unsigned int (*lm_unlock) (lm_lock_t *lock, unsigned int cur_state);
+
+	void (*lm_cancel) (lm_lock_t *lock);
+
+	int (*lm_hold_lvb) (lm_lock_t *lock, char **lvbp);
+	void (*lm_unhold_lvb) (lm_lock_t *lock, char *lvb);
+	void (*lm_sync_lvb) (lm_lock_t *lock, char *lvb);
+
+	/*
+	 * Posix Lock oriented operations
+	 */
+
+	int (*lm_plock_get) (lm_lockspace_t *lockspace,
+			     struct lm_lockname *name,
+			     struct file *file, struct file_lock *fl);
+
+	int (*lm_plock) (lm_lockspace_t *lockspace,
+			 struct lm_lockname *name,
+			 struct file *file, int cmd, struct file_lock *fl);
+
+	int (*lm_punlock) (lm_lockspace_t *lockspace,
+			   struct lm_lockname *name,
+			   struct file *file, struct file_lock *fl);
+
+	/*
+	 * Client oriented operations
+	 */
+
+	void (*lm_recovery_done) (lm_lockspace_t *lockspace, unsigned int jid,
+				  unsigned int message);
+
+	struct module *lm_owner;
+};
+
+/*
+ * lm_mount() return values
+ *
+ * ls_jid - the journal ID this node should use
+ * ls_first - this node is the first to mount the file system
+ * ls_lvb_size - size in bytes of lock value blocks
+ * ls_lockspace - lock module's context for this file system
+ * ls_ops - lock module's functions
+ * ls_flags - lock module features
+ */
+
+struct lm_lockstruct {
+	unsigned int ls_jid;
+	unsigned int ls_first;
+	unsigned int ls_lvb_size;
+	lm_lockspace_t *ls_lockspace;
+	struct lm_lockops *ls_ops;
+	int ls_flags;
+};
+
+void __init gfs2_init_lmh(void);
+
+/*
+ * Lock module bottom interface.  A lock module makes itself available to GFS
+ * with these functions.
+ *
+ * For the time being, we copy the gfs1 lock module bottom interface so the
+ * same lock modules can be used with both gfs1 and gfs2 (it won't be possible
+ * to load both gfs1 and gfs2 at once.)  Eventually the lock modules will fork
+ * for gfs1/gfs2 and this API can change to the gfs2_ prefix.
+ */
+
+int gfs_register_lockproto(struct lm_lockops *proto);
+
+void gfs_unregister_lockproto(struct lm_lockops *proto);
+
+/*
+ * Lock module top interface.  GFS calls these functions when mounting or
+ * unmounting a file system.
+ */
+
+int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
+			 lm_callback_t cb, lm_fsdata_t *fsdata,
+			 unsigned int min_lvb_size, int flags,
+			 struct lm_lockstruct *lockstruct,
+			 struct kobject *fskobj);
+
+void gfs2_unmount_lockproto(struct lm_lockstruct *lockstruct);
+
+void gfs2_withdraw_lockproto(struct lm_lockstruct *lockstruct);
+
+#endif /* __LM_INTERFACE_DOT_H__ */
+

commit b87df530bb0a9e271397cb6b02d749943460727f
Author: Fabio M. Di Nitto <fabbione ubuntu com>
Date:   Wed Jul 19 15:40:17 2006 +0200

    [GFS2] Export symbols required by GFS
    
    GFS and GFS2 now share locking mechanisms in the kernel.
    
    Export the symbols required by GFS CVS HEAD.
    
    Signed-off-by: Fabio M. Di Nitto <fabbione ubuntu com>

b87df530bb0a9e271397cb6b02d749943460727f
diff --git a/fs/gfs2/locking.c b/fs/gfs2/locking.c
index aa55e43..f21d1e8 100644
--- a/fs/gfs2/locking.c
+++ b/fs/gfs2/locking.c
@@ -187,4 +187,6 @@ void __init gfs2_init_lmh(void)
 
 EXPORT_SYMBOL_GPL(gfs_register_lockproto);
 EXPORT_SYMBOL_GPL(gfs_unregister_lockproto);
-
+EXPORT_SYMBOL_GPL(gfs2_unmount_lockproto);
+EXPORT_SYMBOL_GPL(gfs2_withdraw_lockproto);
+EXPORT_SYMBOL_GPL(gfs2_mount_lockproto);

Make gfs1 use common lm_interface.h. It assumes that we are configuring
--kernel_src= to point to the correct source... (doh! ;))

Index: gfs-kernel/src/gfs/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- gfs-kernel/src/gfs/Makefile	18 Jul 2006 20:48:20 -0000	1.13
+++ gfs-kernel/src/gfs/Makefile	19 Jul 2006 13:54:45 -0000
@@ -68,9 +68,8 @@
 EXTRA_CFLAGS += -I$(obj) -I${incdir} -I/usr/include 
 
 all:
-	rm -f linux lm_interface.h
+	rm -f linux
 	ln -s . linux
-	ln -s ${KERNEL_SRC}/fs/gfs2/lm_interface.h .
 	${MAKE} -C ${KERNEL_SRC} M=${PWD} symverfile=${SYMVERFILE} modules USING_KBUILD=yes
 
 install: all
Index: gfs-kernel/src/gfs/glock.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/glock.c,v
retrieving revision 1.27
diff -u -r1.27 glock.c
--- gfs-kernel/src/gfs/glock.c	10 Jul 2006 23:22:34 -0000	1.27
+++ gfs-kernel/src/gfs/glock.c	19 Jul 2006 13:54:46 -0000
@@ -19,9 +19,9 @@
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <asm/uaccess.h>
+#include <linux/lm_interface.h>
 
 #include "gfs.h"
-#include "lm_interface.h"
 #include "dio.h"
 #include "glock.h"
 #include "glops.h"
Index: gfs-kernel/src/gfs/lm.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/lm.c,v
retrieving revision 1.13
diff -u -r1.13 lm.c
--- gfs-kernel/src/gfs/lm.c	11 Jul 2006 17:29:24 -0000	1.13
+++ gfs-kernel/src/gfs/lm.c	19 Jul 2006 13:54:46 -0000
@@ -14,9 +14,9 @@
 #include <linux/buffer_head.h>
 #include <linux/delay.h>
 #include <linux/gfs_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "glock.h"
 #include "lm.h"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]