gfs2: Uninline and improve glock_{set,clear}_object
Those functions have reached a size at which having them inline isn't useful anymore, so uninline them. In addition, report the glock name on assertion failures. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:
parent
fe1bff6517
commit
3781ec9e09
@ -928,6 +928,48 @@ out_unlock:
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* glock_set_object - set the gl_object field of a glock
|
||||
* @gl: the glock
|
||||
* @object: the object
|
||||
*/
|
||||
void glock_set_object(struct gfs2_glock *gl, void *object)
|
||||
{
|
||||
void *prev_object;
|
||||
|
||||
spin_lock(&gl->gl_lockref.lock);
|
||||
prev_object = gl->gl_object;
|
||||
gl->gl_object = object;
|
||||
spin_unlock(&gl->gl_lockref.lock);
|
||||
if (gfs2_assert_warn(gl->gl_name.ln_sbd, prev_object == NULL)) {
|
||||
pr_warn("glock=%u/%llx\n",
|
||||
gl->gl_name.ln_type,
|
||||
(unsigned long long)gl->gl_name.ln_number);
|
||||
gfs2_dump_glock(NULL, gl, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* glock_clear_object - clear the gl_object field of a glock
|
||||
* @gl: the glock
|
||||
*/
|
||||
void glock_clear_object(struct gfs2_glock *gl, void *object)
|
||||
{
|
||||
void *prev_object;
|
||||
|
||||
spin_lock(&gl->gl_lockref.lock);
|
||||
prev_object = gl->gl_object;
|
||||
gl->gl_object = NULL;
|
||||
spin_unlock(&gl->gl_lockref.lock);
|
||||
if (gfs2_assert_warn(gl->gl_name.ln_sbd,
|
||||
prev_object == object || prev_object == NULL)) {
|
||||
pr_warn("glock=%u/%llx\n",
|
||||
gl->gl_name.ln_type,
|
||||
(unsigned long long)gl->gl_name.ln_number);
|
||||
gfs2_dump_glock(NULL, gl, true);
|
||||
}
|
||||
}
|
||||
|
||||
void gfs2_inode_remember_delete(struct gfs2_glock *gl, u64 generation)
|
||||
{
|
||||
struct gfs2_inode_lvb *ri = (void *)gl->gl_lksb.sb_lvbptr;
|
||||
|
@ -288,6 +288,9 @@ extern void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp);
|
||||
extern void gfs2_register_debugfs(void);
|
||||
extern void gfs2_unregister_debugfs(void);
|
||||
|
||||
extern void glock_set_object(struct gfs2_glock *gl, void *object);
|
||||
extern void glock_clear_object(struct gfs2_glock *gl, void *object);
|
||||
|
||||
extern const struct lm_lockops gfs2_dlm_ops;
|
||||
|
||||
static inline void gfs2_holder_mark_uninitialized(struct gfs2_holder *gh)
|
||||
@ -305,32 +308,6 @@ static inline bool gfs2_holder_queued(struct gfs2_holder *gh)
|
||||
return !list_empty(&gh->gh_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* glock_set_object - set the gl_object field of a glock
|
||||
* @gl: the glock
|
||||
* @object: the object
|
||||
*/
|
||||
static inline void glock_set_object(struct gfs2_glock *gl, void *object)
|
||||
{
|
||||
spin_lock(&gl->gl_lockref.lock);
|
||||
if (gfs2_assert_warn(gl->gl_name.ln_sbd, gl->gl_object == NULL))
|
||||
gfs2_dump_glock(NULL, gl, true);
|
||||
gl->gl_object = object;
|
||||
spin_unlock(&gl->gl_lockref.lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* glock_clear_object - clear the gl_object field of a glock
|
||||
* @gl: the glock
|
||||
*/
|
||||
static inline void glock_clear_object(struct gfs2_glock *gl, void *object)
|
||||
{
|
||||
spin_lock(&gl->gl_lockref.lock);
|
||||
if (gl->gl_object == object)
|
||||
gl->gl_object = NULL;
|
||||
spin_unlock(&gl->gl_lockref.lock);
|
||||
}
|
||||
|
||||
static inline void gfs2_holder_allow_demote(struct gfs2_holder *gh)
|
||||
{
|
||||
struct gfs2_glock *gl = gh->gh_gl;
|
||||
|
Loading…
Reference in New Issue
Block a user