* [PATCH] vfs: Remove invalidate_inodes()
@ 2025-03-07 14:43 Jan Kara
2025-03-07 20:01 ` Al Viro
2025-03-08 11:21 ` Christian Brauner
0 siblings, 2 replies; 3+ messages in thread
From: Jan Kara @ 2025-03-07 14:43 UTC (permalink / raw)
To: Christian Brauner; +Cc: linux-fsdevel, Al Viro, Kent Overstreet, Jan Kara
The function is exactly the same as evict_inodes() and has only one
user.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/inode.c | 40 ----------------------------------------
fs/internal.h | 1 -
fs/smb/client/file.c | 2 +-
fs/super.c | 2 +-
security/landlock/fs.c | 2 +-
5 files changed, 3 insertions(+), 44 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index 5587aabdaa5e..2e32df15748a 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -900,46 +900,6 @@ void evict_inodes(struct super_block *sb)
}
EXPORT_SYMBOL_GPL(evict_inodes);
-/**
- * invalidate_inodes - attempt to free all inodes on a superblock
- * @sb: superblock to operate on
- *
- * Attempts to free all inodes (including dirty inodes) for a given superblock.
- */
-void invalidate_inodes(struct super_block *sb)
-{
- struct inode *inode, *next;
- LIST_HEAD(dispose);
-
-again:
- spin_lock(&sb->s_inode_list_lock);
- list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
- spin_lock(&inode->i_lock);
- if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) {
- spin_unlock(&inode->i_lock);
- continue;
- }
- if (atomic_read(&inode->i_count)) {
- spin_unlock(&inode->i_lock);
- continue;
- }
-
- inode->i_state |= I_FREEING;
- inode_lru_list_del(inode);
- spin_unlock(&inode->i_lock);
- list_add(&inode->i_lru, &dispose);
- if (need_resched()) {
- spin_unlock(&sb->s_inode_list_lock);
- cond_resched();
- dispose_list(&dispose);
- goto again;
- }
- }
- spin_unlock(&sb->s_inode_list_lock);
-
- dispose_list(&dispose);
-}
-
/*
* Isolate the inode from the LRU in preparation for freeing it.
*
diff --git a/fs/internal.h b/fs/internal.h
index e7f02ae1e098..7cb515cede3f 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -207,7 +207,6 @@ bool in_group_or_capable(struct mnt_idmap *idmap,
* fs-writeback.c
*/
extern long get_nr_dirty_inodes(void);
-void invalidate_inodes(struct super_block *sb);
/*
* dcache.c
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 8582cf61242c..9e4f7378f30f 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -388,7 +388,7 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
spin_unlock(&tcon->tc_lock);
/*
- * BB Add call to invalidate_inodes(sb) for all superblocks mounted
+ * BB Add call to evict_inodes(sb) for all superblocks mounted
* to this tcon.
*/
}
diff --git a/fs/super.c b/fs/super.c
index 5a7db4a556e3..5b38d2d92252 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1417,7 +1417,7 @@ static void fs_bdev_mark_dead(struct block_device *bdev, bool surprise)
if (!surprise)
sync_filesystem(sb);
shrink_dcache_sb(sb);
- invalidate_inodes(sb);
+ evict_inodes(sb);
if (sb->s_op->shutdown)
sb->s_op->shutdown(sb);
diff --git a/security/landlock/fs.c b/security/landlock/fs.c
index 71b9dc331aae..582769ae830e 100644
--- a/security/landlock/fs.c
+++ b/security/landlock/fs.c
@@ -1216,7 +1216,7 @@ static void hook_inode_free_security_rcu(void *inode_security)
/*
* Release the inodes used in a security policy.
*
- * Cf. fsnotify_unmount_inodes() and invalidate_inodes()
+ * Cf. fsnotify_unmount_inodes() and evict_inodes()
*/
static void hook_sb_delete(struct super_block *const sb)
{
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] vfs: Remove invalidate_inodes()
2025-03-07 14:43 [PATCH] vfs: Remove invalidate_inodes() Jan Kara
@ 2025-03-07 20:01 ` Al Viro
2025-03-08 11:21 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Al Viro @ 2025-03-07 20:01 UTC (permalink / raw)
To: Jan Kara; +Cc: Christian Brauner, linux-fsdevel, Kent Overstreet
On Fri, Mar 07, 2025 at 03:43:19PM +0100, Jan Kara wrote:
> The function is exactly the same as evict_inodes() and has only one
> user.
<pedantic>
nearly the same - evict_inodes() skips the inodes with positive
refcount without touching ->i_lock, but they are equivalent (evict_inodes()
repeats the refcount check after having grabbed ->i_lock).
</pedantic>
ACK, except that it might make sense to add a note in D/f/porting.rst -
or just add #defined invalidate_inodes evict_inodes for this cycle
and remove it (with obvious note in D/f/porting.rst) in the next one.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vfs: Remove invalidate_inodes()
2025-03-07 14:43 [PATCH] vfs: Remove invalidate_inodes() Jan Kara
2025-03-07 20:01 ` Al Viro
@ 2025-03-08 11:21 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2025-03-08 11:21 UTC (permalink / raw)
To: Jan Kara; +Cc: Christian Brauner, linux-fsdevel, Al Viro, Kent Overstreet
On Fri, 07 Mar 2025 15:43:19 +0100, Jan Kara wrote:
> The function is exactly the same as evict_inodes() and has only one
> user.
>
>
I've changed commit message and added a new entry to
Documentation/filesystems/porting.rst.
---
Applied to the vfs-6.15.misc branch of the vfs/vfs.git tree.
Patches in the vfs-6.15.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.15.misc
[1/1] vfs: Remove invalidate_inodes()
https://git.kernel.org/vfs/vfs/c/93fd0d46cbf7
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-08 11:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 14:43 [PATCH] vfs: Remove invalidate_inodes() Jan Kara
2025-03-07 20:01 ` Al Viro
2025-03-08 11:21 ` Christian Brauner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.