aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-09-08 10:17:58 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-09-08 10:17:58 -0400
commit9b47c11d1cbedcba685c9bd90c73fd41acdfab0e (patch)
tree799f05877bd8973262da54852b7b8bf9a9916998 /fs/gfs2
parenta2c4580797f62b0dd9a48f1e0ce3fe8b8fd76262 (diff)
[GFS2] Use void * instead of typedef for locking module interface
As requested by Jan Engelhardt, this removes the typedefs in the locking module interface and replaces them with void *. Also since we are changing the interface, I've added a few consts as well. Cc: Jan Engelhardt <jengelh@linux01.gwdg.de> Cc: David Teigland <teigland@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/glock.c3
-rw-r--r--fs/gfs2/glock.h2
-rw-r--r--fs/gfs2/incore.h2
-rw-r--r--fs/gfs2/lm.c14
-rw-r--r--fs/gfs2/lm.h14
-rw-r--r--fs/gfs2/lm_interface.h57
-rw-r--r--fs/gfs2/locking.c10
-rw-r--r--fs/gfs2/locking/dlm/lock.c32
-rw-r--r--fs/gfs2/locking/dlm/lock_dlm.h22
-rw-r--r--fs/gfs2/locking/dlm/mount.c24
-rw-r--r--fs/gfs2/locking/dlm/plock.c15
-rw-r--r--fs/gfs2/locking/nolock/main.c44
12 files changed, 113 insertions, 126 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 87b37fe269b6..92aa0e8c9099 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1713,8 +1713,9 @@ static void blocking_cb(struct gfs2_sbd *sdp, struct lm_lockname *name,
1713 * a journal from another client needs to be recovered. 1713 * a journal from another client needs to be recovered.
1714 */ 1714 */
1715 1715
1716void gfs2_glock_cb(struct gfs2_sbd *sdp, unsigned int type, void *data) 1716void gfs2_glock_cb(void *cb_data, unsigned int type, void *data)
1717{ 1717{
1718 struct gfs2_sbd *sdp = cb_data;
1718 1719
1719 switch (type) { 1720 switch (type) {
1720 case LM_CB_NEED_E: 1721 case LM_CB_NEED_E:
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index e3bf4bcd4b29..52b8a308635a 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -140,7 +140,7 @@ static inline int gfs2_glock_nq_init(struct gfs2_glock *gl,
140int gfs2_lvb_hold(struct gfs2_glock *gl); 140int gfs2_lvb_hold(struct gfs2_glock *gl);
141void gfs2_lvb_unhold(struct gfs2_glock *gl); 141void gfs2_lvb_unhold(struct gfs2_glock *gl);
142 142
143void gfs2_glock_cb(struct gfs2_sbd *sdp, unsigned int type, void *data); 143void gfs2_glock_cb(void *cb_data, unsigned int type, void *data);
144 144
145void gfs2_iopen_go_callback(struct gfs2_glock *gl, unsigned int state); 145void gfs2_iopen_go_callback(struct gfs2_glock *gl, unsigned int state);
146 146
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 61849607211f..9f5d98ff823a 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -187,7 +187,7 @@ struct gfs2_glock {
187 struct gfs2_holder *gl_req_gh; 187 struct gfs2_holder *gl_req_gh;
188 gfs2_glop_bh_t gl_req_bh; 188 gfs2_glop_bh_t gl_req_bh;
189 189
190 lm_lock_t *gl_lock; 190 void *gl_lock;
191 char *gl_lvb; 191 char *gl_lvb;
192 atomic_t gl_lvb_count; 192 atomic_t gl_lvb_count;
193 193
diff --git a/fs/gfs2/lm.c b/fs/gfs2/lm.c
index e60f95cae6c5..4e23aa5ef75d 100644
--- a/fs/gfs2/lm.c
+++ b/fs/gfs2/lm.c
@@ -122,7 +122,7 @@ int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
122} 122}
123 123
124int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name, 124int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
125 lm_lock_t **lockp) 125 void **lockp)
126{ 126{
127 int error = -EIO; 127 int error = -EIO;
128 if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) 128 if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
@@ -131,13 +131,13 @@ int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
131 return error; 131 return error;
132} 132}
133 133
134void gfs2_lm_put_lock(struct gfs2_sbd *sdp, lm_lock_t *lock) 134void gfs2_lm_put_lock(struct gfs2_sbd *sdp, void *lock)
135{ 135{
136 if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) 136 if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
137 sdp->sd_lockstruct.ls_ops->lm_put_lock(lock); 137 sdp->sd_lockstruct.ls_ops->lm_put_lock(lock);
138} 138}
139 139
140unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, lm_lock_t *lock, 140unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock,
141 unsigned int cur_state, unsigned int req_state, 141 unsigned int cur_state, unsigned int req_state,
142 unsigned int flags) 142 unsigned int flags)
143{ 143{
@@ -148,7 +148,7 @@ unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, lm_lock_t *lock,
148 return ret; 148 return ret;
149} 149}
150 150
151unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, lm_lock_t *lock, 151unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, void *lock,
152 unsigned int cur_state) 152 unsigned int cur_state)
153{ 153{
154 int ret = 0; 154 int ret = 0;
@@ -157,13 +157,13 @@ unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, lm_lock_t *lock,
157 return ret; 157 return ret;
158} 158}
159 159
160void gfs2_lm_cancel(struct gfs2_sbd *sdp, lm_lock_t *lock) 160void gfs2_lm_cancel(struct gfs2_sbd *sdp, void *lock)
161{ 161{
162 if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) 162 if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
163 sdp->sd_lockstruct.ls_ops->lm_cancel(lock); 163 sdp->sd_lockstruct.ls_ops->lm_cancel(lock);
164} 164}
165 165
166int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char **lvbp) 166int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp)
167{ 167{
168 int error = -EIO; 168 int error = -EIO;
169 if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) 169 if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
@@ -171,7 +171,7 @@ int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char **lvbp)
171 return error; 171 return error;
172} 172}
173 173
174void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char *lvb) 174void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, void *lock, char *lvb)
175{ 175{
176 if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) 176 if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
177 sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(lock, lvb); 177 sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(lock, lvb);
diff --git a/fs/gfs2/lm.h b/fs/gfs2/lm.h
index 6b890e73e6c1..21cdc30ee08c 100644
--- a/fs/gfs2/lm.h
+++ b/fs/gfs2/lm.h
@@ -20,16 +20,16 @@ void gfs2_lm_unmount(struct gfs2_sbd *sdp);
20int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...) 20int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
21 __attribute__ ((format(printf, 2, 3))); 21 __attribute__ ((format(printf, 2, 3)));
22int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name, 22int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
23 lm_lock_t **lockp); 23 void **lockp);
24void gfs2_lm_put_lock(struct gfs2_sbd *sdp, lm_lock_t *lock); 24void gfs2_lm_put_lock(struct gfs2_sbd *sdp, void *lock);
25unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, lm_lock_t *lock, 25unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock,
26 unsigned int cur_state, unsigned int req_state, 26 unsigned int cur_state, unsigned int req_state,
27 unsigned int flags); 27 unsigned int flags);
28unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, lm_lock_t *lock, 28unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, void *lock,
29 unsigned int cur_state); 29 unsigned int cur_state);
30void gfs2_lm_cancel(struct gfs2_sbd *sdp, lm_lock_t *lock); 30void gfs2_lm_cancel(struct gfs2_sbd *sdp, void *lock);
31int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char **lvbp); 31int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp);
32void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char *lvb); 32void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, void *lock, char *lvb);
33int gfs2_lm_plock_get(struct gfs2_sbd *sdp, struct lm_lockname *name, 33int gfs2_lm_plock_get(struct gfs2_sbd *sdp, struct lm_lockname *name,
34 struct file *file, struct file_lock *fl); 34 struct file *file, struct file_lock *fl);
35int gfs2_lm_plock(struct gfs2_sbd *sdp, struct lm_lockname *name, 35int gfs2_lm_plock(struct gfs2_sbd *sdp, struct lm_lockname *name,
diff --git a/fs/gfs2/lm_interface.h b/fs/gfs2/lm_interface.h
index 148136a34625..1418fdc9ac02 100644
--- a/fs/gfs2/lm_interface.h
+++ b/fs/gfs2/lm_interface.h
@@ -10,16 +10,8 @@
10#ifndef __LM_INTERFACE_DOT_H__ 10#ifndef __LM_INTERFACE_DOT_H__
11#define __LM_INTERFACE_DOT_H__ 11#define __LM_INTERFACE_DOT_H__
12 12
13/*
14 * Opaque handles represent the lock module's lockspace structure, the lock
15 * module's lock structures, and GFS's file system (superblock) structure.
16 */
17 13
18typedef void lm_lockspace_t; 14typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
19typedef void lm_lock_t;
20struct gfs2_sbd;
21
22typedef void (*lm_callback_t) (struct gfs2_sbd *sdp, unsigned int type, void *data);
23 15
24/* 16/*
25 * lm_mount() flags 17 * lm_mount() flags
@@ -175,64 +167,60 @@ struct lm_async_cb {
175struct lm_lockstruct; 167struct lm_lockstruct;
176 168
177struct lm_lockops { 169struct lm_lockops {
178 char lm_proto_name[256]; 170 const char *lm_proto_name;
179 171
180 /* 172 /*
181 * Mount/Unmount 173 * Mount/Unmount
182 */ 174 */
183 175
184 int (*lm_mount) (char *table_name, char *host_data, 176 int (*lm_mount) (char *table_name, char *host_data,
185 lm_callback_t cb, struct gfs2_sbd *sdp, 177 lm_callback_t cb, void *cb_data,
186 unsigned int min_lvb_size, int flags, 178 unsigned int min_lvb_size, int flags,
187 struct lm_lockstruct *lockstruct, 179 struct lm_lockstruct *lockstruct,
188 struct kobject *fskobj); 180 struct kobject *fskobj);
189 181
190 void (*lm_others_may_mount) (lm_lockspace_t *lockspace); 182 void (*lm_others_may_mount) (void *lockspace);
191 183
192 void (*lm_unmount) (lm_lockspace_t *lockspace); 184 void (*lm_unmount) (void *lockspace);
193 185
194 void (*lm_withdraw) (lm_lockspace_t *lockspace); 186 void (*lm_withdraw) (void *lockspace);
195 187
196 /* 188 /*
197 * Lock oriented operations 189 * Lock oriented operations
198 */ 190 */
199 191
200 int (*lm_get_lock) (lm_lockspace_t *lockspace, 192 int (*lm_get_lock) (void *lockspace, struct lm_lockname *name, void **lockp);
201 struct lm_lockname *name, lm_lock_t **lockp);
202 193
203 void (*lm_put_lock) (lm_lock_t *lock); 194 void (*lm_put_lock) (void *lock);
204 195
205 unsigned int (*lm_lock) (lm_lock_t *lock, unsigned int cur_state, 196 unsigned int (*lm_lock) (void *lock, unsigned int cur_state,
206 unsigned int req_state, unsigned int flags); 197 unsigned int req_state, unsigned int flags);
207 198
208 unsigned int (*lm_unlock) (lm_lock_t *lock, unsigned int cur_state); 199 unsigned int (*lm_unlock) (void *lock, unsigned int cur_state);
209 200
210 void (*lm_cancel) (lm_lock_t *lock); 201 void (*lm_cancel) (void *lock);
211 202
212 int (*lm_hold_lvb) (lm_lock_t *lock, char **lvbp); 203 int (*lm_hold_lvb) (void *lock, char **lvbp);
213 void (*lm_unhold_lvb) (lm_lock_t *lock, char *lvb); 204 void (*lm_unhold_lvb) (void *lock, char *lvb);
214 205
215 /* 206 /*
216 * Posix Lock oriented operations 207 * Posix Lock oriented operations
217 */ 208 */
218 209
219 int (*lm_plock_get) (lm_lockspace_t *lockspace, 210 int (*lm_plock_get) (void *lockspace, struct lm_lockname *name,
220 struct lm_lockname *name,
221 struct file *file, struct file_lock *fl); 211 struct file *file, struct file_lock *fl);
222 212
223 int (*lm_plock) (lm_lockspace_t *lockspace, 213 int (*lm_plock) (void *lockspace, struct lm_lockname *name,
224 struct lm_lockname *name,
225 struct file *file, int cmd, struct file_lock *fl); 214 struct file *file, int cmd, struct file_lock *fl);
226 215
227 int (*lm_punlock) (lm_lockspace_t *lockspace, 216 int (*lm_punlock) (void *lockspace, struct lm_lockname *name,
228 struct lm_lockname *name,
229 struct file *file, struct file_lock *fl); 217 struct file *file, struct file_lock *fl);
230 218
231 /* 219 /*
232 * Client oriented operations 220 * Client oriented operations
233 */ 221 */
234 222
235 void (*lm_recovery_done) (lm_lockspace_t *lockspace, unsigned int jid, 223 void (*lm_recovery_done) (void *lockspace, unsigned int jid,
236 unsigned int message); 224 unsigned int message);
237 225
238 struct module *lm_owner; 226 struct module *lm_owner;
@@ -253,8 +241,8 @@ struct lm_lockstruct {
253 unsigned int ls_jid; 241 unsigned int ls_jid;
254 unsigned int ls_first; 242 unsigned int ls_first;
255 unsigned int ls_lvb_size; 243 unsigned int ls_lvb_size;
256 lm_lockspace_t *ls_lockspace; 244 void *ls_lockspace;
257 struct lm_lockops *ls_ops; 245 const struct lm_lockops *ls_ops;
258 int ls_flags; 246 int ls_flags;
259}; 247};
260 248
@@ -263,9 +251,8 @@ struct lm_lockstruct {
263 * with these functions. 251 * with these functions.
264 */ 252 */
265 253
266int gfs2_register_lockproto(struct lm_lockops *proto); 254int gfs2_register_lockproto(const struct lm_lockops *proto);
267 255void gfs2_unregister_lockproto(const struct lm_lockops *proto);
268void gfs2_unregister_lockproto(struct lm_lockops *proto);
269 256
270/* 257/*
271 * Lock module top interface. GFS calls these functions when mounting or 258 * Lock module top interface. GFS calls these functions when mounting or
@@ -273,7 +260,7 @@ void gfs2_unregister_lockproto(struct lm_lockops *proto);
273 */ 260 */
274 261
275int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data, 262int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
276 lm_callback_t cb, struct gfs2_sbd *sdp, 263 lm_callback_t cb, void *cb_data,
277 unsigned int min_lvb_size, int flags, 264 unsigned int min_lvb_size, int flags,
278 struct lm_lockstruct *lockstruct, 265 struct lm_lockstruct *lockstruct,
279 struct kobject *fskobj); 266 struct kobject *fskobj);
diff --git a/fs/gfs2/locking.c b/fs/gfs2/locking.c
index 31421ee6d863..65eca48b2eae 100644
--- a/fs/gfs2/locking.c
+++ b/fs/gfs2/locking.c
@@ -21,7 +21,7 @@
21 21
22struct lmh_wrapper { 22struct lmh_wrapper {
23 struct list_head lw_list; 23 struct list_head lw_list;
24 struct lm_lockops *lw_ops; 24 const struct lm_lockops *lw_ops;
25}; 25};
26 26
27/* List of registered low-level locking protocols. A file system selects one 27/* List of registered low-level locking protocols. A file system selects one
@@ -37,7 +37,7 @@ static DEFINE_MUTEX(lmh_lock);
37 * Returns: 0 on success, -EXXX on failure 37 * Returns: 0 on success, -EXXX on failure
38 */ 38 */
39 39
40int gfs2_register_lockproto(struct lm_lockops *proto) 40int gfs2_register_lockproto(const struct lm_lockops *proto)
41{ 41{
42 struct lmh_wrapper *lw; 42 struct lmh_wrapper *lw;
43 43
@@ -72,7 +72,7 @@ int gfs2_register_lockproto(struct lm_lockops *proto)
72 * 72 *
73 */ 73 */
74 74
75void gfs2_unregister_lockproto(struct lm_lockops *proto) 75void gfs2_unregister_lockproto(const struct lm_lockops *proto)
76{ 76{
77 struct lmh_wrapper *lw; 77 struct lmh_wrapper *lw;
78 78
@@ -108,7 +108,7 @@ void gfs2_unregister_lockproto(struct lm_lockops *proto)
108 */ 108 */
109 109
110int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data, 110int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
111 lm_callback_t cb, struct gfs2_sbd *sdp, 111 lm_callback_t cb, void *cb_data,
112 unsigned int min_lvb_size, int flags, 112 unsigned int min_lvb_size, int flags,
113 struct lm_lockstruct *lockstruct, 113 struct lm_lockstruct *lockstruct,
114 struct kobject *fskobj) 114 struct kobject *fskobj)
@@ -147,7 +147,7 @@ retry:
147 goto retry; 147 goto retry;
148 } 148 }
149 149
150 error = lw->lw_ops->lm_mount(table_name, host_data, cb, sdp, 150 error = lw->lw_ops->lm_mount(table_name, host_data, cb, cb_data,
151 min_lvb_size, flags, lockstruct, fskobj); 151 min_lvb_size, flags, lockstruct, fskobj);
152 if (error) 152 if (error)
153 module_put(lw->lw_ops->lm_owner); 153 module_put(lw->lw_ops->lm_owner);
diff --git a/fs/gfs2/locking/dlm/lock.c b/fs/gfs2/locking/dlm/lock.c
index e4359b1b7174..b167addf9fd1 100644
--- a/fs/gfs2/locking/dlm/lock.c
+++ b/fs/gfs2/locking/dlm/lock.c
@@ -207,21 +207,21 @@ void gdlm_delete_lp(struct gdlm_lock *lp)
207 kfree(lp); 207 kfree(lp);
208} 208}
209 209
210int gdlm_get_lock(lm_lockspace_t *lockspace, struct lm_lockname *name, 210int gdlm_get_lock(void *lockspace, struct lm_lockname *name,
211 lm_lock_t **lockp) 211 void **lockp)
212{ 212{
213 struct gdlm_lock *lp; 213 struct gdlm_lock *lp;
214 int error; 214 int error;
215 215
216 error = gdlm_create_lp((struct gdlm_ls *) lockspace, name, &lp); 216 error = gdlm_create_lp(lockspace, name, &lp);
217 217
218 *lockp = (lm_lock_t *) lp; 218 *lockp = lp;
219 return error; 219 return error;
220} 220}
221 221
222void gdlm_put_lock(lm_lock_t *lock) 222void gdlm_put_lock(void *lock)
223{ 223{
224 gdlm_delete_lp((struct gdlm_lock *) lock); 224 gdlm_delete_lp(lock);
225} 225}
226 226
227unsigned int gdlm_do_lock(struct gdlm_lock *lp) 227unsigned int gdlm_do_lock(struct gdlm_lock *lp)
@@ -305,10 +305,10 @@ static unsigned int gdlm_do_unlock(struct gdlm_lock *lp)
305 return LM_OUT_ASYNC; 305 return LM_OUT_ASYNC;
306} 306}
307 307
308unsigned int gdlm_lock(lm_lock_t *lock, unsigned int cur_state, 308unsigned int gdlm_lock(void *lock, unsigned int cur_state,
309 unsigned int req_state, unsigned int flags) 309 unsigned int req_state, unsigned int flags)
310{ 310{
311 struct gdlm_lock *lp = (struct gdlm_lock *) lock; 311 struct gdlm_lock *lp = lock;
312 312
313 clear_bit(LFL_DLM_CANCEL, &lp->flags); 313 clear_bit(LFL_DLM_CANCEL, &lp->flags);
314 if (flags & LM_FLAG_NOEXP) 314 if (flags & LM_FLAG_NOEXP)
@@ -321,9 +321,9 @@ unsigned int gdlm_lock(lm_lock_t *lock, unsigned int cur_state,
321 return gdlm_do_lock(lp); 321 return gdlm_do_lock(lp);
322} 322}
323 323
324unsigned int gdlm_unlock(lm_lock_t *lock, unsigned int cur_state) 324unsigned int gdlm_unlock(void *lock, unsigned int cur_state)
325{ 325{
326 struct gdlm_lock *lp = (struct gdlm_lock *) lock; 326 struct gdlm_lock *lp = lock;
327 327
328 clear_bit(LFL_DLM_CANCEL, &lp->flags); 328 clear_bit(LFL_DLM_CANCEL, &lp->flags);
329 if (lp->cur == DLM_LOCK_IV) 329 if (lp->cur == DLM_LOCK_IV)
@@ -331,9 +331,9 @@ unsigned int gdlm_unlock(lm_lock_t *lock, unsigned int cur_state)
331 return gdlm_do_unlock(lp); 331 return gdlm_do_unlock(lp);
332} 332}
333 333
334void gdlm_cancel(lm_lock_t *lock) 334void gdlm_cancel(void *lock)
335{ 335{
336 struct gdlm_lock *lp = (struct gdlm_lock *) lock; 336 struct gdlm_lock *lp = lock;
337 struct gdlm_ls *ls = lp->ls; 337 struct gdlm_ls *ls = lp->ls;
338 int error, delay_list = 0; 338 int error, delay_list = 0;
339 339
@@ -464,9 +464,9 @@ static void unhold_null_lock(struct gdlm_lock *lp)
464 intact on the resource while the lvb is "held" even if it's holding no locks 464 intact on the resource while the lvb is "held" even if it's holding no locks
465 on the resource. */ 465 on the resource. */
466 466
467int gdlm_hold_lvb(lm_lock_t *lock, char **lvbp) 467int gdlm_hold_lvb(void *lock, char **lvbp)
468{ 468{
469 struct gdlm_lock *lp = (struct gdlm_lock *) lock; 469 struct gdlm_lock *lp = lock;
470 int error; 470 int error;
471 471
472 error = gdlm_add_lvb(lp); 472 error = gdlm_add_lvb(lp);
@@ -482,9 +482,9 @@ int gdlm_hold_lvb(lm_lock_t *lock, char **lvbp)
482 return error; 482 return error;
483} 483}
484 484
485void gdlm_unhold_lvb(lm_lock_t *lock, char *lvb) 485void gdlm_unhold_lvb(void *lock, char *lvb)
486{ 486{
487 struct gdlm_lock *lp = (struct gdlm_lock *) lock; 487 struct gdlm_lock *lp = lock;
488 488
489 unhold_null_lock(lp); 489 unhold_null_lock(lp);
490 gdlm_del_lvb(lp); 490 gdlm_del_lvb(lp);
diff --git a/fs/gfs2/locking/dlm/lock_dlm.h b/fs/gfs2/locking/dlm/lock_dlm.h
index a4f534a0ecff..3a45c020d01e 100644
--- a/fs/gfs2/locking/dlm/lock_dlm.h
+++ b/fs/gfs2/locking/dlm/lock_dlm.h
@@ -112,7 +112,7 @@ struct gdlm_lock {
112 s16 cur; 112 s16 cur;
113 s16 req; 113 s16 req;
114 s16 prev_req; 114 s16 prev_req;
115 u32 lkf; /* dlm flags DLM_LKF_ */ 115 u32 lkf; /* dlm flags DLM_LKF_ */
116 unsigned long flags; /* lock_dlm flags LFL_ */ 116 unsigned long flags; /* lock_dlm flags LFL_ */
117 117
118 int bast_mode; /* protected by async_lock */ 118 int bast_mode; /* protected by async_lock */
@@ -165,23 +165,23 @@ int gdlm_release_all_locks(struct gdlm_ls *);
165void gdlm_delete_lp(struct gdlm_lock *); 165void gdlm_delete_lp(struct gdlm_lock *);
166unsigned int gdlm_do_lock(struct gdlm_lock *); 166unsigned int gdlm_do_lock(struct gdlm_lock *);
167 167
168int gdlm_get_lock(lm_lockspace_t *, struct lm_lockname *, lm_lock_t **); 168int gdlm_get_lock(void *, struct lm_lockname *, void **);
169void gdlm_put_lock(lm_lock_t *); 169void gdlm_put_lock(void *);
170unsigned int gdlm_lock(lm_lock_t *, unsigned int, unsigned int, unsigned int); 170unsigned int gdlm_lock(void *, unsigned int, unsigned int, unsigned int);
171unsigned int gdlm_unlock(lm_lock_t *, unsigned int); 171unsigned int gdlm_unlock(void *, unsigned int);
172void gdlm_cancel(lm_lock_t *); 172void gdlm_cancel(void *);
173int gdlm_hold_lvb(lm_lock_t *, char **); 173int gdlm_hold_lvb(void *, char **);
174void gdlm_unhold_lvb(lm_lock_t *, char *); 174void gdlm_unhold_lvb(void *, char *);
175 175
176/* plock.c */ 176/* plock.c */
177 177
178int gdlm_plock_init(void); 178int gdlm_plock_init(void);
179void gdlm_plock_exit(void); 179void gdlm_plock_exit(void);
180int gdlm_plock(lm_lockspace_t *, struct lm_lockname *, struct file *, int, 180int gdlm_plock(void *, struct lm_lockname *, struct file *, int,
181 struct file_lock *); 181 struct file_lock *);
182int gdlm_plock_get(lm_lockspace_t *, struct lm_lockname *, struct file *, 182int gdlm_plock_get(void *, struct lm_lockname *, struct file *,
183 struct file_lock *); 183 struct file_lock *);
184int gdlm_punlock(lm_lockspace_t *, struct lm_lockname *, struct file *, 184int gdlm_punlock(void *, struct lm_lockname *, struct file *,
185 struct file_lock *); 185 struct file_lock *);
186#endif 186#endif
187 187
diff --git a/fs/gfs2/locking/dlm/mount.c b/fs/gfs2/locking/dlm/mount.c
index 832fb819a2b5..1f94dd35a943 100644
--- a/fs/gfs2/locking/dlm/mount.c
+++ b/fs/gfs2/locking/dlm/mount.c
@@ -11,7 +11,7 @@
11 11
12int gdlm_drop_count; 12int gdlm_drop_count;
13int gdlm_drop_period; 13int gdlm_drop_period;
14struct lm_lockops gdlm_ops; 14const struct lm_lockops gdlm_ops;
15 15
16 16
17static struct gdlm_ls *init_gdlm(lm_callback_t cb, struct gfs2_sbd *sdp, 17static struct gdlm_ls *init_gdlm(lm_callback_t cb, struct gfs2_sbd *sdp,
@@ -120,7 +120,7 @@ static int make_args(struct gdlm_ls *ls, char *data_arg, int *nodir)
120} 120}
121 121
122static int gdlm_mount(char *table_name, char *host_data, 122static int gdlm_mount(char *table_name, char *host_data,
123 lm_callback_t cb, struct gfs2_sbd *sdp, 123 lm_callback_t cb, void *cb_data,
124 unsigned int min_lvb_size, int flags, 124 unsigned int min_lvb_size, int flags,
125 struct lm_lockstruct *lockstruct, 125 struct lm_lockstruct *lockstruct,
126 struct kobject *fskobj) 126 struct kobject *fskobj)
@@ -131,7 +131,7 @@ static int gdlm_mount(char *table_name, char *host_data,
131 if (min_lvb_size > GDLM_LVB_SIZE) 131 if (min_lvb_size > GDLM_LVB_SIZE)
132 goto out; 132 goto out;
133 133
134 ls = init_gdlm(cb, sdp, flags, table_name); 134 ls = init_gdlm(cb, cb_data, flags, table_name);
135 if (!ls) 135 if (!ls)
136 goto out; 136 goto out;
137 137
@@ -174,9 +174,9 @@ out:
174 return error; 174 return error;
175} 175}
176 176
177static void gdlm_unmount(lm_lockspace_t *lockspace) 177static void gdlm_unmount(void *lockspace)
178{ 178{
179 struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; 179 struct gdlm_ls *ls = lockspace;
180 int rv; 180 int rv;
181 181
182 log_debug("unmount flags %lx", ls->flags); 182 log_debug("unmount flags %lx", ls->flags);
@@ -198,18 +198,18 @@ out:
198 kfree(ls); 198 kfree(ls);
199} 199}
200 200
201static void gdlm_recovery_done(lm_lockspace_t *lockspace, unsigned int jid, 201static void gdlm_recovery_done(void *lockspace, unsigned int jid,
202 unsigned int message) 202 unsigned int message)
203{ 203{
204 struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; 204 struct gdlm_ls *ls = lockspace;
205 ls->recover_jid_done = jid; 205 ls->recover_jid_done = jid;
206 ls->recover_jid_status = message; 206 ls->recover_jid_status = message;
207 kobject_uevent(&ls->kobj, KOBJ_CHANGE); 207 kobject_uevent(&ls->kobj, KOBJ_CHANGE);
208} 208}
209 209
210static void gdlm_others_may_mount(lm_lockspace_t *lockspace) 210static void gdlm_others_may_mount(void *lockspace)
211{ 211{
212 struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; 212 struct gdlm_ls *ls = lockspace;
213 ls->first_done = 1; 213 ls->first_done = 1;
214 kobject_uevent(&ls->kobj, KOBJ_CHANGE); 214 kobject_uevent(&ls->kobj, KOBJ_CHANGE);
215} 215}
@@ -218,9 +218,9 @@ static void gdlm_others_may_mount(lm_lockspace_t *lockspace)
218 other mounters, and lets us know (sets WITHDRAW flag). Then, 218 other mounters, and lets us know (sets WITHDRAW flag). Then,
219 userspace leaves the mount group while we leave the lockspace. */ 219 userspace leaves the mount group while we leave the lockspace. */
220 220
221static void gdlm_withdraw(lm_lockspace_t *lockspace) 221static void gdlm_withdraw(void *lockspace)
222{ 222{
223 struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; 223 struct gdlm_ls *ls = lockspace;
224 224
225 kobject_uevent(&ls->kobj, KOBJ_OFFLINE); 225 kobject_uevent(&ls->kobj, KOBJ_OFFLINE);
226 226
@@ -233,7 +233,7 @@ static void gdlm_withdraw(lm_lockspace_t *lockspace)
233 gdlm_kobject_release(ls); 233 gdlm_kobject_release(ls);
234} 234}
235 235
236struct lm_lockops gdlm_ops = { 236const struct lm_lockops gdlm_ops = {
237 .lm_proto_name = "lock_dlm", 237 .lm_proto_name = "lock_dlm",
238 .lm_mount = gdlm_mount, 238 .lm_mount = gdlm_mount,
239 .lm_others_may_mount = gdlm_others_may_mount, 239 .lm_others_may_mount = gdlm_others_may_mount,
diff --git a/fs/gfs2/locking/dlm/plock.c b/fs/gfs2/locking/dlm/plock.c
index 263636b390fe..7365aec9511b 100644
--- a/fs/gfs2/locking/dlm/plock.c
+++ b/fs/gfs2/locking/dlm/plock.c
@@ -58,10 +58,10 @@ static void send_op(struct plock_op *op)
58 wake_up(&send_wq); 58 wake_up(&send_wq);
59} 59}
60 60
61int gdlm_plock(lm_lockspace_t *lockspace, struct lm_lockname *name, 61int gdlm_plock(void *lockspace, struct lm_lockname *name,
62 struct file *file, int cmd, struct file_lock *fl) 62 struct file *file, int cmd, struct file_lock *fl)
63{ 63{
64 struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; 64 struct gdlm_ls *ls = lockspace;
65 struct plock_op *op; 65 struct plock_op *op;
66 int rv; 66 int rv;
67 67
@@ -102,10 +102,10 @@ int gdlm_plock(lm_lockspace_t *lockspace, struct lm_lockname *name,
102 return rv; 102 return rv;
103} 103}
104 104
105int gdlm_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name, 105int gdlm_punlock(void *lockspace, struct lm_lockname *name,
106 struct file *file, struct file_lock *fl) 106 struct file *file, struct file_lock *fl)
107{ 107{
108 struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; 108 struct gdlm_ls *ls = lockspace;
109 struct plock_op *op; 109 struct plock_op *op;
110 int rv; 110 int rv;
111 111
@@ -141,10 +141,10 @@ int gdlm_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name,
141 return rv; 141 return rv;
142} 142}
143 143
144int gdlm_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name, 144int gdlm_plock_get(void *lockspace, struct lm_lockname *name,
145 struct file *file, struct file_lock *fl) 145 struct file *file, struct file_lock *fl)
146{ 146{
147 struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; 147 struct gdlm_ls *ls = lockspace;
148 struct plock_op *op; 148 struct plock_op *op;
149 int rv; 149 int rv;
150 150
@@ -231,8 +231,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
231 231
232 spin_lock(&ops_lock); 232 spin_lock(&ops_lock);
233 list_for_each_entry(op, &recv_list, list) { 233 list_for_each_entry(op, &recv_list, list) {
234 if (op->info.fsid == info.fsid && 234 if (op->info.fsid == info.fsid && op->info.number == info.number &&
235 op->info.number == info.number &&
236 op->info.owner == info.owner) { 235 op->info.owner == info.owner) {
237 list_del_init(&op->list); 236 list_del_init(&op->list);
238 found = 1; 237 found = 1;
diff --git a/fs/gfs2/locking/nolock/main.c b/fs/gfs2/locking/nolock/main.c
index ba7399787f62..7b263fc6c273 100644
--- a/fs/gfs2/locking/nolock/main.c
+++ b/fs/gfs2/locking/nolock/main.c
@@ -21,10 +21,10 @@ struct nolock_lockspace {
21 unsigned int nl_lvb_size; 21 unsigned int nl_lvb_size;
22}; 22};
23 23
24static struct lm_lockops nolock_ops; 24static const struct lm_lockops nolock_ops;
25 25
26static int nolock_mount(char *table_name, char *host_data, 26static int nolock_mount(char *table_name, char *host_data,
27 lm_callback_t cb, struct gfs2_sbd *sdp, 27 lm_callback_t cb, void *cb_data,
28 unsigned int min_lvb_size, int flags, 28 unsigned int min_lvb_size, int flags,
29 struct lm_lockstruct *lockstruct, 29 struct lm_lockstruct *lockstruct,
30 struct kobject *fskobj) 30 struct kobject *fskobj)
@@ -50,24 +50,24 @@ static int nolock_mount(char *table_name, char *host_data,
50 lockstruct->ls_jid = jid; 50 lockstruct->ls_jid = jid;
51 lockstruct->ls_first = 1; 51 lockstruct->ls_first = 1;
52 lockstruct->ls_lvb_size = min_lvb_size; 52 lockstruct->ls_lvb_size = min_lvb_size;
53 lockstruct->ls_lockspace = (lm_lockspace_t *)nl; 53 lockstruct->ls_lockspace = nl;
54 lockstruct->ls_ops = &nolock_ops; 54 lockstruct->ls_ops = &nolock_ops;
55 lockstruct->ls_flags = LM_LSFLAG_LOCAL; 55 lockstruct->ls_flags = LM_LSFLAG_LOCAL;
56 56
57 return 0; 57 return 0;
58} 58}
59 59
60static void nolock_others_may_mount(lm_lockspace_t *lockspace) 60static void nolock_others_may_mount(void *lockspace)
61{ 61{
62} 62}
63 63
64static void nolock_unmount(lm_lockspace_t *lockspace) 64static void nolock_unmount(void *lockspace)
65{ 65{
66 struct nolock_lockspace *nl = (struct nolock_lockspace *)lockspace; 66 struct nolock_lockspace *nl = lockspace;
67 kfree(nl); 67 kfree(nl);
68} 68}
69 69
70static void nolock_withdraw(lm_lockspace_t *lockspace) 70static void nolock_withdraw(void *lockspace)
71{ 71{
72} 72}
73 73
@@ -80,10 +80,10 @@ static void nolock_withdraw(lm_lockspace_t *lockspace)
80 * Returns: 0 on success, -EXXX on failure 80 * Returns: 0 on success, -EXXX on failure
81 */ 81 */
82 82
83static int nolock_get_lock(lm_lockspace_t *lockspace, struct lm_lockname *name, 83static int nolock_get_lock(void *lockspace, struct lm_lockname *name,
84 lm_lock_t **lockp) 84 void **lockp)
85{ 85{
86 *lockp = (lm_lock_t *)lockspace; 86 *lockp = lockspace;
87 return 0; 87 return 0;
88} 88}
89 89
@@ -93,7 +93,7 @@ static int nolock_get_lock(lm_lockspace_t *lockspace, struct lm_lockname *name,
93 * 93 *
94 */ 94 */
95 95
96static void nolock_put_lock(lm_lock_t *lock) 96static void nolock_put_lock(void *lock)
97{ 97{
98} 98}
99 99
@@ -107,7 +107,7 @@ static void nolock_put_lock(lm_lock_t *lock)
107 * Returns: A bitmap of LM_OUT_* 107 * Returns: A bitmap of LM_OUT_*
108 */ 108 */
109 109
110static unsigned int nolock_lock(lm_lock_t *lock, unsigned int cur_state, 110static unsigned int nolock_lock(void *lock, unsigned int cur_state,
111 unsigned int req_state, unsigned int flags) 111 unsigned int req_state, unsigned int flags)
112{ 112{
113 return req_state | LM_OUT_CACHEABLE; 113 return req_state | LM_OUT_CACHEABLE;
@@ -121,12 +121,12 @@ static unsigned int nolock_lock(lm_lock_t *lock, unsigned int cur_state,
121 * Returns: 0 121 * Returns: 0
122 */ 122 */
123 123
124static unsigned int nolock_unlock(lm_lock_t *lock, unsigned int cur_state) 124static unsigned int nolock_unlock(void *lock, unsigned int cur_state)
125{ 125{
126 return 0; 126 return 0;
127} 127}
128 128
129static void nolock_cancel(lm_lock_t *lock) 129static void nolock_cancel(void *lock)
130{ 130{
131} 131}
132 132
@@ -138,9 +138,9 @@ static void nolock_cancel(lm_lock_t *lock)
138 * Returns: 0 on success, -EXXX on failure 138 * Returns: 0 on success, -EXXX on failure
139 */ 139 */
140 140
141static int nolock_hold_lvb(lm_lock_t *lock, char **lvbp) 141static int nolock_hold_lvb(void *lock, char **lvbp)
142{ 142{
143 struct nolock_lockspace *nl = (struct nolock_lockspace *)lock; 143 struct nolock_lockspace *nl = lock;
144 int error = 0; 144 int error = 0;
145 145
146 *lvbp = kzalloc(nl->nl_lvb_size, GFP_KERNEL); 146 *lvbp = kzalloc(nl->nl_lvb_size, GFP_KERNEL);
@@ -157,12 +157,12 @@ static int nolock_hold_lvb(lm_lock_t *lock, char **lvbp)
157 * 157 *
158 */ 158 */
159 159
160static void nolock_unhold_lvb(lm_lock_t *lock, char *lvb) 160static void nolock_unhold_lvb(void *lock, char *lvb)
161{ 161{
162 kfree(lvb); 162 kfree(lvb);
163} 163}
164 164
165static int nolock_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name, 165static int nolock_plock_get(void *lockspace, struct lm_lockname *name,
166 struct file *file, struct file_lock *fl) 166 struct file *file, struct file_lock *fl)
167{ 167{
168 struct file_lock tmp; 168 struct file_lock tmp;
@@ -176,7 +176,7 @@ static int nolock_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name,
176 return 0; 176 return 0;
177} 177}
178 178
179static int nolock_plock(lm_lockspace_t *lockspace, struct lm_lockname *name, 179static int nolock_plock(void *lockspace, struct lm_lockname *name,
180 struct file *file, int cmd, struct file_lock *fl) 180 struct file *file, int cmd, struct file_lock *fl)
181{ 181{
182 int error; 182 int error;
@@ -184,7 +184,7 @@ static int nolock_plock(lm_lockspace_t *lockspace, struct lm_lockname *name,
184 return error; 184 return error;
185} 185}
186 186
187static int nolock_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name, 187static int nolock_punlock(void *lockspace, struct lm_lockname *name,
188 struct file *file, struct file_lock *fl) 188 struct file *file, struct file_lock *fl)
189{ 189{
190 int error; 190 int error;
@@ -192,12 +192,12 @@ static int nolock_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name,
192 return error; 192 return error;
193} 193}
194 194
195static void nolock_recovery_done(lm_lockspace_t *lockspace, unsigned int jid, 195static void nolock_recovery_done(void *lockspace, unsigned int jid,
196 unsigned int message) 196 unsigned int message)
197{ 197{
198} 198}
199 199
200static struct lm_lockops nolock_ops = { 200static const struct lm_lockops nolock_ops = {
201 .lm_proto_name = "lock_nolock", 201 .lm_proto_name = "lock_nolock",
202 .lm_mount = nolock_mount, 202 .lm_mount = nolock_mount,
203 .lm_others_may_mount = nolock_others_may_mount, 203 .lm_others_may_mount = nolock_others_may_mount,