diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2024-07-08 22:46:16 +0300 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2024-07-09 11:40:03 +0300 |
commit | f75efefb6db305b5b5c56a9b9ae2d72b54f20780 (patch) | |
tree | 029cbce4696cf6dcbde0f5ef0f5b0bc3170b5262 /fs/gfs2 | |
parent | 5a1906a476bc84145f20cd1941aa1250d38db4aa (diff) | |
download | linux-f75efefb6db305b5b5c56a9b9ae2d72b54f20780.tar.xz |
gfs2: Clean up glock demote logic
The logic for determining when to demote a glock in glock_work_func(),
introduced in commit 7cf8dcd3b68a ("GFS2: Automatically adjust glock min
hold time"), doesn't make sense: inode glocks have a minimum hold time
that delays demotion, while all other glocks are expected to be demoted
immediately. Instead of demoting non-inode glocks immediately,
glock_work_func() schedules glock work for them to be demoted, however.
Get rid of that unnecessary indirection.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/glock.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 7f68e3d217e6..12a769077ea0 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1091,11 +1091,13 @@ static void glock_work_func(struct work_struct *work) if (test_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) && gl->gl_state != LM_ST_UNLOCKED && gl->gl_demote_state != LM_ST_EXCLUSIVE) { - unsigned long holdtime, now = jiffies; + if (gl->gl_name.ln_type == LM_TYPE_INODE) { + unsigned long holdtime, now = jiffies; - holdtime = gl->gl_tchange + gl->gl_hold_time; - if (time_before(now, holdtime)) - delay = holdtime - now; + holdtime = gl->gl_tchange + gl->gl_hold_time; + if (time_before(now, holdtime)) + delay = holdtime - now; + } if (!delay) { clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags); @@ -1106,8 +1108,6 @@ static void glock_work_func(struct work_struct *work) if (delay) { /* Keep one glock reference for the work we requeue. */ drop_refs--; - if (gl->gl_name.ln_type != LM_TYPE_INODE) - delay = 0; gfs2_glock_queue_work(gl, delay); } |