Skip to content

Commit 3f4475b

Browse files
author
Andreas Gruenbacher
committed
Revert "GFS2: Don't add all glocks to the lru"
This reverts commit e7ccaf5. Before commit e7ccaf5, every time a resource group glock was dequeued by gfs2_glock_dq(), it was added to the glock LRU list even though the glock was still referenced by the resource group and could never be evicted, anyway. Commit e7ccaf5 added a GLOF_LRU hack to avoid that overhead for resource group glocks, and that hack was since adopted for some other types of glocks as well. We now no longer add glocks to the glock LRU list while they are still referenced. This solves the underlying problem, and obsoletes the GLOF_LRU hack. Signed-off-by: Andreas Gruenbacher <[email protected]> (cherry picked from commit 3e5257c810cba91e274d07f3db5cf013c7c830be)
1 parent 767fd5a commit 3f4475b

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

fs/gfs2/glock.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,7 @@ static int demote_ok(const struct gfs2_glock *gl)
239239

240240
static void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
241241
{
242-
if (!(gl->gl_ops->go_flags & GLOF_LRU))
243-
return;
244-
245242
spin_lock(&lru_lock);
246-
247243
list_move_tail(&gl->gl_lru, &lru_list);
248244

249245
if (!test_bit(GLF_LRU, &gl->gl_flags)) {
@@ -256,9 +252,6 @@ static void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
256252

257253
static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
258254
{
259-
if (!(gl->gl_ops->go_flags & GLOF_LRU))
260-
return;
261-
262255
spin_lock(&lru_lock);
263256
if (test_bit(GLF_LRU, &gl->gl_flags)) {
264257
list_del_init(&gl->gl_lru);

fs/gfs2/glops.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ const struct gfs2_glock_operations gfs2_inode_glops = {
727727
.go_held = inode_go_held,
728728
.go_dump = inode_go_dump,
729729
.go_type = LM_TYPE_INODE,
730-
.go_flags = GLOF_ASPACE | GLOF_LRU | GLOF_LVB,
730+
.go_flags = GLOF_ASPACE | GLOF_LVB,
731731
.go_unlocked = inode_go_unlocked,
732732
};
733733

@@ -751,13 +751,13 @@ const struct gfs2_glock_operations gfs2_iopen_glops = {
751751
.go_type = LM_TYPE_IOPEN,
752752
.go_callback = iopen_go_callback,
753753
.go_dump = inode_go_dump,
754-
.go_flags = GLOF_LRU | GLOF_NONDISK,
754+
.go_flags = GLOF_NONDISK,
755755
.go_subclass = 1,
756756
};
757757

758758
const struct gfs2_glock_operations gfs2_flock_glops = {
759759
.go_type = LM_TYPE_FLOCK,
760-
.go_flags = GLOF_LRU | GLOF_NONDISK,
760+
.go_flags = GLOF_NONDISK,
761761
};
762762

763763
const struct gfs2_glock_operations gfs2_nondisk_glops = {
@@ -768,7 +768,7 @@ const struct gfs2_glock_operations gfs2_nondisk_glops = {
768768

769769
const struct gfs2_glock_operations gfs2_quota_glops = {
770770
.go_type = LM_TYPE_QUOTA,
771-
.go_flags = GLOF_LVB | GLOF_LRU | GLOF_NONDISK,
771+
.go_flags = GLOF_LVB | GLOF_NONDISK,
772772
};
773773

774774
const struct gfs2_glock_operations gfs2_journal_glops = {

fs/gfs2/incore.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ struct gfs2_glock_operations {
230230
const unsigned long go_flags;
231231
#define GLOF_ASPACE 1 /* address space attached */
232232
#define GLOF_LVB 2 /* Lock Value Block attached */
233-
#define GLOF_LRU 4 /* LRU managed */
234233
#define GLOF_NONDISK 8 /* not I/O related */
235234
};
236235

0 commit comments

Comments
 (0)