]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Revert "GFS2: Don't add all glocks to the lru"
authorAndreas Gruenbacher <agruenba@redhat.com>
Sat, 30 Mar 2024 04:08:32 +0000 (05:08 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 29 May 2024 13:34:55 +0000 (15:34 +0200)
This reverts commit e7ccaf5fe1590667b3fa2f8df5c5ec9ba0dc5b85.

Before commit e7ccaf5fe159, 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 e7ccaf5fe159 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 <agruenba@redhat.com>
(cherry picked from commit 3e5257c810cba91e274d07f3db5cf013c7c830be)

fs/gfs2/glock.c
fs/gfs2/glops.c
fs/gfs2/incore.h

index e2a72c21194ad5ac724e4f55534dfaa3630f736f..19f8df91b72e5a5a98408329326d28e0a47f38df 100644 (file)
@@ -239,11 +239,7 @@ static int demote_ok(const struct gfs2_glock *gl)
 
 static void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
 {
-       if (!(gl->gl_ops->go_flags & GLOF_LRU))
-               return;
-
        spin_lock(&lru_lock);
-
        list_move_tail(&gl->gl_lru, &lru_list);
 
        if (!test_bit(GLF_LRU, &gl->gl_flags)) {
@@ -256,9 +252,6 @@ static void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
 
 static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
 {
-       if (!(gl->gl_ops->go_flags & GLOF_LRU))
-               return;
-
        spin_lock(&lru_lock);
        if (test_bit(GLF_LRU, &gl->gl_flags)) {
                list_del_init(&gl->gl_lru);
index 39bb6758a2a09259f5bc5bae41d44ffb39aef1ba..7bc7f6785abde1105fa217e237278721f2bc1fad 100644 (file)
@@ -727,7 +727,7 @@ const struct gfs2_glock_operations gfs2_inode_glops = {
        .go_held = inode_go_held,
        .go_dump = inode_go_dump,
        .go_type = LM_TYPE_INODE,
-       .go_flags = GLOF_ASPACE | GLOF_LRU | GLOF_LVB,
+       .go_flags = GLOF_ASPACE | GLOF_LVB,
        .go_unlocked = inode_go_unlocked,
 };
 
@@ -751,13 +751,13 @@ const struct gfs2_glock_operations gfs2_iopen_glops = {
        .go_type = LM_TYPE_IOPEN,
        .go_callback = iopen_go_callback,
        .go_dump = inode_go_dump,
-       .go_flags = GLOF_LRU | GLOF_NONDISK,
+       .go_flags = GLOF_NONDISK,
        .go_subclass = 1,
 };
 
 const struct gfs2_glock_operations gfs2_flock_glops = {
        .go_type = LM_TYPE_FLOCK,
-       .go_flags = GLOF_LRU | GLOF_NONDISK,
+       .go_flags = GLOF_NONDISK,
 };
 
 const struct gfs2_glock_operations gfs2_nondisk_glops = {
@@ -768,7 +768,7 @@ const struct gfs2_glock_operations gfs2_nondisk_glops = {
 
 const struct gfs2_glock_operations gfs2_quota_glops = {
        .go_type = LM_TYPE_QUOTA,
-       .go_flags = GLOF_LVB | GLOF_LRU | GLOF_NONDISK,
+       .go_flags = GLOF_LVB | GLOF_NONDISK,
 };
 
 const struct gfs2_glock_operations gfs2_journal_glops = {
index 5ee46af1f4bded73cbbcca5dcc2e8f5ed029e43e..f75982d456354fd3a1eee0a1e6088bfeb160d1dd 100644 (file)
@@ -230,7 +230,6 @@ struct gfs2_glock_operations {
        const unsigned long go_flags;
 #define GLOF_ASPACE 1 /* address space attached */
 #define GLOF_LVB    2 /* Lock Value Block attached */
-#define GLOF_LRU    4 /* LRU managed */
 #define GLOF_NONDISK   8 /* not I/O related */
 };