From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=101.204.27.37 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796117161; b=KNZpW8FqGmfgEud6sMX1P0scwyPIoubbPQrDeflHjB1irq83Ylk6YNSb5fYIzk+OGBLx MeGwCd7LvgDDkK4FRB3s0mXVDjeW2IBl5z6GvxckUKQ5ZFuyv1iLThM9rcYCiZmWuLjta PUR0zdAIUYDV/iqDHcMYrBHRFrulLRslQKR6No07pIayqLS1OP8nYLPG44gS43Cv/hXcy V5e18l84sXIrD7t8S/VGG8sGiICS8rBwrxviNMWfxKgHvoQOrzHrjjDjpqUefyWkMHcxI JZpAwJNqM8qLjLxWIi7iUIySawrhvg8OX5k/zsfeQg6P3zMi6nnB37DI4TgBXy8o7pQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796117161; h=DMARC-Filter:Received:Received:Received:Received:Date:From:To:CC: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To: X-Originating-IP:X-ClientProxiedBy; bh=Fi1YxxT386PsNQ/YDK+Ig9PS1rDR2myNVykpN8XCgl4=; b=QnYH+OcVatHHotq97w+/MRlC7AKQiQT6YaIU3VuvFeR394lEcfZDWYAIthBgno0Nab79 hREuaac1Sl+XkUwOAwAXvJwwM33iCm6/xIxzAMIXxrfgHLvHCe61uY5+8WOjAn955IqJx y0Oza/vyP9IVFYo77Xwaiqa+2uqzw1tJ+3pQLEXJQfqzcWmEG+94D/1Kxk6B00p4XcALy u93R7Td46JefcE11Yn6V6LHlcNO01D2nE006/C/Z2LXVb91fOWx6cokdSBzQX1HHk9e4F 2Hf9IhP7rAbib1xEP6AZezt0kIaDEZBX5EfNtDoxpHXtsy6c/z9TfVDi6dG/38QIaIw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=hygon.cn; spf=pass smtp.mailfrom=hygon.cn; arc=none smtp.remote-ip=101.204.27.37 Received: from spam01.hygon.cn (unknown [101.204.27.37]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1848606A33F; Tue, 1 Dec 2026 09:25:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B1848606A33F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hygon.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hygon.cn Received: from maildlp1.hygon.cn (unknown [127.0.0.1]) by spam01.hygon.cn (Postfix) with ESMTP id 4jdwVP5cDfzVcBZ; Tue, 1 Dec 2026 17:25:49 +0800 (CST) Received: from maildlp1.hygon.cn (unknown [172.23.18.60]) by spam01.hygon.cn (Postfix) with ESMTP id 4jdwVM26XzzVhfS; Tue, 1 Dec 2026 17:25:47 +0800 (CST) Received: from cncheex04.Hygon.cn (unknown [172.23.18.114]) by maildlp1.hygon.cn (Postfix) with ESMTPS id 0F945DC01; Tue, 1 Dec 2026 17:25:42 +0800 (CST) Received: from hsj-2U-Workstation (172.19.24.226) by cncheex04.Hygon.cn (172.23.18.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.36; Tue, 1 Dec 2026 17:25:42 +0800 Date: Tue, 1 Dec 2026 17:25:40 +0800 From: Huang Shijie To: Christoph Hellwig CC: , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v5 02/10] vfs: add for_each_inode() Message-ID: References: <20261201064639.811114-1-huangsj@hygon.cn> <20261201064639.811114-3-huangsj@hygon.cn> X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: cncheex05.Hygon.cn (172.23.18.115) To cncheex04.Hygon.cn (172.23.18.114) 在 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. > >