mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Zhou, Yun" <yun.zhou@windriver.com>
To: Jan Kara <jack@suse.cz>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	libaokun@linux.alibaba.com, ojaswin@linux.ibm.com,
	ritesh.list@gmail.com, yi.zhang@huawei.com,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 3/4] ext4: introduce ext4_put_ea_inode() for safe deferred iput
Date: Mon, 22 Jun 2026 18:06:23 +0800	[thread overview]
Message-ID: <f9c2c9a3-c68d-4c1c-b399-656068ef472e@windriver.com> (raw)
In-Reply-To: <jxcbsd2ot63wy3dcoximemkuitwoqn2a7jgxcsfdwaf5q3ecdu@sahahqqopo6y>

Hi Honza,

On 6/18/26 02:42, Jan Kara wrote:
> 
> Allocating ext4_ea_iput_entry for dropping each inode is somewhat wasteful.
> I want to suggest another scheme (somewhat more involved but more efficient
> scheme):
> 
> 1) Create a VFS helper bool iput_if_not_last(struct inode *inode) which
> drops inode reference if it is not the last one (and returns true in that
> case). Basically:
> 
> bool iput_if_not_last(struct inode *inode)
> {
>          return atomic_add_unless(&inode->i_count, -1, 1);
> }
> 
> This needs to be a separate patch as it should get vetting from VFS
> maintainers.
After taking a closer look, it seems that this function doesn't need to 
be added to the VFS layer — at least not for now. For example, we could 
directly inline atomic_add_unless() into ext4_put_ea_inode():

void ext4_put_ea_inode(struct super_block *sb, struct inode *inode)
{
     if (!inode)
         return;
     if (atomic_add_unless(&inode->i_count, -1, 1))
         return;
     llist_add(&EXT4_I(inode)->i_ea_iput_node,
         &EXT4_SB(sb)->s_ea_inode_to_free);
     schedule_delayed_work(&EXT4_SB(sb)->s_ea_inode_work, 1);
}

This way, we avoid submitting an isolated patch to the VFS layer that 
currently has only one user (ext4). If there is indeed a real need for 
it in the future, we can always submit a follow-up patch to refactor it.

What do you think?

BR,
Yun

  parent reply	other threads:[~2026-06-22 10:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 15:15 [PATCH v7 0/4] ext4: fix xattr iput deadlock with s_writepages_rwsem Yun Zhou
2026-06-16 15:15 ` [PATCH v7 1/4] ext4: skip extra isize expansion during mount to prevent deadlock Yun Zhou
2026-06-16 15:15 ` [PATCH v7 2/4] ext4: set EXT4_STATE_NO_EXPAND in ext4_evict_inode Yun Zhou
2026-06-16 15:15 ` [PATCH v7 3/4] ext4: introduce ext4_put_ea_inode() for safe deferred iput Yun Zhou
2026-06-17  8:38   ` Zhou, Yun
2026-06-17 18:42   ` Jan Kara
2026-06-19  6:24     ` Zhou, Yun
2026-06-22  8:32       ` Jan Kara
2026-06-22  8:47         ` Zhou, Yun
2026-06-22 10:06     ` Zhou, Yun [this message]
2026-06-22 10:44       ` Jan Kara
2026-06-16 15:15 ` [PATCH v7 4/4] ext4: convert remaining EA inode iput() calls to ext4_put_ea_inode() Yun Zhou
2026-06-17 18:13 ` [PATCH v7 0/4] ext4: fix xattr iput deadlock with s_writepages_rwsem Jan Kara
2026-06-18  0:24   ` Zhou, Yun

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=f9c2c9a3-c68d-4c1c-b399-656068ef472e@windriver.com \
    --to=yun.zhou@windriver.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    /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

all inboxes | Powered by JetHome®