[GFS2] Remove lm.[ch] and distribute content
authorSteven Whitehouse <swhiteho@redhat.com>
Wed, 30 Jan 2008 15:34:04 +0000 (15:34 +0000)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 31 Mar 2008 09:40:26 +0000 (10:40 +0100)
The functions in lm.c were just wrappers which were mostly
only used in one other file. By moving the functions to
the files where they are being used, they can be marked
static and also this will usually result in them being inlined
since they are often only used from one point in the code.

A couple of really trivial functions have been inlined by hand
into the function which called them as it makes the code clearer
to do that.

We also gain from one fewer function call in the glock lock and
unlock paths.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
13 files changed:
fs/gfs2/Makefile
fs/gfs2/glock.c
fs/gfs2/incore.h
fs/gfs2/lm.c [deleted file]
fs/gfs2/lm.h [deleted file]
fs/gfs2/ops_file.c
fs/gfs2/ops_fstype.c
fs/gfs2/ops_super.c
fs/gfs2/recovery.c
fs/gfs2/super.h
fs/gfs2/sys.c
fs/gfs2/util.c
fs/gfs2/util.h

index 8fff11058cee5b28e7cd0d4b22843dbd93d6a349..e2350df02a0746ea8eb9ef784737678a4bf29b65 100644 (file)
@@ -1,6 +1,6 @@
 obj-$(CONFIG_GFS2_FS) += gfs2.o
 gfs2-y := acl.o bmap.o daemon.o dir.o eaops.o eattr.o glock.o \
-       glops.o inode.o lm.o log.o lops.o locking.o main.o meta_io.o \
+       glops.o inode.o log.o lops.o locking.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
index a8387e0b50684f5993184ab10cc4cb92439e6206..611f84d225738f763e53f4c6c68480869c0be30b 100644 (file)
@@ -35,7 +35,6 @@
 #include "glock.h"
 #include "glops.h"
 #include "inode.h"
-#include "lm.h"
 #include "lops.h"
 #include "meta_io.h"
 #include "quota.h"
@@ -183,7 +182,8 @@ static void glock_free(struct gfs2_glock *gl)
        struct gfs2_sbd *sdp = gl->gl_sbd;
        struct inode *aspace = gl->gl_aspace;
 
-       gfs2_lm_put_lock(sdp, gl->gl_lock);
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               sdp->sd_lockstruct.ls_ops->lm_put_lock(gl->gl_lock);
 
        if (aspace)
                gfs2_aspace_put(aspace);
@@ -293,6 +293,16 @@ static void glock_work_func(struct work_struct *work)
        gfs2_glock_put(gl);
 }
 
