mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-17 13:58:46 +00:00
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>
This commit is contained in:
parent
5a1906a476
commit
f75efefb6d
@ -1091,11 +1091,13 @@ static void glock_work_func(struct work_struct *work)
|
|||||||
if (test_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) &&
|
if (test_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) &&
|
||||||
gl->gl_state != LM_ST_UNLOCKED &&
|
gl->gl_state != LM_ST_UNLOCKED &&
|
||||||
gl->gl_demote_state != LM_ST_EXCLUSIVE) {
|
gl->gl_demote_state != LM_ST_EXCLUSIVE) {
|
||||||
|
if (gl->gl_name.ln_type == LM_TYPE_INODE) {
|
||||||
unsigned long holdtime, now = jiffies;
|
unsigned long holdtime, now = jiffies;
|
||||||
|
|
||||||
holdtime = gl->gl_tchange + gl->gl_hold_time;
|
holdtime = gl->gl_tchange + gl->gl_hold_time;
|
||||||
if (time_before(now, holdtime))
|
if (time_before(now, holdtime))
|
||||||
delay = holdtime - now;
|
delay = holdtime - now;
|
||||||
|
}
|
||||||
|
|
||||||
if (!delay) {
|
if (!delay) {
|
||||||
clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags);
|
clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags);
|
||||||
@ -1106,8 +1108,6 @@ static void glock_work_func(struct work_struct *work)
|
|||||||
if (delay) {
|
if (delay) {
|
||||||
/* Keep one glock reference for the work we requeue. */
|
/* Keep one glock reference for the work we requeue. */
|
||||||
drop_refs--;
|
drop_refs--;
|
||||||
if (gl->gl_name.ln_type != LM_TYPE_INODE)
|
|
||||||
delay = 0;
|
|
||||||
gfs2_glock_queue_work(gl, delay);
|
gfs2_glock_queue_work(gl, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user