All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Shijie <huangsj@hygon.cn>
To: Christoph Hellwig <hch@infradead.org>
Cc: <viro@zeniv.linux.org.uk>, <brauner@kernel.org>, <jack@suse.cz>,
	<agruenba@redhat.com>, <axboe@kernel.dk>, <gnoack@google.com>,
	<paul@paul-moore.com>, <jmorris@namei.org>, <serge@hallyn.com>,
	<legion@kernel.org>, <aleksa@amutable.com>,
	<libaokun@linux.alibaba.com>, <ebiggers@kernel.org>,
	<djwong@kernel.org>, <sandeen@redhat.com>, <zhongyuan@hygon.cn>,
	<fangbaoshun@hygon.cn>, <yingzhiwei@hygon.cn>,
	<wujianyong@hygon.cn>, <shijie8@gmail.com>, <wangfengyu@hygon.cn>,
	<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-block@vger.kernel.org>, <gfs2@lists.linux.dev>
Subject: Re: [PATCH v5 02/10] vfs: add for_each_inode()
Date: Tue, 1 Dec 2026 17:25:40 +0800	[thread overview]
Message-ID: <aw6SlPikZMznuJ6O@hsj-2U-Workstation> (raw)
In-Reply-To: <aw6GYtXXhsLm3Eox@infradead.org>

在 Tue, Dec 01, 2026 at 12:33:38AM -0800,Christoph Hellwig 写道:
> On Tue, Dec 01, 2026 at 02:46:31PM +0800, Huang Shijie wrote:
> > Walking sb->s_inodes requires taking s_inode_list_lock, grabbing a
> > reference on the next inode, dropping the lock and then working on the
> > inode.  That sequence is open coded in several places, each with its own
> > subtleties around the inode state checks and the reference count.
> > 
> > Add a caller-owned cursor wrapped in a cleanup class, so that the
> > iterator goes out of scope as soon as the loop ends:
> > 
> > 	for_each_inode(inode, sb) {
> > 		/* inode is referenced and unlocked here */
> > 	}
> 
> I know you've gotten contrary feedback, but all this CLASS and macro
It seems I did the work in the wrong direction..

> magic is a complete nightmare.  Compared to a simple interface like
> writeback_iter() this adds tons of gluecode that makes the code really
The v4 code is like the writeback_iter():
   v4: https://lore.kernel.org/all/20261125091157.1822521-1-huangsj@hygon.cn/

Could you please comment on the V4 code?

Thanks
Huang Shijie


> hard to understand, even more so when in backtraces after a crash.
> 
> All for the tiny "benefit" of allowing a break or goto out of the loop,
> which isn't even needed in the usual patterns.
> 
> 


  reply	other threads:[~2026-12-01  9:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  6:46 [PATCH v5 00/10] vfs: add for_each_inode() Huang Shijie
2026-12-01  6:46 ` [PATCH v5 01/10] jffs2: rename the local for_each_inode() macro Huang Shijie
2026-12-01  6:46 ` [PATCH v5 02/10] vfs: add for_each_inode() Huang Shijie
2026-12-01  8:33   ` Christoph Hellwig
2026-12-01  9:25     ` Huang Shijie [this message]
2026-12-01 11:36     ` Andreas Gruenbacher
2026-12-01  6:46 ` [PATCH v5 03/10] vfs: add for_each_inode_locked() Huang Shijie
2026-12-01  8:34   ` Christoph Hellwig
2026-12-01  6:46 ` [PATCH v5 04/10] block: convert nr_blockdev_pages() to for_each_inode_locked() Huang Shijie
2026-12-01  6:46 ` [PATCH v5 05/10] fs/quota: convert remove_dquot_ref() " Huang Shijie
2026-12-01  6:46 ` [PATCH v5 06/10] fs: convert generic_shutdown_super() poison loop Huang Shijie
2026-12-01  6:46 ` [PATCH v5 07/10] block: convert sync_bdevs() to for_each_inode() Huang Shijie
2026-12-01  6:46 ` [PATCH v5 08/10] fs/drop_caches: convert drop_pagecache_sb() " Huang Shijie
2026-12-01  6:46 ` [PATCH v5 09/10] fs/quota: convert add_dquot_ref() " Huang Shijie
2026-12-01  6:46 ` [PATCH v5 10/10] gfs2: convert gfs2_evict_inodes() " Huang Shijie

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=aw6SlPikZMznuJ6O@hsj-2U-Workstation \
    --to=huangsj@hygon.cn \
    --cc=agruenba@redhat.com \
    --cc=aleksa@amutable.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=fangbaoshun@hygon.cn \
    --cc=gfs2@lists.linux.dev \
    --cc=gnoack@google.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=jmorris@namei.org \
    --cc=legion@kernel.org \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=sandeen@redhat.com \
    --cc=serge@hallyn.com \
    --cc=shijie8@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wangfengyu@hygon.cn \
    --cc=wujianyong@hygon.cn \
    --cc=yingzhiwei@hygon.cn \
    --cc=zhongyuan@hygon.cn \
    /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 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.