+static int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
+                    void **lockp)
+{
+       int error = -EIO;
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               error = sdp->sd_lockstruct.ls_ops->lm_get_lock(
+                               sdp->sd_lockstruct.ls_lockspace, name, lockp);
+       return error;
+}
+
 /**
  * gfs2_glock_get() - Get a glock, or create one if one doesn't exist
  * @sdp: The GFS2 superblock
@@ -882,6 +892,17 @@ out:
                gfs2_holder_wake(gh);
 }
 
+static unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock,
+                                unsigned int cur_state, unsigned int req_state,
+                                unsigned int flags)
+{
+       int ret = 0;
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               ret = sdp->sd_lockstruct.ls_ops->lm_lock(lock, cur_state,
+                                                        req_state, flags);
+       return ret;
+}
+
 /**
  * gfs2_glock_xmote_th - Call into the lock module to acquire or change a glock
  * @gl: The glock in question
@@ -922,6 +943,15 @@ static void gfs2_glock_xmote_th(struct gfs2_glock *gl, struct gfs2_holder *gh)
                xmote_bh(gl, lck_ret);
 }
 
+static unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, void *lock,
+                                  unsigned int cur_state)
+{
+       int ret = 0;
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               ret =  sdp->sd_lockstruct.ls_ops->lm_unlock(lock, cur_state);
+       return ret;
+}
+
 /**
  * gfs2_glock_drop_th - call into the lock module to unlock a lock
  * @gl: the glock
@@ -964,6 +994,7 @@ static void gfs2_glock_drop_th(struct gfs2_glock *gl)
 static void do_cancels(struct gfs2_holder *gh)
 {
        struct gfs2_glock *gl = gh->gh_gl;
+       struct gfs2_sbd *sdp = gl->gl_sbd;
 
        spin_lock(&gl->gl_spin);
 
@@ -972,7 +1003,8 @@ static void do_cancels(struct gfs2_holder *gh)
               !list_empty(&gh->gh_list)) {
                if (!(gl->gl_req_gh && (gl->gl_req_gh->gh_flags & GL_NOCANCEL))) {
                        spin_unlock(&gl->gl_spin);
-                       gfs2_lm_cancel(gl->gl_sbd, gl->gl_lock);
+                       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+                               sdp->sd_lockstruct.ls_ops->lm_cancel(gl->gl_lock);
                        msleep(100);
                        spin_lock(&gl->gl_spin);
                } else {
@@ -1426,6 +1458,14 @@ void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs)
                gfs2_glock_dq_uninit(&ghs[x]);
 }
 
+static int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp)
+{
+       int error = -EIO;
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               error = sdp->sd_lockstruct.ls_ops->lm_hold_lvb(lock, lvbp);
+       return error;
+}
+
 /**
  * gfs2_lvb_hold - attach a LVB from a glock
  * @gl: The glock in question
@@ -1461,12 +1501,15 @@ int gfs2_lvb_hold(struct gfs2_glock *gl)
 
 void gfs2_lvb_unhold(struct gfs2_glock *gl)
 {
+       struct gfs2_sbd *sdp = gl->gl_sbd;
+
        gfs2_glock_hold(gl);
        gfs2_glmutex_lock(gl);
 
        gfs2_assert(gl->gl_sbd, atomic_read(&gl->gl_lvb_count) > 0);
        if (atomic_dec_and_test(&gl->gl_lvb_count)) {
-               gfs2_lm_unhold_lvb(gl->gl_sbd, gl->gl_lock, gl->gl_lvb);
+               if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+                       sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(gl->gl_lock, gl->gl_lvb);
                gl->gl_lvb = NULL;
                gfs2_glock_put(gl);
        }
index 65aa46acb0820df78f2b07e389f3b88cf09d2a3e..8dee4672c3d8af34cd0c2ecce1c8f34ce8becb0e 100644 (file)
@@ -211,6 +211,8 @@ struct gfs2_glock {
        struct delayed_work gl_work;
 };
 
+#define GFS2_MIN_LVB_SIZE 32   /* Min size of LVB that gfs2 supports */
+
 struct gfs2_alloc {
        /* Quota stuff */
 
diff --git a/fs/gfs2/lm.c b/fs/gfs2/lm.c
deleted file mode 100644 (file)
index cfcc39b..0000000
+++ /dev/null
@@ -1,210 +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 version 2.
- */
-
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-#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 "incore.h"
-#include "glock.h"
-#include "lm.h"
-#include "super.h"
-#include "util.h"
-
-/**
- * gfs2_lm_mount - mount a locking protocol
- * @sdp: the filesystem
- * @args: mount arguements
- * @silent: if 1, don't complain if the FS isn't a GFS2 fs
- *
- * Returns: errno
- */
-
-int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
-{
-       char *proto = sdp->sd_proto_name;
-       char *table = sdp->sd_table_name;
-       int flags = 0;
-       int error;
-
-       if (sdp->sd_args.ar_spectator)
-               flags |= LM_MFLAG_SPECTATOR;
-
-       fs_info(sdp, "Trying to join cluster \"%s\", \"%s\"\n", proto, table);
-
-       error = gfs2_mount_lockproto(proto, table, sdp->sd_args.ar_hostdata,
-                                    gfs2_glock_cb, sdp,
-                                    GFS2_MIN_LVB_SIZE, flags,
-                                    &sdp->sd_lockstruct, &sdp->sd_kobj);
-       if (error) {
-               fs_info(sdp, "can't mount proto=%s, table=%s, hostdata=%s\n",
-                       proto, table, sdp->sd_args.ar_hostdata);
-               goto out;
-       }
-
-       if (gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_lockspace) ||
-           gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_ops) ||
-           gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_lvb_size >=
-                                 GFS2_MIN_LVB_SIZE)) {
-               gfs2_unmount_lockproto(&sdp->sd_lockstruct);
-               goto out;
-       }
-
-       if (sdp->sd_args.ar_spectator)
-               snprintf(sdp->sd_fsname, GFS2_FSNAME_LEN, "%s.s", table);
-       else
-               snprintf(sdp->sd_fsname, GFS2_FSNAME_LEN, "%s.%u", table,
-                        sdp->sd_lockstruct.ls_jid);
-
-       fs_info(sdp, "Joined cluster. Now mounting FS...\n");
-
-       if ((sdp->sd_lockstruct.ls_flags & LM_LSFLAG_LOCAL) &&
-           !sdp->sd_args.ar_ignore_local_fs) {
-               sdp->sd_args.ar_localflocks = 1;
-               sdp->sd_args.ar_localcaching = 1;
-       }
-
-out:
-       return error;
-}
-
-void gfs2_lm_others_may_mount(struct gfs2_sbd *sdp)
-{
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               sdp->sd_lockstruct.ls_ops->lm_others_may_mount(
-                                       sdp->sd_lockstruct.ls_lockspace);
-}
-
-void gfs2_lm_unmount(struct gfs2_sbd *sdp)
-{
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               gfs2_unmount_lockproto(&sdp->sd_lockstruct);
-}
-
-int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
-{
-       va_list args;
-
-       if (test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-               return 0;
-
-       va_start(args, fmt);
-       vprintk(fmt, args);
-       va_end(args);
-
-       fs_err(sdp, "about to withdraw this file system\n");
-       BUG_ON(sdp->sd_args.ar_debug);
-
-       fs_err(sdp, "telling LM to withdraw\n");
-       gfs2_withdraw_lockproto(&sdp->sd_lockstruct);
-       fs_err(sdp, "withdrawn\n");
-       dump_stack();
-
-       return -1;
-}
-
-int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
-                    void **lockp)
-{
-       int error = -EIO;
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               error = sdp->sd_lockstruct.ls_ops->lm_get_lock(
-                               sdp->sd_lockstruct.ls_lockspace, name, lockp);
-       return error;
-}
-
-void gfs2_lm_put_lock(struct gfs2_sbd *sdp, void *lock)
-{
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               sdp->sd_lockstruct.ls_ops->lm_put_lock(lock);
-}
-
-unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock,
-                         unsigned int cur_state, unsigned int req_state,
-                         unsigned int flags)
-{
-       int ret = 0;
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               ret = sdp->sd_lockstruct.ls_ops->lm_lock(lock, cur_state,
-                                                        req_state, flags);
-       return ret;
-}
-
-unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, void *lock,
-                           unsigned int cur_state)
-{
-       int ret = 0;
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               ret =  sdp->sd_lockstruct.ls_ops->lm_unlock(lock, cur_state);
-       return ret;
-}
-
-void gfs2_lm_cancel(struct gfs2_sbd *sdp, void *lock)
-{
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               sdp->sd_lockstruct.ls_ops->lm_cancel(lock);
-}
-
-int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp)
-{
-       int error = -EIO;
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               error = sdp->sd_lockstruct.ls_ops->lm_hold_lvb(lock, lvbp);
-       return error;
-}
-
-void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, void *lock, char *lvb)
-{
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(lock, lvb);
-}
-
-int gfs2_lm_plock_get(struct gfs2_sbd *sdp, struct lm_lockname *name,
-                     struct file *file, struct file_lock *fl)
-{
-       int error = -EIO;
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               error = sdp->sd_lockstruct.ls_ops->lm_plock_get(
-                               sdp->sd_lockstruct.ls_lockspace, name, file, fl);
-       return error;
-}
-
-int gfs2_lm_plock(struct gfs2_sbd *sdp, struct lm_lockname *name,
-                 struct file *file, int cmd, struct file_lock *fl)
-{
-       int error = -EIO;
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               error = sdp->sd_lockstruct.ls_ops->lm_plock(
-                               sdp->sd_lockstruct.ls_lockspace, name, file, cmd, fl);
-       return error;
-}
-
-int gfs2_lm_punlock(struct gfs2_sbd *sdp, struct lm_lockname *name,
-                   struct file *file, struct file_lock *fl)
-{
-       int error = -EIO;
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               error = sdp->sd_lockstruct.ls_ops->lm_punlock(
-                               sdp->sd_lockstruct.ls_lockspace, name, file, fl);
-       return error;
-}
-
-void gfs2_lm_recovery_done(struct gfs2_sbd *sdp, unsigned int jid,
-                          unsigned int message)
-{
-       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
-               sdp->sd_lockstruct.ls_ops->lm_recovery_done(
-                       sdp->sd_lockstruct.ls_lockspace, jid, message);
-}
-
diff --git a/fs/gfs2/lm.h b/fs/gfs2/lm.h
deleted file mode 100644 (file)
index 21cdc30..0000000
+++ /dev/null
@@ -1,42 +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 version 2.
- */
-
-#ifndef __LM_DOT_H__
-#define __LM_DOT_H__
-
-struct gfs2_sbd;
-
-#define GFS2_MIN_LVB_SIZE 32
-
-int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent);
-void gfs2_lm_others_may_mount(struct gfs2_sbd *sdp);
-void gfs2_lm_unmount(struct gfs2_sbd *sdp);
-int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
-                               __attribute__ ((format(printf, 2, 3)));
-int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
-                    void **lockp);
-void gfs2_lm_put_lock(struct gfs2_sbd *sdp, void *lock);
-unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock,
-                        unsigned int cur_state, unsigned int req_state,
-                        unsigned int flags);
-unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, void *lock,
-                          unsigned int cur_state);
-void gfs2_lm_cancel(struct gfs2_sbd *sdp, void *lock);
-int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp);
-void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, void *lock, char *lvb);
-int gfs2_lm_plock_get(struct gfs2_sbd *sdp, struct lm_lockname *name,
-                     struct file *file, struct file_lock *fl);
-int gfs2_lm_plock(struct gfs2_sbd *sdp, struct lm_lockname *name,
-                 struct file *file, int cmd, struct file_lock *fl);
-int gfs2_lm_punlock(struct gfs2_sbd *sdp, struct lm_lockname *name,
-                   struct file *file, struct file_lock *fl);
-void gfs2_lm_recovery_done(struct gfs2_sbd *sdp, unsigned int jid,
-                          unsigned int message);
-
-#endif /* __LM_DOT_H__ */
index f4842f2548cdb8c55346836aab9f287370e4e9f1..f97a8b86c485901b58dce283b018f2d1933250ff 100644 (file)
@@ -30,7 +30,6 @@
 #include "glock.h"
 #include "glops.h"
 #include "inode.h"
