[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <pzstmkemz36aecf7ckphbcz3ph55cn6si3ca2nm6sku444365m@pntnbgblgxuf>
Date: Thu, 30 Oct 2025 14:54:35 +0100
From: Jan Kara <jack@...e.cz>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: brauner@...nel.org, viro@...iv.linux.org.uk, jack@...e.cz,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] fs: push list presence check into
inode_io_list_del()
On Wed 29-10-25 14:14:27, Mateusz Guzik wrote:
> For consistency with sb routines.
>
> Signed-off-by: Mateusz Guzik <mjguzik@...il.com>
Not sure if you've noticed but inode_io_list_del() is also called from
ext4_evict_inode() (for annoying reasons but that's besides this thread).
So there you have another list_empty() check to deduplicate. Plus ext4
actually uses list_empty_careful() for the unlocked check which kind of
makes sense because in theory these checks could race with someone removing
the inode from writeback lists.
Honza
> ---
>
> rebased
>
> fs/fs-writeback.c | 3 +++
> fs/inode.c | 4 +---
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index f784d8b09b04..5dccbe5fb09d 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -1349,6 +1349,9 @@ void inode_io_list_del(struct inode *inode)
> {
> struct bdi_writeback *wb;
>
> + if (list_empty(&inode->i_io_list))
> + return;
> +
> wb = inode_to_wb_and_lock_list(inode);
> spin_lock(&inode->i_lock);
>
> diff --git a/fs/inode.c b/fs/inode.c
> index 1396f79b2551..b5c2efebaa18 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -815,9 +815,7 @@ static void evict(struct inode *inode)
> BUG_ON(!(inode_state_read_once(inode) & I_FREEING));
> BUG_ON(!list_empty(&inode->i_lru));
>
> - if (!list_empty(&inode->i_io_list))
> - inode_io_list_del(inode);
> -
> + inode_io_list_del(inode);
> inode_sb_list_del(inode);
>
> spin_lock(&inode->i_lock);
> --
> 2.34.1
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists