gfs2: Minor gfs2_glock_cb cleanup
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 19 Aug 2024 11:32:44 +0000 (13:32 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 20 Aug 2024 14:06:43 +0000 (16:06 +0200)
In gfs2_glock_cb(), we only need to calculate the glock hold time for
inode glocks; the value is unused otherwise.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/glock.c

index 12a769077ea0b36c72fb2361b466d179766620cd..4a026703a28d865ad38be8dbbafb6a1a84140844 100644 (file)
@@ -1885,14 +1885,16 @@ void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs)
 void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
 {
        unsigned long delay = 0;
-       unsigned long holdtime;
-       unsigned long now = jiffies;
 
        gfs2_glock_hold(gl);
        spin_lock(&gl->gl_lockref.lock);
-       holdtime = gl->gl_tchange + gl->gl_hold_time;
        if (!list_empty(&gl->gl_holders) &&
            gl->gl_name.ln_type == LM_TYPE_INODE) {
+               unsigned long now = jiffies;
+               unsigned long holdtime;
+
+               holdtime = gl->gl_tchange + gl->gl_hold_time;
+
                if (time_before(now, holdtime))
                        delay = holdtime - now;
                if (test_bit(GLF_HAVE_REPLY, &gl->gl_flags))