From: Matthew Wilcox <willy@infradead.org>
To: Jan Kara <jack@suse.cz>
Cc: Christian Brauner <brauner@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] vfs: Remove unnecessary list_for_each_entry_safe() from evict_inodes()
Date: Wed, 9 Jul 2025 14:14:16 +0100 [thread overview]
Message-ID: <aG5rKNILXdJM2Duo@casper.infradead.org> (raw)
In-Reply-To: <20250709090635.26319-2-jack@suse.cz>
On Wed, Jul 09, 2025 at 11:06:36AM +0200, Jan Kara wrote:
> evict_inodes() uses list_for_each_entry_safe() to iterate sb->s_inodes
> list. However, since we use i_lru list entry for our local temporary
> list of inodes to destroy, the inode is guaranteed to stay in
> sb->s_inodes list while we hold sb->s_inode_list_lock. So there is no
> real need for safe iteration variant and we can use
> list_for_each_entry() just fine.
Yes, agreed, this is safe. I thought it wasn't, because (a) we call
inode_lru_list_del(), but that's a different list (i_lru, not i_sb_list)
and (b) we call dispose() which calls evict(), but if we do that, we
restart the list walk.
> Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
next prev parent reply other threads:[~2025-07-09 13:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-09 9:06 [PATCH] vfs: Remove unnecessary list_for_each_entry_safe() from evict_inodes() Jan Kara
2025-07-09 13:14 ` Matthew Wilcox [this message]
2025-07-10 7:38 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aG5rKNILXdJM2Duo@casper.infradead.org \
--to=willy@infradead.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).