diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2024-03-28 20:46:25 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2024-05-29 15:34:55 +0200 |
commit | 713f8834389f4b34bc8b449412202543c8b32214 (patch) | |
tree | 3fd04cf01fd5ef0343f6cbaaaf8a0f3660d913c8 /fs/gfs2/glock.c | |
parent | 3f4475bf24de31cce4a0c7d1372d4ab02b1f1407 (diff) |
gfs2: Get rid of demote_ok checks
The demote_ok glock operation is only still used to prevent the inode
glocks of the "jindex" and "rindex" directories from getting recycled
while they are still referenced by sdp->sd_jindex and sdp->sd_rindex.
However, the LRU walking code will no longer recycle glocks which are
referenced, so the demote_ok glock operation is obsolete and can be
removed.
Each of a glock's holders in the gl_holders list is holding a reference
on the glock, so when the list of holders isn't empty in demote_ok(),
the existing reference count check will already prevent the glock from
getting released. This means that demote_ok() is obsolete as well.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 19f8df91b72e..7f68e3d217e6 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -216,27 +216,6 @@ struct gfs2_glock *gfs2_glock_hold(struct gfs2_glock *gl) return gl; } -/** - * demote_ok - Check to see if it's ok to unlock a glock - * @gl: the glock - * - * Returns: 1 if it's ok - */ - -static int demote_ok(const struct gfs2_glock *gl) -{ - const struct gfs2_glock_operations *glops = gl->gl_ops; - - if (gl->gl_state == LM_ST_UNLOCKED) - return 0; - if (!list_empty(&gl->gl_holders)) - return 0; - if (glops->go_demote_ok) - return glops->go_demote_ok(gl); - return 1; -} - - static void gfs2_glock_add_to_lru(struct gfs2_glock *gl) { spin_lock(&lru_lock); @@ -2049,7 +2028,7 @@ add_back_to_lru: clear_bit(GLF_LRU, &gl->gl_flags); freed++; gl->gl_lockref.count++; - if (demote_ok(gl)) + if (gl->gl_state != LM_ST_UNLOCKED) request_demote(gl, LM_ST_UNLOCKED, 0, false); gfs2_glock_queue_work(gl, 0); spin_unlock(&gl->gl_lockref.lock); |