diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2022-12-05 14:44:37 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2022-12-06 16:06:32 +0100 |
commit | 3781ec9e09123d955b93fc8522ffb683a51f865d (patch) | |
tree | d850a613525a6c615596325c8d2fb995dd1ade30 /fs/gfs2/glock.c | |
parent | fe1bff6517de789d491844f53e61e4ff02e8f8b1 (diff) | |
download | linux-stable-3781ec9e09123d955b93fc8522ffb683a51f865d.tar.gz linux-stable-3781ec9e09123d955b93fc8522ffb683a51f865d.tar.bz2 linux-stable-3781ec9e09123d955b93fc8522ffb683a51f865d.zip |
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>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 0f5c5c12d8c6..76432efe6e02 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -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; |