[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3b1965d56a463604b5a0a003d32fe6983bc297ba.1756222465.git.josef@toxicpanda.com>
Date: Tue, 26 Aug 2025 11:39:53 -0400
From: Josef Bacik <josef@...icpanda.com>
To: linux-fsdevel@...r.kernel.org,
linux-btrfs@...r.kernel.org,
kernel-team@...com,
linux-ext4@...r.kernel.org,
linux-xfs@...r.kernel.org,
brauner@...nel.org,
viro@...IV.linux.org.uk,
amir73il@...il.com
Subject: [PATCH v2 53/54] fs: remove I_LRU_ISOLATING flag
If the inode is on the LRU it has a full reference and thus no longer
needs to be pinned while it is being isolated.
Remove the I_LRU_ISOLATING flag and associated helper functions
(inode_pin_lru_isolating, inode_unpin_lru_isolating, and
inode_wait_for_lru_isolating) as they are no longer needed.
Signed-off-by: Josef Bacik <josef@...icpanda.com>
---
fs/inode.c | 46 --------------------------------
include/linux/fs.h | 39 ++++++++++++---------------
include/trace/events/writeback.h | 1 -
3 files changed, 17 insertions(+), 69 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index 4f77db7aca75..77f009edd5df 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -656,49 +656,6 @@ void inode_lru_list_del(struct inode *inode)
}
}
-static void inode_pin_lru_isolating(struct inode *inode)
-{
- lockdep_assert_held(&inode->i_lock);
- WARN_ON(inode->i_state & I_LRU_ISOLATING);
- inode->i_state |= I_LRU_ISOLATING;
-}
-
-static void inode_unpin_lru_isolating(struct inode *inode)
-{
- spin_lock(&inode->i_lock);
- WARN_ON(!(inode->i_state & I_LRU_ISOLATING));
- inode->i_state &= ~I_LRU_ISOLATING;
- /* Called with inode->i_lock which ensures memory ordering. */
- inode_wake_up_bit(inode, __I_LRU_ISOLATING);
- spin_unlock(&inode->i_lock);
-}
-
-static void inode_wait_for_lru_isolating(struct inode *inode)
-{
- struct wait_bit_queue_entry wqe;
- struct wait_queue_head *wq_head;
-
- lockdep_assert_held(&inode->i_lock);
- if (!(inode->i_state & I_LRU_ISOLATING))
- return;
-
- wq_head = inode_bit_waitqueue(&wqe, inode, __I_LRU_ISOLATING);
- for (;;) {
- prepare_to_wait_event(wq_head, &wqe.wq_entry, TASK_UNINTERRUPTIBLE);
- /*
- * Checking I_LRU_ISOLATING with inode->i_lock guarantees
- * memory ordering.
- */
- if (!(inode->i_state & I_LRU_ISOLATING))
- break;
- spin_unlock(&inode->i_lock);
- schedule();
- spin_lock(&inode->i_lock);
- }
- finish_wait(wq_head, &wqe.wq_entry);
- WARN_ON(inode->i_state & I_LRU_ISOLATING);
-}
-
/**
* inode_sb_list_add - add inode to the superblock list of inodes
* @inode: inode to add
@@ -885,7 +842,6 @@ static void evict(struct inode *inode)
inode_sb_list_del(inode);
spin_lock(&inode->i_lock);
- inode_wait_for_lru_isolating(inode);
/*
* Wait for flusher thread to be done with the inode so that filesystem
@@ -1030,7 +986,6 @@ static enum lru_status inode_lru_isolate(struct list_head *item,
* be under pressure before the cache inside the highmem zone.
*/
if (inode_has_buffers(inode) || !mapping_empty(&inode->i_data)) {
- inode_pin_lru_isolating(inode);
spin_unlock(&inode->i_lock);
spin_unlock(&lru->lock);
if (remove_inode_buffers(inode)) {
@@ -1042,7 +997,6 @@ static enum lru_status inode_lru_isolate(struct list_head *item,
__count_vm_events(PGINODESTEAL, reap);
mm_account_reclaimed_pages(reap);
}
- inode_unpin_lru_isolating(inode);
return LRU_RETRY;
}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 39cde53c1b3b..61113026efd5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -734,9 +734,6 @@ is_uncached_acl(struct posix_acl *acl)
*
* I_PINNING_FSCACHE_WB Inode is pinning an fscache object for writeback.
*
- * I_LRU_ISOLATING Inode is pinned being isolated from LRU without holding
- * i_count.
- *
* I_LRU Inode is on the LRU list and has an associated LRU
* reference count. Used to distinguish inodes where
* ->i_lru is on the LRU and those that are using ->i_lru
@@ -745,34 +742,32 @@ is_uncached_acl(struct posix_acl *acl)
* I_CACHED_LRU Inode is cached because it is dirty or isn't shrinkable,
* and thus is on the s_cached_inode_lru list.
*
- * __I_{SYNC,NEW,LRU_ISOLATING} are used to derive unique addresses to wait
- * upon. There's one free address left.
+ * __I_{SYNC,NEW} are used to derive unique addresses to wait upon. There are
+ * two free address left.
*/
enum inode_state_bits {
__I_NEW = 0U,
- __I_SYNC = 1U,
- __I_LRU_ISOLATING = 2U
+ __I_SYNC = 1U
};
enum inode_state_flags_t {
I_NEW = (1U << __I_NEW),
I_SYNC = (1U << __I_SYNC),
- I_LRU_ISOLATING = (1U << __I_LRU_ISOLATING),
- I_DIRTY_SYNC = (1U << 3),
- I_DIRTY_DATASYNC = (1U << 4),
- I_DIRTY_PAGES = (1U << 5),
- I_CLEAR = (1U << 6),
- I_LINKABLE = (1U << 7),
- I_DIRTY_TIME = (1U << 8),
- I_WB_SWITCH = (1U << 9),
- I_OVL_INUSE = (1U << 10),
- I_CREATING = (1U << 11),
- I_DONTCACHE = (1U << 12),
- I_SYNC_QUEUED = (1U << 13),
- I_PINNING_NETFS_WB = (1U << 14),
- I_LRU = (1U << 15),
- I_CACHED_LRU = (1U << 16)
+ I_DIRTY_SYNC = (1U << 2),
+ I_DIRTY_DATASYNC = (1U << 3),
+ I_DIRTY_PAGES = (1U << 4),
+ I_CLEAR = (1U << 5),
+ I_LINKABLE = (1U << 6),
+ I_DIRTY_TIME = (1U << 7),
+ I_WB_SWITCH = (1U << 8),
+ I_OVL_INUSE = (1U << 9),
+ I_CREATING = (1U << 10),
+ I_DONTCACHE = (1U << 11),
+ I_SYNC_QUEUED = (1U << 12),
+ I_PINNING_NETFS_WB = (1U << 13),
+ I_LRU = (1U << 14),
+ I_CACHED_LRU = (1U << 15)
};
#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index b419b8060dda..a5b73d25eda6 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -25,7 +25,6 @@
{I_DONTCACHE, "I_DONTCACHE"}, \
{I_SYNC_QUEUED, "I_SYNC_QUEUED"}, \
{I_PINNING_NETFS_WB, "I_PINNING_NETFS_WB"}, \
- {I_LRU_ISOLATING, "I_LRU_ISOLATING"}, \
{I_LRU, "I_LRU"}, \
{I_CACHED_LRU, "I_CACHED_LRU"} \
)
--
2.49.0
Powered by blists - more mailing lists