]> www.infradead.org Git - users/hch/xfs.git/commitdiff
gfs2: use lockref_init for gl_lockref
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 30 Jan 2025 13:56:21 +0000 (14:56 +0100)
committerChristian Brauner <brauner@kernel.org>
Fri, 7 Feb 2025 09:27:25 +0000 (10:27 +0100)
Move the initialization of gl_lockref from gfs2_init_glock_once() to
gfs2_glock_get().  This allows to use lockref_init() there.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Link: https://lore.kernel.org/r/20250130135624.1899988-2-agruenba@redhat.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/gfs2/glock.c
fs/gfs2/main.c

index 8c4c1f871a8896f99ab37a7b84ed314af77c4cde..b29eb71e3e29ef20ea2027872832f7736b4caffc 100644 (file)
@@ -1201,8 +1201,8 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
        if (glops->go_instantiate)
                gl->gl_flags |= BIT(GLF_INSTANTIATE_NEEDED);
        gl->gl_name = name;
+       lockref_init(&gl->gl_lockref, 1);
        lockdep_set_subclass(&gl->gl_lockref.lock, glops->go_subclass);
-       gl->gl_lockref.count = 1;
        gl->gl_state = LM_ST_UNLOCKED;
        gl->gl_target = LM_ST_UNLOCKED;
        gl->gl_demote_state = LM_ST_EXCLUSIVE;
index 04cadc02e5a6ed8e14614d9ba4c2de506c6d1813..0727f60ad02883d629c87b8986364e2dd9e5d6e4 100644 (file)
@@ -51,7 +51,6 @@ static void gfs2_init_glock_once(void *foo)
 {
        struct gfs2_glock *gl = foo;
 
-       spin_lock_init(&gl->gl_lockref.lock);
        INIT_LIST_HEAD(&gl->gl_holders);
        INIT_LIST_HEAD(&gl->gl_lru);
        INIT_LIST_HEAD(&gl->gl_ail_list);