]> git.baikalelectronics.ru Git - kernel.git/commit
gfs2: eliminate GLF_QUEUED flag in favor of list_empty(gl_holders)
authorBob Peterson <rpeterso@redhat.com>
Mon, 12 Oct 2020 18:57:37 +0000 (13:57 -0500)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 15 Oct 2020 15:04:53 +0000 (17:04 +0200)
commit4173683fea8d598ee153f0d610c49414b46ae586
treeaca3a8209bc80bc402d9c11232d86a58ce743594
parentb7fd945ba94929fd233d1e19d2fcab2ac635af72
gfs2: eliminate GLF_QUEUED flag in favor of list_empty(gl_holders)

Before this patch, glock.c maintained a flag, GLF_QUEUED, which indicated
when a glock had a holder queued. It was only checked for inode glocks,
although set and cleared by all glocks, and it was only used to determine
whether the glock should be held for the minimum hold time before releasing.

The problem is that the flag is not accurate at all. If a process holds
the glock, the flag is set. When they dequeue the glock, it only cleared
the flag in cases when the state actually changed. So if the state doesn't
change, the flag may still be set, even when nothing is queued.

This happens to iopen glocks often: the get held in SH, then the file is
closed, but the glock remains in SH mode.

We don't need a special flag to indicate this: we can simply tell whether
the glock has any items queued to the holders queue. It's a waste of cpu
time to maintain it.

This patch eliminates the flag in favor of simply checking list_empty
on the glock holders.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/glock.c
fs/gfs2/incore.h
fs/gfs2/trace_gfs2.h