[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>
This commit is contained in:
parent
a2c4580797
commit
9b47c11d1c
@ -1713,8 +1713,9 @@ static void blocking_cb(struct gfs2_sbd *sdp, struct lm_lockname *name,
|
|||||||
* a journal from another client needs to be recovered.
|
* a journal from another client needs to be recovered.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void gfs2_glock_cb(struct gfs2_sbd *sdp, unsigned int type, void *data)
|
void gfs2_glock_cb(void *cb_data, unsigned int type, void *data)
|
||||||
{
|
{
|
||||||
|
struct gfs2_sbd *sdp = cb_data;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LM_CB_NEED_E:
|
case LM_CB_NEED_E:
|
||||||
|
@ -140,7 +140,7 @@ static inline int gfs2_glock_nq_init(struct gfs2_glock *gl,
|
|||||||
int gfs2_lvb_hold(struct gfs2_glock *gl);
|
int gfs2_lvb_hold(struct gfs2_glock *gl);
|
||||||
void gfs2_lvb_unhold(struct gfs2_glock *gl);
|
void gfs2_lvb_unhold(struct gfs2_glock *gl);
|
||||||
|
|
||||||
void gfs2_glock_cb(struct gfs2_sbd *sdp, unsigned int type, void *data);
|
void gfs2_glock_cb(void *cb_data, unsigned int type, void *data);
|
||||||
|
|
||||||
void gfs2_iopen_go_callback(struct gfs2_glock *gl, unsigned int state);
|
void gfs2_iopen_go_callback(struct gfs2_glock *gl, unsigned int state);
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ struct gfs2_glock {
|
|||||||
struct gfs2_holder *gl_req_gh;
|
struct gfs2_holder *gl_req_gh;
|
||||||
gfs2_glop_bh_t gl_req_bh;
|
gfs2_glop_bh_t gl_req_bh;
|
||||||
|
|
||||||
lm_lock_t *gl_lock;
|
void *gl_lock;
|
||||||
char *gl_lvb;
|
char *gl_lvb;
|
||||||
atomic_t gl_lvb_count;
|
atomic_t gl_lvb_count;
|
||||||
|
|
||||||
|
14
fs/gfs2/lm.c
14
fs/gfs2/lm.c
@ -122,7 +122,7 @@ int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
|
int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
|
||||||
lm_lock_t **lockp)
|
void **lockp)
|
||||||
{
|
{
|
||||||
int error = -EIO;
|
int error = -EIO;
|
||||||
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
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,
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfs2_lm_put_lock(struct gfs2_sbd *sdp, lm_lock_t *lock)
|
void gfs2_lm_put_lock(struct gfs2_sbd *sdp, void *lock)
|
||||||
{
|
{
|
||||||
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
||||||
sdp->sd_lockstruct.ls_ops->lm_put_lock(lock);
|
sdp->sd_lockstruct.ls_ops->lm_put_lock(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, lm_lock_t *lock,
|
unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock,
|
||||||
unsigned int cur_state, unsigned int req_state,
|
unsigned int cur_state, unsigned int req_state,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
@ -148,7 +148,7 @@ unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, lm_lock_t *lock,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, lm_lock_t *lock,
|
unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, void *lock,
|
||||||
unsigned int cur_state)
|
unsigned int cur_state)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -157,13 +157,13 @@ unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, lm_lock_t *lock,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfs2_lm_cancel(struct gfs2_sbd *sdp, lm_lock_t *lock)
|
void gfs2_lm_cancel(struct gfs2_sbd *sdp, void *lock)
|
||||||
{
|
{
|
||||||
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
||||||
sdp->sd_lockstruct.ls_ops->lm_cancel(lock);
|
sdp->sd_lockstruct.ls_ops->lm_cancel(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char **lvbp)
|
int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp)
|
||||||
{
|
{
|
||||||
int error = -EIO;
|
int error = -EIO;
|
||||||
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
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)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char *lvb)
|
void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, void *lock, char *lvb)
|
||||||
{
|
{
|
||||||
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
|
||||||
sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(lock, lvb);
|
sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(lock, lvb);
|
||||||
|
14
fs/gfs2/lm.h
14
fs/gfs2/lm.h
@ -20,16 +20,16 @@ void gfs2_lm_unmount(struct gfs2_sbd *sdp);
|
|||||||
int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
|
int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...)
|
||||||
__attribute__ ((format(printf, 2, 3)));
|
__attribute__ ((format(printf, 2, 3)));
|
||||||
int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
|
int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name,
|
||||||
lm_lock_t **lockp);
|
void **lockp);
|
||||||
void gfs2_lm_put_lock(struct gfs2_sbd *sdp, lm_lock_t *lock);
|
void gfs2_lm_put_lock(struct gfs2_sbd *sdp, void *lock);
|
||||||
unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, lm_lock_t *lock,
|
unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock,
|
||||||
unsigned int cur_state, unsigned int req_state,
|
unsigned int cur_state, unsigned int req_state,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, lm_lock_t *lock,
|
unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, void *lock,
|
||||||
unsigned int cur_state);
|
unsigned int cur_state);
|
||||||
void gfs2_lm_cancel(struct gfs2_sbd *sdp, lm_lock_t *lock);
|
void gfs2_lm_cancel(struct gfs2_sbd *sdp, void *lock);
|
||||||
int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char **lvbp);
|
int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp);
|
||||||
void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char *lvb);
|
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,
|
int gfs2_lm_plock_get(struct gfs2_sbd *sdp, struct lm_lockname *name,
|
||||||
struct file *file, struct file_lock *fl);
|
struct file *file, struct file_lock *fl);
|
||||||
int gfs2_lm_plock(struct gfs2_sbd *sdp, struct lm_lockname *name,
|
int gfs2_lm_plock(struct gfs2_sbd *sdp, struct lm_lockname *name,
|
||||||
|
@ -10,16 +10,8 @@
|
|||||||
#ifndef __LM_INTERFACE_DOT_H__
|
#ifndef __LM_INTERFACE_DOT_H__
|
||||||
#define __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_callback_t) (void *ptr, unsigned int type, void *data);
|
||||||
typedef void lm_lock_t;
|
|
||||||
struct gfs2_sbd;
|
|
||||||
|
|
||||||
typedef void (*lm_callback_t) (struct gfs2_sbd *sdp, unsigned int type, void *data);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* lm_mount() flags
|
* lm_mount() flags
|
||||||
@ -175,64 +167,60 @@ struct lm_async_cb {
|
|||||||
struct lm_lockstruct;
|
struct lm_lockstruct;
|
||||||
|
|
||||||
struct lm_lockops {
|
struct lm_lockops {
|
||||||
char lm_proto_name[256];
|
const char *lm_proto_name;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mount/Unmount
|
* Mount/Unmount
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*lm_mount) (char *table_name, char *host_data,
|
int (*lm_mount) (char *table_name, char *host_data,
|
||||||
lm_callback_t cb, struct gfs2_sbd *sdp,
|
lm_callback_t cb, void *cb_data,
|
||||||
unsigned int min_lvb_size, int flags,
|
unsigned int min_lvb_size, int flags,
|
||||||
struct lm_lockstruct *lockstruct,
|
struct lm_lockstruct *lockstruct,
|
||||||
struct kobject *fskobj);
|
struct kobject *fskobj);
|
||||||
|
|
||||||
void (*lm_others_may_mount) (lm_lockspace_t *lockspace);
|
void (*lm_others_may_mount) (void *lockspace);
|
||||||
|
|
||||||
void (*lm_unmount) (lm_lockspace_t *lockspace);
|
void (*lm_unmount) (void *lockspace);
|
||||||
|
|
||||||
void (*lm_withdraw) (lm_lockspace_t *lockspace);
|
void (*lm_withdraw) (void *lockspace);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock oriented operations
|
* Lock oriented operations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*lm_get_lock) (lm_lockspace_t *lockspace,
|
int (*lm_get_lock) (void *lockspace, struct lm_lockname *name, void **lockp);
|
||||||
struct lm_lockname *name, lm_lock_t **lockp);
|
|
||||||
|
|
||||||
void (*lm_put_lock) (lm_lock_t *lock);
|
void (*lm_put_lock) (void *lock);
|
||||||
|
|
||||||
unsigned int (*lm_lock) (lm_lock_t *lock, unsigned int cur_state,
|
unsigned int (*lm_lock) (void *lock, unsigned int cur_state,
|
||||||
unsigned int req_state, unsigned int flags);
|
unsigned int req_state, unsigned int flags);
|
||||||
|
|
||||||
unsigned int (*lm_unlock) (lm_lock_t *lock, unsigned int cur_state);
|
unsigned int (*lm_unlock) (void *lock, unsigned int cur_state);
|
||||||
|
|
||||||
void (*lm_cancel) (lm_lock_t *lock);
|
void (*lm_cancel) (void *lock);
|
||||||
|
|
||||||
int (*lm_hold_lvb) (lm_lock_t *lock, char **lvbp);
|
int (*lm_hold_lvb) (void *lock, char **lvbp);
|
||||||
void (*lm_unhold_lvb) (lm_lock_t *lock, char *lvb);
|
void (*lm_unhold_lvb) (void *lock, char *lvb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Posix Lock oriented operations
|
* Posix Lock oriented operations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*lm_plock_get) (lm_lockspace_t *lockspace,
|
int (*lm_plock_get) (void *lockspace, struct lm_lockname *name,
|
||||||
struct lm_lockname *name,
|
|
||||||
struct file *file, struct file_lock *fl);
|
struct file *file, struct file_lock *fl);
|
||||||
|
|
||||||
int (*lm_plock) (lm_lockspace_t *lockspace,
|
int (*lm_plock) (void *lockspace, struct lm_lockname *name,
|
||||||
struct lm_lockname *name,
|
|
||||||
struct file *file, int cmd, struct file_lock *fl);
|
struct file *file, int cmd, struct file_lock *fl);
|
||||||
|
|
||||||
int (*lm_punlock) (lm_lockspace_t *lockspace,
|
int (*lm_punlock) (void *lockspace, struct lm_lockname *name,
|
||||||
struct lm_lockname *name,
|
|
||||||
struct file *file, struct file_lock *fl);
|
struct file *file, struct file_lock *fl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Client oriented operations
|
* Client oriented operations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void (*lm_recovery_done) (lm_lockspace_t *lockspace, unsigned int jid,
|
void (*lm_recovery_done) (void *lockspace, unsigned int jid,
|
||||||
unsigned int message);
|
unsigned int message);
|
||||||
|
|
||||||
struct module *lm_owner;
|
struct module *lm_owner;
|
||||||
@ -253,8 +241,8 @@ struct lm_lockstruct {
|
|||||||
unsigned int ls_jid;
|
unsigned int ls_jid;
|
||||||
unsigned int ls_first;
|
unsigned int ls_first;
|
||||||
unsigned int ls_lvb_size;
|
unsigned int ls_lvb_size;
|
||||||
lm_lockspace_t *ls_lockspace;
|
void *ls_lockspace;
|
||||||
struct lm_lockops *ls_ops;
|
const struct lm_lockops *ls_ops;
|
||||||
int ls_flags;
|
int ls_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -263,9 +251,8 @@ struct lm_lockstruct {
|
|||||||
* with these functions.
|
* with these functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gfs2_register_lockproto(struct lm_lockops *proto);
|
int gfs2_register_lockproto(const struct lm_lockops *proto);
|
||||||
|
void gfs2_unregister_lockproto(const struct lm_lockops *proto);
|
||||||
void gfs2_unregister_lockproto(struct lm_lockops *proto);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock module top interface. GFS calls these functions when mounting or
|
* Lock module top interface. GFS calls these functions when mounting or
|
||||||
@ -273,7 +260,7 @@ void gfs2_unregister_lockproto(struct lm_lockops *proto);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
|
int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
|
||||||
lm_callback_t cb, struct gfs2_sbd *sdp,
|
lm_callback_t cb, void *cb_data,
|
||||||
unsigned int min_lvb_size, int flags,
|
unsigned int min_lvb_size, int flags,
|
||||||
struct lm_lockstruct *lockstruct,
|
struct lm_lockstruct *lockstruct,
|
||||||
struct kobject *fskobj);
|
struct kobject *fskobj);
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
struct lmh_wrapper {
|
struct lmh_wrapper {
|
||||||
struct list_head lw_list;
|
struct list_head lw_list;
|
||||||
struct lm_lockops *lw_ops;
|
const struct lm_lockops *lw_ops;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* List of registered low-level locking protocols. A file system selects one
|
/* List of registered low-level locking protocols. A file system selects one
|
||||||
@ -37,7 +37,7 @@ static DEFINE_MUTEX(lmh_lock);
|
|||||||
* Returns: 0 on success, -EXXX on failure
|
* Returns: 0 on success, -EXXX on failure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gfs2_register_lockproto(struct lm_lockops *proto)
|
int gfs2_register_lockproto(const struct lm_lockops *proto)
|
||||||
{
|
{
|
||||||
struct lmh_wrapper *lw;
|
struct lmh_wrapper *lw;
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ int gfs2_register_lockproto(struct lm_lockops *proto)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void gfs2_unregister_lockproto(struct lm_lockops *proto)
|
void gfs2_unregister_lockproto(const struct lm_lockops *proto)
|
||||||
{
|
{
|
||||||
struct lmh_wrapper *lw;
|
struct lmh_wrapper *lw;
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ void gfs2_unregister_lockproto(struct lm_lockops *proto)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
|
int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
|
||||||
lm_callback_t cb, struct gfs2_sbd *sdp,
|
lm_callback_t cb, void *cb_data,
|
||||||
unsigned int min_lvb_size, int flags,
|
unsigned int min_lvb_size, int flags,
|
||||||
struct lm_lockstruct *lockstruct,
|
struct lm_lockstruct *lockstruct,
|
||||||
struct kobject *fskobj)
|
struct kobject *fskobj)
|
||||||
@ -147,7 +147,7 @@ retry:
|
|||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = lw->lw_ops->lm_mount(table_name, host_data, cb, sdp,
|
error = lw->lw_ops->lm_mount(table_name, host_data, cb, cb_data,
|
||||||
min_lvb_size, flags, lockstruct, fskobj);
|
min_lvb_size, flags, lockstruct, fskobj);
|
||||||
if (error)
|
if (error)
|
||||||
module_put(lw->lw_ops->lm_owner);
|
module_put(lw->lw_ops->lm_owner);
|
||||||
|
@ -207,21 +207,21 @@ void gdlm_delete_lp(struct gdlm_lock *lp)
|
|||||||
kfree(lp);
|
kfree(lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gdlm_get_lock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
int gdlm_get_lock(void *lockspace, struct lm_lockname *name,
|
||||||
lm_lock_t **lockp)
|
void **lockp)
|
||||||
{
|
{
|
||||||
struct gdlm_lock *lp;
|
struct gdlm_lock *lp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = gdlm_create_lp((struct gdlm_ls *) lockspace, name, &lp);
|
error = gdlm_create_lp(lockspace, name, &lp);
|
||||||
|
|
||||||
*lockp = (lm_lock_t *) lp;
|
*lockp = lp;
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gdlm_put_lock(lm_lock_t *lock)
|
void gdlm_put_lock(void *lock)
|
||||||
{
|
{
|
||||||
gdlm_delete_lp((struct gdlm_lock *) lock);
|
gdlm_delete_lp(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int gdlm_do_lock(struct gdlm_lock *lp)
|
unsigned int gdlm_do_lock(struct gdlm_lock *lp)
|
||||||
@ -305,10 +305,10 @@ static unsigned int gdlm_do_unlock(struct gdlm_lock *lp)
|
|||||||
return LM_OUT_ASYNC;
|
return LM_OUT_ASYNC;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int gdlm_lock(lm_lock_t *lock, unsigned int cur_state,
|
unsigned int gdlm_lock(void *lock, unsigned int cur_state,
|
||||||
unsigned int req_state, unsigned int flags)
|
unsigned int req_state, unsigned int flags)
|
||||||
{
|
{
|
||||||
struct gdlm_lock *lp = (struct gdlm_lock *) lock;
|
struct gdlm_lock *lp = lock;
|
||||||
|
|
||||||
clear_bit(LFL_DLM_CANCEL, &lp->flags);
|
clear_bit(LFL_DLM_CANCEL, &lp->flags);
|
||||||
if (flags & LM_FLAG_NOEXP)
|
if (flags & LM_FLAG_NOEXP)
|
||||||
@ -321,9 +321,9 @@ unsigned int gdlm_lock(lm_lock_t *lock, unsigned int cur_state,
|
|||||||
return gdlm_do_lock(lp);
|
return gdlm_do_lock(lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int gdlm_unlock(lm_lock_t *lock, unsigned int cur_state)
|
unsigned int gdlm_unlock(void *lock, unsigned int cur_state)
|
||||||
{
|
{
|
||||||
struct gdlm_lock *lp = (struct gdlm_lock *) lock;
|
struct gdlm_lock *lp = lock;
|
||||||
|
|
||||||
clear_bit(LFL_DLM_CANCEL, &lp->flags);
|
clear_bit(LFL_DLM_CANCEL, &lp->flags);
|
||||||
if (lp->cur == DLM_LOCK_IV)
|
if (lp->cur == DLM_LOCK_IV)
|
||||||
@ -331,9 +331,9 @@ unsigned int gdlm_unlock(lm_lock_t *lock, unsigned int cur_state)
|
|||||||
return gdlm_do_unlock(lp);
|
return gdlm_do_unlock(lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gdlm_cancel(lm_lock_t *lock)
|
void gdlm_cancel(void *lock)
|
||||||
{
|
{
|
||||||
struct gdlm_lock *lp = (struct gdlm_lock *) lock;
|
struct gdlm_lock *lp = lock;
|
||||||
struct gdlm_ls *ls = lp->ls;
|
struct gdlm_ls *ls = lp->ls;
|
||||||
int error, delay_list = 0;
|
int error, delay_list = 0;
|
||||||
|
|
||||||
@ -464,9 +464,9 @@ static void unhold_null_lock(struct gdlm_lock *lp)
|
|||||||
intact on the resource while the lvb is "held" even if it's holding no locks
|
intact on the resource while the lvb is "held" even if it's holding no locks
|
||||||
on the resource. */
|
on the resource. */
|
||||||
|
|
||||||
int gdlm_hold_lvb(lm_lock_t *lock, char **lvbp)
|
int gdlm_hold_lvb(void *lock, char **lvbp)
|
||||||
{
|
{
|
||||||
struct gdlm_lock *lp = (struct gdlm_lock *) lock;
|
struct gdlm_lock *lp = lock;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = gdlm_add_lvb(lp);
|
error = gdlm_add_lvb(lp);
|
||||||
@ -482,9 +482,9 @@ int gdlm_hold_lvb(lm_lock_t *lock, char **lvbp)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gdlm_unhold_lvb(lm_lock_t *lock, char *lvb)
|
void gdlm_unhold_lvb(void *lock, char *lvb)
|
||||||
{
|
{
|
||||||
struct gdlm_lock *lp = (struct gdlm_lock *) lock;
|
struct gdlm_lock *lp = lock;
|
||||||
|
|
||||||
unhold_null_lock(lp);
|
unhold_null_lock(lp);
|
||||||
gdlm_del_lvb(lp);
|
gdlm_del_lvb(lp);
|
||||||
|
@ -112,7 +112,7 @@ struct gdlm_lock {
|
|||||||
s16 cur;
|
s16 cur;
|
||||||
s16 req;
|
s16 req;
|
||||||
s16 prev_req;
|
s16 prev_req;
|
||||||
u32 lkf; /* dlm flags DLM_LKF_ */
|
u32 lkf; /* dlm flags DLM_LKF_ */
|
||||||
unsigned long flags; /* lock_dlm flags LFL_ */
|
unsigned long flags; /* lock_dlm flags LFL_ */
|
||||||
|
|
||||||
int bast_mode; /* protected by async_lock */
|
int bast_mode; /* protected by async_lock */
|
||||||
@ -165,23 +165,23 @@ int gdlm_release_all_locks(struct gdlm_ls *);
|
|||||||
void gdlm_delete_lp(struct gdlm_lock *);
|
void gdlm_delete_lp(struct gdlm_lock *);
|
||||||
unsigned int gdlm_do_lock(struct gdlm_lock *);
|
unsigned int gdlm_do_lock(struct gdlm_lock *);
|
||||||
|
|
||||||
int gdlm_get_lock(lm_lockspace_t *, struct lm_lockname *, lm_lock_t **);
|
int gdlm_get_lock(void *, struct lm_lockname *, void **);
|
||||||
void gdlm_put_lock(lm_lock_t *);
|
void gdlm_put_lock(void *);
|
||||||
unsigned int gdlm_lock(lm_lock_t *, unsigned int, unsigned int, unsigned int);
|
unsigned int gdlm_lock(void *, unsigned int, unsigned int, unsigned int);
|
||||||
unsigned int gdlm_unlock(lm_lock_t *, unsigned int);
|
unsigned int gdlm_unlock(void *, unsigned int);
|
||||||
void gdlm_cancel(lm_lock_t *);
|
void gdlm_cancel(void *);
|
||||||
int gdlm_hold_lvb(lm_lock_t *, char **);
|
int gdlm_hold_lvb(void *, char **);
|
||||||
void gdlm_unhold_lvb(lm_lock_t *, char *);
|
void gdlm_unhold_lvb(void *, char *);
|
||||||
|
|
||||||
/* plock.c */
|
/* plock.c */
|
||||||
|
|
||||||
int gdlm_plock_init(void);
|
int gdlm_plock_init(void);
|
||||||
void gdlm_plock_exit(void);
|
void gdlm_plock_exit(void);
|
||||||
int gdlm_plock(lm_lockspace_t *, struct lm_lockname *, struct file *, int,
|
int gdlm_plock(void *, struct lm_lockname *, struct file *, int,
|
||||||
struct file_lock *);
|
struct file_lock *);
|
||||||
int gdlm_plock_get(lm_lockspace_t *, struct lm_lockname *, struct file *,
|
int gdlm_plock_get(void *, struct lm_lockname *, struct file *,
|
||||||
struct file_lock *);
|
struct file_lock *);
|
||||||
int gdlm_punlock(lm_lockspace_t *, struct lm_lockname *, struct file *,
|
int gdlm_punlock(void *, struct lm_lockname *, struct file *,
|
||||||
struct file_lock *);
|
struct file_lock *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
int gdlm_drop_count;
|
int gdlm_drop_count;
|
||||||
int gdlm_drop_period;
|
int gdlm_drop_period;
|
||||||
struct lm_lockops gdlm_ops;
|
const struct lm_lockops gdlm_ops;
|
||||||
|
|
||||||
|
|
||||||
static struct gdlm_ls *init_gdlm(lm_callback_t cb, struct gfs2_sbd *sdp,
|
static 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)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int gdlm_mount(char *table_name, char *host_data,
|
static int gdlm_mount(char *table_name, char *host_data,
|
||||||
lm_callback_t cb, struct gfs2_sbd *sdp,
|
lm_callback_t cb, void *cb_data,
|
||||||
unsigned int min_lvb_size, int flags,
|
unsigned int min_lvb_size, int flags,
|
||||||
struct lm_lockstruct *lockstruct,
|
struct lm_lockstruct *lockstruct,
|
||||||
struct kobject *fskobj)
|
struct kobject *fskobj)
|
||||||
@ -131,7 +131,7 @@ static int gdlm_mount(char *table_name, char *host_data,
|
|||||||
if (min_lvb_size > GDLM_LVB_SIZE)
|
if (min_lvb_size > GDLM_LVB_SIZE)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ls = init_gdlm(cb, sdp, flags, table_name);
|
ls = init_gdlm(cb, cb_data, flags, table_name);
|
||||||
if (!ls)
|
if (!ls)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -174,9 +174,9 @@ out:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gdlm_unmount(lm_lockspace_t *lockspace)
|
static void gdlm_unmount(void *lockspace)
|
||||||
{
|
{
|
||||||
struct gdlm_ls *ls = (struct gdlm_ls *) lockspace;
|
struct gdlm_ls *ls = lockspace;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
log_debug("unmount flags %lx", ls->flags);
|
log_debug("unmount flags %lx", ls->flags);
|
||||||
@ -198,18 +198,18 @@ out:
|
|||||||
kfree(ls);
|
kfree(ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gdlm_recovery_done(lm_lockspace_t *lockspace, unsigned int jid,
|
static void gdlm_recovery_done(void *lockspace, unsigned int jid,
|
||||||
unsigned int message)
|
unsigned int message)
|
||||||
{
|
{
|
||||||
struct gdlm_ls *ls = (struct gdlm_ls *) lockspace;
|
struct gdlm_ls *ls = lockspace;
|
||||||
ls->recover_jid_done = jid;
|
ls->recover_jid_done = jid;
|
||||||
ls->recover_jid_status = message;
|
ls->recover_jid_status = message;
|
||||||
kobject_uevent(&ls->kobj, KOBJ_CHANGE);
|
kobject_uevent(&ls->kobj, KOBJ_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gdlm_others_may_mount(lm_lockspace_t *lockspace)
|
static void gdlm_others_may_mount(void *lockspace)
|
||||||
{
|
{
|
||||||
struct gdlm_ls *ls = (struct gdlm_ls *) lockspace;
|
struct gdlm_ls *ls = lockspace;
|
||||||
ls->first_done = 1;
|
ls->first_done = 1;
|
||||||
kobject_uevent(&ls->kobj, KOBJ_CHANGE);
|
kobject_uevent(&ls->kobj, KOBJ_CHANGE);
|
||||||
}
|
}
|
||||||
@ -218,9 +218,9 @@ static void gdlm_others_may_mount(lm_lockspace_t *lockspace)
|
|||||||
other mounters, and lets us know (sets WITHDRAW flag). Then,
|
other mounters, and lets us know (sets WITHDRAW flag). Then,
|
||||||
userspace leaves the mount group while we leave the lockspace. */
|
userspace leaves the mount group while we leave the lockspace. */
|
||||||
|
|
||||||
static void gdlm_withdraw(lm_lockspace_t *lockspace)
|
static void gdlm_withdraw(void *lockspace)
|
||||||
{
|
{
|
||||||
struct gdlm_ls *ls = (struct gdlm_ls *) lockspace;
|
struct gdlm_ls *ls = lockspace;
|
||||||
|
|
||||||
kobject_uevent(&ls->kobj, KOBJ_OFFLINE);
|
kobject_uevent(&ls->kobj, KOBJ_OFFLINE);
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ static void gdlm_withdraw(lm_lockspace_t *lockspace)
|
|||||||
gdlm_kobject_release(ls);
|
gdlm_kobject_release(ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct lm_lockops gdlm_ops = {
|
const struct lm_lockops gdlm_ops = {
|
||||||
.lm_proto_name = "lock_dlm",
|
.lm_proto_name = "lock_dlm",
|
||||||
.lm_mount = gdlm_mount,
|
.lm_mount = gdlm_mount,
|
||||||
.lm_others_may_mount = gdlm_others_may_mount,
|
.lm_others_may_mount = gdlm_others_may_mount,
|
||||||
|
@ -58,10 +58,10 @@ static void send_op(struct plock_op *op)
|
|||||||
wake_up(&send_wq);
|
wake_up(&send_wq);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gdlm_plock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
int gdlm_plock(void *lockspace, struct lm_lockname *name,
|
||||||
struct file *file, int cmd, struct file_lock *fl)
|
struct file *file, int cmd, struct file_lock *fl)
|
||||||
{
|
{
|
||||||
struct gdlm_ls *ls = (struct gdlm_ls *) lockspace;
|
struct gdlm_ls *ls = lockspace;
|
||||||
struct plock_op *op;
|
struct plock_op *op;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
@ -102,10 +102,10 @@ int gdlm_plock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gdlm_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
int gdlm_punlock(void *lockspace, struct lm_lockname *name,
|
||||||
struct file *file, struct file_lock *fl)
|
struct file *file, struct file_lock *fl)
|
||||||
{
|
{
|
||||||
struct gdlm_ls *ls = (struct gdlm_ls *) lockspace;
|
struct gdlm_ls *ls = lockspace;
|
||||||
struct plock_op *op;
|
struct plock_op *op;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
@ -141,10 +141,10 @@ int gdlm_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gdlm_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
int gdlm_plock_get(void *lockspace, struct lm_lockname *name,
|
||||||
struct file *file, struct file_lock *fl)
|
struct file *file, struct file_lock *fl)
|
||||||
{
|
{
|
||||||
struct gdlm_ls *ls = (struct gdlm_ls *) lockspace;
|
struct gdlm_ls *ls = lockspace;
|
||||||
struct plock_op *op;
|
struct plock_op *op;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
@ -231,8 +231,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
|
|||||||
|
|
||||||
spin_lock(&ops_lock);
|
spin_lock(&ops_lock);
|
||||||
list_for_each_entry(op, &recv_list, list) {
|
list_for_each_entry(op, &recv_list, list) {
|
||||||
if (op->info.fsid == info.fsid &&
|
if (op->info.fsid == info.fsid && op->info.number == info.number &&
|
||||||
op->info.number == info.number &&
|
|
||||||
op->info.owner == info.owner) {
|
op->info.owner == info.owner) {
|
||||||
list_del_init(&op->list);
|
list_del_init(&op->list);
|
||||||
found = 1;
|
found = 1;
|
||||||
|
@ -21,10 +21,10 @@ struct nolock_lockspace {
|
|||||||
unsigned int nl_lvb_size;
|
unsigned int nl_lvb_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct lm_lockops nolock_ops;
|
static const struct lm_lockops nolock_ops;
|
||||||
|
|
||||||
static int nolock_mount(char *table_name, char *host_data,
|
static int nolock_mount(char *table_name, char *host_data,
|
||||||
lm_callback_t cb, struct gfs2_sbd *sdp,
|
lm_callback_t cb, void *cb_data,
|
||||||
unsigned int min_lvb_size, int flags,
|
unsigned int min_lvb_size, int flags,
|
||||||
struct lm_lockstruct *lockstruct,
|
struct lm_lockstruct *lockstruct,
|
||||||
struct kobject *fskobj)
|
struct kobject *fskobj)
|
||||||
@ -50,24 +50,24 @@ static int nolock_mount(char *table_name, char *host_data,
|
|||||||
lockstruct->ls_jid = jid;
|
lockstruct->ls_jid = jid;
|
||||||
lockstruct->ls_first = 1;
|
lockstruct->ls_first = 1;
|
||||||
lockstruct->ls_lvb_size = min_lvb_size;
|
lockstruct->ls_lvb_size = min_lvb_size;
|
||||||
lockstruct->ls_lockspace = (lm_lockspace_t *)nl;
|
lockstruct->ls_lockspace = nl;
|
||||||
lockstruct->ls_ops = &nolock_ops;
|
lockstruct->ls_ops = &nolock_ops;
|
||||||
lockstruct->ls_flags = LM_LSFLAG_LOCAL;
|
lockstruct->ls_flags = LM_LSFLAG_LOCAL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nolock_others_may_mount(lm_lockspace_t *lockspace)
|
static void nolock_others_may_mount(void *lockspace)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nolock_unmount(lm_lockspace_t *lockspace)
|
static void nolock_unmount(void *lockspace)
|
||||||
{
|
{
|
||||||
struct nolock_lockspace *nl = (struct nolock_lockspace *)lockspace;
|
struct nolock_lockspace *nl = lockspace;
|
||||||
kfree(nl);
|
kfree(nl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nolock_withdraw(lm_lockspace_t *lockspace)
|
static void nolock_withdraw(void *lockspace)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,10 +80,10 @@ static void nolock_withdraw(lm_lockspace_t *lockspace)
|
|||||||
* Returns: 0 on success, -EXXX on failure
|
* Returns: 0 on success, -EXXX on failure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int nolock_get_lock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
static int nolock_get_lock(void *lockspace, struct lm_lockname *name,
|
||||||
lm_lock_t **lockp)
|
void **lockp)
|
||||||
{
|
{
|
||||||
*lockp = (lm_lock_t *)lockspace;
|
*lockp = lockspace;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ static int nolock_get_lock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void nolock_put_lock(lm_lock_t *lock)
|
static void nolock_put_lock(void *lock)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ static void nolock_put_lock(lm_lock_t *lock)
|
|||||||
* Returns: A bitmap of LM_OUT_*
|
* Returns: A bitmap of LM_OUT_*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static unsigned int nolock_lock(lm_lock_t *lock, unsigned int cur_state,
|
static unsigned int nolock_lock(void *lock, unsigned int cur_state,
|
||||||
unsigned int req_state, unsigned int flags)
|
unsigned int req_state, unsigned int flags)
|
||||||
{
|
{
|
||||||
return req_state | LM_OUT_CACHEABLE;
|
return req_state | LM_OUT_CACHEABLE;
|
||||||
@ -121,12 +121,12 @@ static unsigned int nolock_lock(lm_lock_t *lock, unsigned int cur_state,
|
|||||||
* Returns: 0
|
* Returns: 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static unsigned int nolock_unlock(lm_lock_t *lock, unsigned int cur_state)
|
static unsigned int nolock_unlock(void *lock, unsigned int cur_state)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nolock_cancel(lm_lock_t *lock)
|
static void nolock_cancel(void *lock)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,9 +138,9 @@ static void nolock_cancel(lm_lock_t *lock)
|
|||||||
* Returns: 0 on success, -EXXX on failure
|
* Returns: 0 on success, -EXXX on failure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int nolock_hold_lvb(lm_lock_t *lock, char **lvbp)
|
static int nolock_hold_lvb(void *lock, char **lvbp)
|
||||||
{
|
{
|
||||||
struct nolock_lockspace *nl = (struct nolock_lockspace *)lock;
|
struct nolock_lockspace *nl = lock;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
*lvbp = kzalloc(nl->nl_lvb_size, GFP_KERNEL);
|
*lvbp = kzalloc(nl->nl_lvb_size, GFP_KERNEL);
|
||||||
@ -157,12 +157,12 @@ static int nolock_hold_lvb(lm_lock_t *lock, char **lvbp)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void nolock_unhold_lvb(lm_lock_t *lock, char *lvb)
|
static void nolock_unhold_lvb(void *lock, char *lvb)
|
||||||
{
|
{
|
||||||
kfree(lvb);
|
kfree(lvb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nolock_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
static int nolock_plock_get(void *lockspace, struct lm_lockname *name,
|
||||||
struct file *file, struct file_lock *fl)
|
struct file *file, struct file_lock *fl)
|
||||||
{
|
{
|
||||||
struct file_lock tmp;
|
struct file_lock tmp;
|
||||||
@ -176,7 +176,7 @@ static int nolock_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nolock_plock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
static int nolock_plock(void *lockspace, struct lm_lockname *name,
|
||||||
struct file *file, int cmd, struct file_lock *fl)
|
struct file *file, int cmd, struct file_lock *fl)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
@ -184,7 +184,7 @@ static int nolock_plock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nolock_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
static int nolock_punlock(void *lockspace, struct lm_lockname *name,
|
||||||
struct file *file, struct file_lock *fl)
|
struct file *file, struct file_lock *fl)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
@ -192,12 +192,12 @@ static int nolock_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nolock_recovery_done(lm_lockspace_t *lockspace, unsigned int jid,
|
static void nolock_recovery_done(void *lockspace, unsigned int jid,
|
||||||
unsigned int message)
|
unsigned int message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct lm_lockops nolock_ops = {
|
static const struct lm_lockops nolock_ops = {
|
||||||
.lm_proto_name = "lock_nolock",
|
.lm_proto_name = "lock_nolock",
|
||||||
.lm_mount = nolock_mount,
|
.lm_mount = nolock_mount,
|
||||||
.lm_others_may_mount = nolock_others_may_mount,
|
.lm_others_may_mount = nolock_others_may_mount,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user