diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-05-23 09:46:04 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-06-27 04:39:28 -0400 |
commit | 048bca223739368aa5b9ce7cfb1d576c32d66cc7 (patch) | |
tree | 66d4f1c0e90eb6429755cb4529f8c7f609026e89 | |
parent | f3c9d38a26be32abf9b8897e9e0afc7166c712dd (diff) |
[GFS2] No lock_nolock
This patch merges the lock_nolock module into GFS2 itself. As well as removing
some of the overhead of the module, it also means that its now impossible to
build GFS2 without a lock module (which would be a pointless thing to do
anyway).
We also plan to merge lock_dlm into GFS2 in the future, but that is a more
tricky task, and will therefore be a separate patch.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: David Teigland <teigland@redhat.com>
-rw-r--r-- | fs/gfs2/Kconfig | 18 | ||||
-rw-r--r-- | fs/gfs2/Makefile | 1 | ||||
-rw-r--r-- | fs/gfs2/glock.c | 15 | ||||
-rw-r--r-- | fs/gfs2/locking.c | 52 | ||||
-rw-r--r-- | fs/gfs2/locking/nolock/Makefile | 3 | ||||
-rw-r--r-- | fs/gfs2/locking/nolock/main.c | 240 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 5 | ||||
-rw-r--r-- | fs/gfs2/recovery.c | 3 |
8 files changed, 71 insertions, 266 deletions
diff --git a/fs/gfs2/Kconfig b/fs/gfs2/Kconfig index 7f7947e3dfbb..ab2f57e3fb87 100644 --- a/fs/gfs2/Kconfig +++ b/fs/gfs2/Kconfig | |||
@@ -14,23 +14,11 @@ config GFS2_FS | |||
14 | GFS is perfect consistency -- changes made to the filesystem on one | 14 | GFS is perfect consistency -- changes made to the filesystem on one |
15 | machine show up immediately on all other machines in the cluster. | 15 | machine show up immediately on all other machines in the cluster. |
16 | 16 | ||
17 | To use the GFS2 filesystem, you will need to enable one or more of | 17 | To use the GFS2 filesystem in a cluster, you will need to enable |
18 | the below locking modules. Documentation and utilities for GFS2 can | 18 | the locking module below. Documentation and utilities for GFS2 can |
19 | be found here: http://sources.redhat.com/cluster | 19 | be found here: http://sources.redhat.com/cluster |
20 | 20 | ||
21 | config GFS2_FS_LOCKING_NOLOCK | 21 | The "nolock" lock module is now built in to GFS2 by default. |
22 | tristate "GFS2 \"nolock\" locking module" | ||
23 | depends on GFS2_FS | ||
24 | help | ||
25 | Single node locking module for GFS2. | ||
26 | |||
27 | Use this module if you want to use GFS2 on a single node without | ||
28 | its clustering features. You can still take advantage of the | ||
29 | large file support, and upgrade to running a full cluster later on | ||
30 | if required. | ||
31 | |||
32 | If you will only be using GFS2 in cluster mode, you do not need this | ||
33 | module. | ||
34 | 22 | ||
35 | config GFS2_FS_LOCKING_DLM | 23 | config GFS2_FS_LOCKING_DLM |
36 | tristate "GFS2 DLM locking module" | 24 | tristate "GFS2 DLM locking module" |
diff --git a/fs/gfs2/Makefile b/fs/gfs2/Makefile index e2350df02a07..ec65851ec80a 100644 --- a/fs/gfs2/Makefile +++ b/fs/gfs2/Makefile | |||
@@ -5,6 +5,5 @@ gfs2-y := acl.o bmap.o daemon.o dir.o eaops.o eattr.o glock.o \ | |||
5 | ops_fstype.o ops_inode.o ops_super.o quota.o \ | 5 | ops_fstype.o ops_inode.o ops_super.o quota.o \ |
6 | recovery.o rgrp.o super.o sys.o trans.o util.o | 6 | recovery.o rgrp.o super.o sys.o trans.o util.o |
7 | 7 | ||
8 | obj-$(CONFIG_GFS2_FS_LOCKING_NOLOCK) += locking/nolock/ | ||
9 | obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += locking/dlm/ | 8 | obj-$(CONFIG_GFS2_FS_LOCKING_DLM) += locking/dlm/ |
10 | 9 | ||
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 519a54cc0b7b..be7ed503f012 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -153,7 +153,7 @@ static void glock_free(struct gfs2_glock *gl) | |||
153 | struct gfs2_sbd *sdp = gl->gl_sbd; | 153 | struct gfs2_sbd *sdp = gl->gl_sbd; |
154 | struct inode *aspace = gl->gl_aspace; | 154 | struct inode *aspace = gl->gl_aspace; |
155 | 155 | ||
156 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 156 | if (sdp->sd_lockstruct.ls_ops->lm_put_lock) |
157 | sdp->sd_lockstruct.ls_ops->lm_put_lock(gl->gl_lock); | 157 | sdp->sd_lockstruct.ls_ops->lm_put_lock(gl->gl_lock); |
158 | 158 | ||
159 | if (aspace) | 159 | if (aspace) |
@@ -488,6 +488,10 @@ static unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock, | |||
488 | unsigned int flags) | 488 | unsigned int flags) |
489 | { | 489 | { |
490 | int ret = LM_OUT_ERROR; | 490 | int ret = LM_OUT_ERROR; |
491 | |||
492 | if (!sdp->sd_lockstruct.ls_ops->lm_lock) | ||
493 | return req_state == LM_ST_UNLOCKED ? 0 : req_state; | ||
494 | |||
491 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 495 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
492 | ret = sdp->sd_lockstruct.ls_ops->lm_lock(lock, cur_state, | 496 | ret = sdp->sd_lockstruct.ls_ops->lm_lock(lock, cur_state, |
493 | req_state, flags); | 497 | req_state, flags); |
@@ -631,6 +635,8 @@ static int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name, | |||
631 | void **lockp) | 635 | void **lockp) |
632 | { | 636 | { |
633 | int error = -EIO; | 637 | int error = -EIO; |
638 | if (!sdp->sd_lockstruct.ls_ops->lm_get_lock) | ||
639 | return 0; | ||
634 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 640 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
635 | error = sdp->sd_lockstruct.ls_ops->lm_get_lock( | 641 | error = sdp->sd_lockstruct.ls_ops->lm_get_lock( |
636 | sdp->sd_lockstruct.ls_lockspace, name, lockp); | 642 | sdp->sd_lockstruct.ls_lockspace, name, lockp); |
@@ -910,7 +916,8 @@ do_cancel: | |||
910 | gh = list_entry(gl->gl_holders.next, struct gfs2_holder, gh_list); | 916 | gh = list_entry(gl->gl_holders.next, struct gfs2_holder, gh_list); |
911 | if (!(gh->gh_flags & LM_FLAG_PRIORITY)) { | 917 | if (!(gh->gh_flags & LM_FLAG_PRIORITY)) { |
912 | spin_unlock(&gl->gl_spin); | 918 | spin_unlock(&gl->gl_spin); |
913 | sdp->sd_lockstruct.ls_ops->lm_cancel(gl->gl_lock); | 919 | if (sdp->sd_lockstruct.ls_ops->lm_cancel) |
920 | sdp->sd_lockstruct.ls_ops->lm_cancel(gl->gl_lock); | ||
914 | spin_lock(&gl->gl_spin); | 921 | spin_lock(&gl->gl_spin); |
915 | } | 922 | } |
916 | return; | 923 | return; |
@@ -1187,6 +1194,8 @@ void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs) | |||
1187 | static int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp) | 1194 | static int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp) |
1188 | { | 1195 | { |
1189 | int error = -EIO; | 1196 | int error = -EIO; |
1197 | if (!sdp->sd_lockstruct.ls_ops->lm_hold_lvb) | ||
1198 | return 0; | ||
1190 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 1199 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
1191 | error = sdp->sd_lockstruct.ls_ops->lm_hold_lvb(lock, lvbp); | 1200 | error = sdp->sd_lockstruct.ls_ops->lm_hold_lvb(lock, lvbp); |
1192 | return error; | 1201 | return error; |
@@ -1226,7 +1235,7 @@ void gfs2_lvb_unhold(struct gfs2_glock *gl) | |||
1226 | gfs2_glock_hold(gl); | 1235 | gfs2_glock_hold(gl); |
1227 | gfs2_assert(gl->gl_sbd, atomic_read(&gl->gl_lvb_count) > 0); | 1236 | gfs2_assert(gl->gl_sbd, atomic_read(&gl->gl_lvb_count) > 0); |
1228 | if (atomic_dec_and_test(&gl->gl_lvb_count)) { | 1237 | if (atomic_dec_and_test(&gl->gl_lvb_count)) { |
1229 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 1238 | if (sdp->sd_lockstruct.ls_ops->lm_unhold_lvb) |
1230 | sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(gl->gl_lock, gl->gl_lvb); | 1239 | sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(gl->gl_lock, gl->gl_lvb); |
1231 | gl->gl_lvb = NULL; | 1240 | gl->gl_lvb = NULL; |
1232 | gfs2_glock_put(gl); | 1241 | gfs2_glock_put(gl); |
diff --git a/fs/gfs2/locking.c b/fs/gfs2/locking.c index 663fee728783..a4a367aa5cc1 100644 --- a/fs/gfs2/locking.c +++ b/fs/gfs2/locking.c | |||
@@ -23,12 +23,54 @@ struct lmh_wrapper { | |||
23 | const struct lm_lockops *lw_ops; | 23 | const struct lm_lockops *lw_ops; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | static int nolock_mount(char *table_name, char *host_data, | ||
27 | lm_callback_t cb, void *cb_data, | ||
28 | unsigned int min_lvb_size, int flags, | ||
29 | struct lm_lockstruct *lockstruct, | ||
30 | struct kobject *fskobj); | ||
31 | |||
26 | /* List of registered low-level locking protocols. A file system selects one | 32 | /* List of registered low-level locking protocols. A file system selects one |
27 | of them by name at mount time, e.g. lock_nolock, lock_dlm. */ | 33 | of them by name at mount time, e.g. lock_nolock, lock_dlm. */ |
28 | 34 | ||
35 | static const struct lm_lockops nolock_ops = { | ||
36 | .lm_proto_name = "lock_nolock", | ||
37 | .lm_mount = nolock_mount, | ||
38 | }; | ||
39 | |||
40 | static struct lmh_wrapper nolock_proto = { | ||
41 | .lw_list = LIST_HEAD_INIT(nolock_proto.lw_list), | ||
42 | .lw_ops = &nolock_ops, | ||
43 | }; | ||
44 | |||
29 | static LIST_HEAD(lmh_list); | 45 | static LIST_HEAD(lmh_list); |
30 | static DEFINE_MUTEX(lmh_lock); | 46 | static DEFINE_MUTEX(lmh_lock); |
31 | 47 | ||
48 | static int nolock_mount(char *table_name, char *host_data, | ||
49 | lm_callback_t cb, void *cb_data, | ||
50 | unsigned int min_lvb_size, int flags, | ||
51 | struct lm_lockstruct *lockstruct, | ||
52 | struct kobject *fskobj) | ||
53 | { | ||
54 | char *c; | ||
55 | unsigned int jid; | ||
56 | |||
57 | c = strstr(host_data, "jid="); | ||
58 | if (!c) | ||
59 | jid = 0; | ||
60 | else { | ||
61 | c += 4; | ||
62 | sscanf(c, "%u", &jid); | ||
63 | } | ||
64 | |||
65 | lockstruct->ls_jid = jid; | ||
66 | lockstruct->ls_first = 1; | ||
67 | lockstruct->ls_lvb_size = min_lvb_size; | ||
68 | lockstruct->ls_ops = &nolock_ops; | ||
69 | lockstruct->ls_flags = LM_LSFLAG_LOCAL; | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | |||
32 | /** | 74 | /** |
33 | * gfs2_register_lockproto - Register a low-level locking protocol | 75 | * gfs2_register_lockproto - Register a low-level locking protocol |
34 | * @proto: the protocol definition | 76 | * @proto: the protocol definition |
@@ -116,9 +158,13 @@ int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data, | |||
116 | int try = 0; | 158 | int try = 0; |
117 | int error, found; | 159 | int error, found; |
118 | 160 | ||
161 | |||
119 | retry: | 162 | retry: |
120 | mutex_lock(&lmh_lock); | 163 | mutex_lock(&lmh_lock); |
121 | 164 | ||
165 | if (list_empty(&nolock_proto.lw_list)) | ||
166 | list_add(&lmh_list, &nolock_proto.lw_list); | ||
167 | |||
122 | found = 0; | 168 | found = 0; |
123 | list_for_each_entry(lw, &lmh_list, lw_list) { | 169 | list_for_each_entry(lw, &lmh_list, lw_list) { |
124 | if (!strcmp(lw->lw_ops->lm_proto_name, proto_name)) { | 170 | if (!strcmp(lw->lw_ops->lm_proto_name, proto_name)) { |
@@ -139,7 +185,8 @@ retry: | |||
139 | goto out; | 185 | goto out; |
140 | } | 186 | } |
141 | 187 | ||
142 | if (!try_module_get(lw->lw_ops->lm_owner)) { | 188 | if (lw->lw_ops->lm_owner && |
189 | !try_module_get(lw->lw_ops->lm_owner)) { | ||
143 | try = 0; | 190 | try = 0; |
144 | mutex_unlock(&lmh_lock); | 191 | mutex_unlock(&lmh_lock); |
145 | msleep(1000); | 192 | msleep(1000); |
@@ -158,7 +205,8 @@ out: | |||
158 | void gfs2_unmount_lockproto(struct lm_lockstruct *lockstruct) | 205 | void gfs2_unmount_lockproto(struct lm_lockstruct *lockstruct) |
159 | { | 206 | { |
160 | mutex_lock(&lmh_lock); | 207 | mutex_lock(&lmh_lock); |
161 | lockstruct->ls_ops->lm_unmount(lockstruct->ls_lockspace); | 208 | if (lockstruct->ls_ops->lm_unmount) |
209 | lockstruct->ls_ops->lm_unmount(lockstruct->ls_lockspace); | ||
162 | if (lockstruct->ls_ops->lm_owner) | 210 | if (lockstruct->ls_ops->lm_owner) |
163 | module_put(lockstruct->ls_ops->lm_owner); | 211 | module_put(lockstruct->ls_ops->lm_owner); |
164 | mutex_unlock(&lmh_lock); | 212 | mutex_unlock(&lmh_lock); |
diff --git a/fs/gfs2/locking/nolock/Makefile b/fs/gfs2/locking/nolock/Makefile deleted file mode 100644 index 35e9730bc3a8..000000000000 --- a/fs/gfs2/locking/nolock/Makefile +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | obj-$(CONFIG_GFS2_FS_LOCKING_NOLOCK) += lock_nolock.o | ||
2 | lock_nolock-y := main.o | ||
3 | |||
diff --git a/fs/gfs2/locking/nolock/main.c b/fs/gfs2/locking/nolock/main.c deleted file mode 100644 index 627bfb79bc8c..000000000000 --- a/fs/gfs2/locking/nolock/main.c +++ /dev/null | |||
@@ -1,240 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | ||
3 | * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. | ||
4 | * | ||
5 | * This copyrighted material is made available to anyone wishing to use, | ||
6 | * modify, copy, or redistribute it subject to the terms and conditions | ||
7 | * of the GNU General Public License version 2. | ||
8 | */ | ||
9 | |||
10 | #include <linux/module.h> | ||
11 | #include <linux/slab.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/fs.h> | ||
15 | #include <linux/lm_interface.h> | ||
16 | |||
17 | struct nolock_lockspace { | ||
18 | unsigned int nl_lvb_size; | ||
19 | }; | ||
20 | |||
21 | static const struct lm_lockops nolock_ops; | ||
22 | |||
23 | static int nolock_mount(char *table_name, char *host_data, | ||
24 | lm_callback_t cb, void *cb_data, | ||
25 | unsigned int min_lvb_size, int flags, | ||
26 | struct lm_lockstruct *lockstruct, | ||
27 | struct kobject *fskobj) | ||
28 | { | ||
29 | char *c; | ||
30 | unsigned int jid; | ||
31 | struct nolock_lockspace *nl; | ||
32 | |||
33 | c = strstr(host_data, "jid="); | ||
34 | if (!c) | ||
35 | jid = 0; | ||
36 | else { | ||
37 | c += 4; | ||
38 | sscanf(c, "%u", &jid); | ||
39 | } | ||
40 | |||
41 | nl = kzalloc(sizeof(struct nolock_lockspace), GFP_KERNEL); | ||
42 | if (!nl) | ||
43 | return -ENOMEM; | ||
44 | |||
45 | nl->nl_lvb_size = min_lvb_size; | ||
46 | |||
47 | lockstruct->ls_jid = jid; | ||
48 | lockstruct->ls_first = 1; | ||
49 | lockstruct->ls_lvb_size = min_lvb_size; | ||
50 | lockstruct->ls_lockspace = nl; | ||
51 | lockstruct->ls_ops = &nolock_ops; | ||
52 | lockstruct->ls_flags = LM_LSFLAG_LOCAL; | ||
53 | |||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | static void nolock_others_may_mount(void *lockspace) | ||
58 | { | ||
59 | } | ||
60 | |||
61 | static void nolock_unmount(void *lockspace) | ||
62 | { | ||
63 | struct nolock_lockspace *nl = lockspace; | ||
64 | kfree(nl); | ||
65 | } | ||
66 | |||
67 | static void nolock_withdraw(void *lockspace) | ||
68 | { | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * nolock_get_lock - get a lm_lock_t given a descripton of the lock | ||
73 | * @lockspace: the lockspace the lock lives in | ||
74 | * @name: the name of the lock | ||
75 | * @lockp: return the lm_lock_t here | ||
76 | * | ||
77 | * Returns: 0 on success, -EXXX on failure | ||
78 | */ | ||
79 | |||
80 | static int nolock_get_lock(void *lockspace, struct lm_lockname *name, | ||
81 | void **lockp) | ||
82 | { | ||
83 | *lockp = lockspace; | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * nolock_put_lock - get rid of a lock structure | ||
89 | * @lock: the lock to throw away | ||
90 | * | ||
91 | */ | ||
92 | |||
93 | static void nolock_put_lock(void *lock) | ||
94 | { | ||
95 | } | ||
96 | |||
97 | /** | ||
98 | * nolock_lock - acquire a lock | ||
99 | * @lock: the lock to manipulate | ||
100 | * @cur_state: the current state | ||
101 | * @req_state: the requested state | ||
102 | * @flags: modifier flags | ||
103 | * | ||
104 | * Returns: A bitmap of LM_OUT_* | ||
105 | */ | ||
106 | |||
107 | static unsigned int nolock_lock(void *lock, unsigned int cur_state, | ||
108 | unsigned int req_state, unsigned int flags) | ||
109 | { | ||
110 | if (req_state == LM_ST_UNLOCKED) | ||
111 | return 0; | ||
112 | return req_state | LM_OUT_CACHEABLE; | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * nolock_unlock - unlock a lock | ||
117 | * @lock: the lock to manipulate | ||
118 | * @cur_state: the current state | ||
119 | * | ||
120 | * Returns: 0 | ||
121 | */ | ||
122 | |||
123 | static unsigned int nolock_unlock(void *lock, unsigned int cur_state) | ||
124 | { | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static void nolock_cancel(void *lock) | ||
129 | { | ||
130 | } | ||
131 | |||
132 | /** | ||
133 | * nolock_hold_lvb - hold on to a lock value block | ||
134 | * @lock: the lock the LVB is associated with | ||
135 | * @lvbp: return the lm_lvb_t here | ||
136 | * | ||
137 | * Returns: 0 on success, -EXXX on failure | ||
138 | */ | ||
139 | |||
140 | static int nolock_hold_lvb(void *lock, char **lvbp) | ||
141 | { | ||
142 | struct nolock_lockspace *nl = lock; | ||
143 | int error = 0; | ||
144 | |||
145 | *lvbp = kzalloc(nl->nl_lvb_size, GFP_NOFS); | ||
146 | if (!*lvbp) | ||
147 | error = -ENOMEM; | ||
148 | |||
149 | return error; | ||
150 | } | ||
151 | |||
152 | /** | ||
153 | * nolock_unhold_lvb - release a LVB | ||
154 | * @lock: the lock the LVB is associated with | ||
155 | * @lvb: the lock value block | ||
156 | * | ||
157 | */ | ||
158 | |||
159 | static void nolock_unhold_lvb(void *lock, char *lvb) | ||
160 | { | ||
161 | kfree(lvb); | ||
162 | } | ||
163 | |||
164 | static int nolock_plock_get(void *lockspace, struct lm_lockname *name, | ||
165 | struct file *file, struct file_lock *fl) | ||
166 | { | ||
167 | posix_test_lock(file, fl); | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | static int nolock_plock(void *lockspace, struct lm_lockname *name, | ||
173 | struct file *file, int cmd, struct file_lock *fl) | ||
174 | { | ||
175 | int error; | ||
176 | error = posix_lock_file_wait(file, fl); | ||
177 | return error; | ||
178 | } | ||
179 | |||
180 | static int nolock_punlock(void *lockspace, struct lm_lockname *name, | ||
181 | struct file *file, struct file_lock *fl) | ||
182 | { | ||
183 | int error; | ||
184 | error = posix_lock_file_wait(file, fl); | ||
185 | return error; | ||
186 | } | ||
187 | |||
188 | static void nolock_recovery_done(void *lockspace, unsigned int jid, | ||
189 | unsigned int message) | ||
190 | { | ||
191 | } | ||
192 | |||
193 | static const struct lm_lockops nolock_ops = { | ||
194 | .lm_proto_name = "lock_nolock", | ||
195 | .lm_mount = nolock_mount, | ||
196 | .lm_others_may_mount = nolock_others_may_mount, | ||
197 | .lm_unmount = nolock_unmount, | ||
198 | .lm_withdraw = nolock_withdraw, | ||
199 | .lm_get_lock = nolock_get_lock, | ||
200 | .lm_put_lock = nolock_put_lock, | ||
201 | .lm_lock = nolock_lock, | ||
202 | .lm_unlock = nolock_unlock, | ||
203 | .lm_cancel = nolock_cancel, | ||
204 | .lm_hold_lvb = nolock_hold_lvb, | ||
205 | .lm_unhold_lvb = nolock_unhold_lvb, | ||
206 | .lm_plock_get = nolock_plock_get, | ||
207 | .lm_plock = nolock_plock, | ||
208 | .lm_punlock = nolock_punlock, | ||
209 | .lm_recovery_done = nolock_recovery_done, | ||
210 | .lm_owner = THIS_MODULE, | ||
211 | }; | ||
212 | |||
213 | static int __init init_nolock(void) | ||
214 | { | ||
215 | int error; | ||
216 | |||
217 | error = gfs2_register_lockproto(&nolock_ops); | ||
218 | if (error) { | ||
219 | printk(KERN_WARNING | ||
220 | "lock_nolock: can't register protocol: %d\n", error); | ||
221 | return error; | ||
222 | } | ||
223 | |||
224 | printk(KERN_INFO | ||
225 | "Lock_Nolock (built %s %s) installed\n", __DATE__, __TIME__); | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | static void __exit exit_nolock(void) | ||
230 | { | ||
231 | gfs2_unregister_lockproto(&nolock_ops); | ||
232 | } | ||
233 | |||
234 | module_init(init_nolock); | ||
235 | module_exit(exit_nolock); | ||
236 | |||
237 | MODULE_DESCRIPTION("GFS Nolock Locking Module"); | ||
238 | MODULE_AUTHOR("Red Hat, Inc."); | ||
239 | MODULE_LICENSE("GPL"); | ||
240 | |||
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index b2028c82e8d1..9bd97c5543bd 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -364,6 +364,8 @@ static int map_journal_extents(struct gfs2_sbd *sdp) | |||
364 | 364 | ||
365 | static void gfs2_lm_others_may_mount(struct gfs2_sbd *sdp) | 365 | static void gfs2_lm_others_may_mount(struct gfs2_sbd *sdp) |
366 | { | 366 | { |
367 | if (!sdp->sd_lockstruct.ls_ops->lm_others_may_mount) | ||
368 | return; | ||
367 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 369 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
368 | sdp->sd_lockstruct.ls_ops->lm_others_may_mount( | 370 | sdp->sd_lockstruct.ls_ops->lm_others_may_mount( |
369 | sdp->sd_lockstruct.ls_lockspace); | 371 | sdp->sd_lockstruct.ls_lockspace); |
@@ -741,8 +743,7 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent) | |||
741 | goto out; | 743 | goto out; |
742 | } | 744 | } |
743 | 745 | ||
744 | if (gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_lockspace) || | 746 | if (gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_ops) || |
745 | gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_ops) || | ||
746 | gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_lvb_size >= | 747 | gfs2_assert_warn(sdp, sdp->sd_lockstruct.ls_lvb_size >= |
747 | GFS2_MIN_LVB_SIZE)) { | 748 | GFS2_MIN_LVB_SIZE)) { |
748 | gfs2_unmount_lockproto(&sdp->sd_lockstruct); | 749 | gfs2_unmount_lockproto(&sdp->sd_lockstruct); |
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index fdd3f0f16d0d..d5e91f4f6a0b 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c | |||
@@ -428,6 +428,9 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header_host *hea | |||
428 | static void gfs2_lm_recovery_done(struct gfs2_sbd *sdp, unsigned int jid, | 428 | static void gfs2_lm_recovery_done(struct gfs2_sbd *sdp, unsigned int jid, |
429 | unsigned int message) | 429 | unsigned int message) |
430 | { | 430 | { |
431 | if (!sdp->sd_lockstruct.ls_ops->lm_recovery_done) | ||
432 | return; | ||
433 | |||
431 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 434 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
432 | sdp->sd_lockstruct.ls_ops->lm_recovery_done( | 435 | sdp->sd_lockstruct.ls_ops->lm_recovery_done( |
433 | sdp->sd_lockstruct.ls_lockspace, jid, message); | 436 | sdp->sd_lockstruct.ls_lockspace, jid, message); |