-#include "lm.h"
 #include "log.h"
 #include "meta_io.h"
 #include "quota.h"
@@ -596,6 +595,36 @@ static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl)
        return generic_setlease(file, arg, fl);
 }
 
+static int gfs2_lm_plock_get(struct gfs2_sbd *sdp, struct lm_lockname *name,
+                     struct file *file, struct file_lock *fl)
+{
+       int error = -EIO;
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               error = sdp->sd_lockstruct.ls_ops->lm_plock_get(
+                               sdp->sd_lockstruct.ls_lockspace, name, file, fl);
+       return error;
+}
+
+static int gfs2_lm_plock(struct gfs2_sbd *sdp, struct lm_lockname *name,
+                 struct file *file, int cmd, struct file_lock *fl)
+{
+       int error = -EIO;
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               error = sdp->sd_lockstruct.ls_ops->lm_plock(
+                               sdp->sd_lockstruct.ls_lockspace, name, file, cmd, fl);
+       return error;
+}
+
+static int gfs2_lm_punlock(struct gfs2_sbd *sdp, struct lm_lockname *name,
+                   struct file *file, struct file_lock *fl)
+{
+       int error = -EIO;
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               error = sdp->sd_lockstruct.ls_ops->lm_punlock(
+                               sdp->sd_lockstruct.ls_lockspace, name, file, fl);
+       return error;
+}
+
 /**
  * gfs2_lock - acquire/release a posix lock on a file
  * @file: the file pointer
index 4bee6aa845e430d00ec4254277f9fa91aa5d5175..5b6a34517167f03c5c22df8edde19160456cd121 100644 (file)
@@ -26,7 +26,6 @@
 #include "glock.h"
 #include "glops.h"
 #include "inode.h"
-#include "lm.h"
 #include "mount.h"
 #include "ops_fstype.h"
 #include "ops_dentry.h"
@@ -363,6 +362,13 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
        return rc;
 }
 
+static void gfs2_lm_others_may_mount(struct gfs2_sbd *sdp)
+{
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               sdp->sd_lockstruct.ls_ops->lm_others_may_mount(
+                                       sdp->sd_lockstruct.ls_lockspace);
+}
+
 static int init_journal(struct gfs2_sbd *sdp, int undo)
 {
        struct gfs2_holder ji_gh;
@@ -704,6 +710,69 @@ fail:
        return error;
 }
 
+/**
+ * gfs2_lm_mount - mount a locking protocol
+ * @sdp: the filesystem
+ * @args: mount arguements
+ * @silent: if 1, don't complain if the FS isn't a GFS2 fs
+ *
+ * Returns: errno
+ */
+
+static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
+{
+       char *proto = sdp->sd_proto_name;
+       char *table = sdp->sd_table_name;
+       int flags = 0;
+       int error;
+
+       if (sdp->sd_args.ar_spectator)
+               flags |= LM_MFLAG_SPECTATOR;
+
+       fs_info(sdp, "Trying to join cluster \"%s\", \"%s\"\n", proto, table);
+
+       error = gfs2_mount_lockproto(proto, table, sdp->sd_args.ar_hostdata,
+                                    gfs2_glock_cb, sdp,
+                                    GFS2_MIN_LVB_SIZE, flags,
+                                    &sdp->sd_lockstruct, &sdp->sd_kobj);
+       if (error) {
+               fs_info(sdp, "can't mount proto=%s, table=%s, hostdata=%s\n",
+                       proto, table, sdp->sd_args.ar_hostdata);
+               goto out;
+       }
+
+       if (gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_lockspace) ||
+           gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_ops) ||
+           gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_lvb_size >=
+                                 GFS2_MIN_LVB_SIZE)) {
+               gfs2_unmount_lockproto(&sdp->sd_lockstruct);
+               goto out;
+       }
+
+       if (sdp->sd_args.ar_spectator)
+               snprintf(sdp->sd_fsname, GFS2_FSNAME_LEN, "%s.s", table);
+       else
+               snprintf(sdp->sd_fsname, GFS2_FSNAME_LEN, "%s.%u", table,
+                        sdp->sd_lockstruct.ls_jid);
+
+       fs_info(sdp, "Joined cluster. Now mounting FS...\n");
+
+       if ((sdp->sd_lockstruct.ls_flags & LM_LSFLAG_LOCAL) &&
+           !sdp->sd_args.ar_ignore_local_fs) {
+               sdp->sd_args.ar_localflocks = 1;
+               sdp->sd_args.ar_localcaching = 1;
+       }
+
+out:
+       return error;
+}
+
+void gfs2_lm_unmount(struct gfs2_sbd *sdp)
+{
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               gfs2_unmount_lockproto(&sdp->sd_lockstruct);
+}
+
 /**
  * fill_super - Read in superblock
  * @sb: The VFS superblock
index 5e524217944a14b9862a618fb6d68f68cf8abbfe..2278c68b7e35cd8f1ee5395f8db6ffb908d9d77c 100644 (file)
@@ -25,7 +25,6 @@
 #include "incore.h"
 #include "glock.h"
 #include "inode.h"
-#include "lm.h"
 #include "log.h"
 #include "mount.h"
 #include "ops_super.h"
index 6fb07d67ca8a41bef05b1940a6831fb2b2764139..b17d3b8b2321f66499a880ebc2405ca098afb5f4 100644 (file)
@@ -20,7 +20,6 @@
 #include "bmap.h"
 #include "glock.h"
 #include "glops.h"
-#include "lm.h"
 #include "lops.h"
 #include "meta_io.h"
 #include "recovery.h"
@@ -425,6 +424,16 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header_host *hea
        return error;
 }
 
+
+static void gfs2_lm_recovery_done(struct gfs2_sbd *sdp, unsigned int jid,
+                                 unsigned int message)
+{
+       if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
+               sdp->sd_lockstruct.ls_ops->lm_recovery_done(
+                       sdp->sd_lockstruct.ls_lockspace, jid, message);
+}
+
+
 /**
  * gfs2_recover_journal - recovery a given journal
  * @jd: the struct gfs2_jdesc describing the journal
index 60a870e430be921da125b2aee7a412d66231dc9f..44361ecc44f77fa1771a7cb48b08cdb1a436cdc4 100644 (file)
@@ -17,6 +17,7 @@ void gfs2_tune_init(struct gfs2_tune *gt);
 int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb_host *sb, int silent);
 int gfs2_read_sb(struct gfs2_sbd *sdp, struct gfs2_glock *gl, int silent);
 int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector);
+void gfs2_lm_unmount(struct gfs2_sbd *sdp);
 
 static inline unsigned int gfs2_jindex_size(struct gfs2_sbd *sdp)
 {
index eaa3b7b2f99e64f4e95206b262a420329e693c61..cc35ec862ee8cb77e8df8dbbaf9cd587bdeb6e81 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "gfs2.h"
 #include "incore.h"
-#include "lm.h"
 #include "sys.h"
 #include "super.h"
 #include "glock.h"
index fe9c28ef77b059eb9620613826ff48839c5931be..d31e355c61fbc5040f0a2b8ac9775724a67eee53 100644 (file)
@@ -19,7 +19,6 @@
 #include "gfs2.h"
 #include "incore.h"
 #include "glock.h"
-#include "lm.h"
 #include "util.h"
 
 struct kmem_cache *gfs2_glock_cachep __read_mostly;
@@ -33,6 +32,28 @@ void gfs2_assert_i(struct gfs2_sbd *sdp)
               sdp->sd_fsname);
 }
 
+int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
+{
+       va_list args;
+
+       if (test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags))
+               return 0;
+
+       va_start(args, fmt);
+       vprintk(fmt, args);
+       va_end(args);
+
+       fs_err(sdp, "about to withdraw this file system\n");
+       BUG_ON(sdp->sd_args.ar_debug);
+
+       fs_err(sdp, "telling LM to withdraw\n");
+       gfs2_withdraw_lockproto(&sdp->sd_lockstruct);
+       fs_err(sdp, "withdrawn\n");
+       dump_stack();
+
+       return -1;
+}
+
 /**
  * gfs2_assert_withdraw_i - Cause the machine to withdraw if @assertion is false
  * Returns: -1 if this call withdrew the machine,
index ac0c567ebc36cb5bc362ed697f2179707502df21..509c5d60bd803ecc928df4aad578eb8856ae9ffa 100644 (file)
@@ -164,6 +164,7 @@ gfs2_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field)
 
 void gfs2_icbit_munge(struct gfs2_sbd *sdp, unsigned char **bitmap,
                      unsigned int bit, int new_value);
+int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...);
 
 #endif /* __UTIL_DOT_H__ */