Skip to content

Commit f75efef

Browse files
author
Andreas Gruenbacher
committed
gfs2: Clean up glock demote logic
The logic for determining when to demote a glock in glock_work_func(), introduced in commit 7cf8dcd ("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 <[email protected]>
1 parent 5a1906a commit f75efef

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

fs/gfs2/glock.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,11 +1091,13 @@ static void glock_work_func(struct work_struct *work)
10911091
if (test_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) &&
10921092
gl->gl_state != LM_ST_UNLOCKED &&
10931093
gl->gl_demote_state != LM_ST_EXCLUSIVE) {
1094-
unsigned long holdtime, now = jiffies;
1094+
if (gl->gl_name.ln_type == LM_TYPE_INODE) {
1095+
unsigned long holdtime, now = jiffies;
10951096

1096-
holdtime = gl->gl_tchange + gl->gl_hold_time;
1097-
if (time_before(now, holdtime))
1098-
delay = holdtime - now;
1097+
holdtime = gl->gl_tchange + gl->gl_hold_time;
1098+
if (time_before(now, holdtime))
1099+
delay = holdtime - now;
1100+
}
10991101

11001102
if (!delay) {
11011103
clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags);
@@ -1106,8 +1108,6 @@ static void glock_work_func(struct work_struct *work)
11061108
if (delay) {
11071109
/* Keep one glock reference for the work we requeue. */
11081110
drop_refs--;
1109-
if (gl->gl_name.ln_type != LM_TYPE_INODE)
1110-
delay = 0;
11111111
gfs2_glock_queue_work(gl, delay);
11121112
}
11131113

0 commit comments

Comments
 (0)