Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp154599rdh; Wed, 22 Nov 2023 23:09:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0qJQPdyRsvmB5QZBOYWq88rizb3mS2IDKqxsi7UolE1RdYhQGBfBFjhlME/eEMDcldetk X-Received: by 2002:a17:903:2612:b0:1cc:6101:2086 with SMTP id jd18-20020a170903261200b001cc61012086mr4157817plb.11.1700723377585; Wed, 22 Nov 2023 23:09:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700723377; cv=none; d=google.com; s=arc-20160816; b=vYYJO6NVInOxFthEc9tiEpyyspO6oNLoUsu5jZYqpIvFM7+xHkleCmqtSiokOEe9HT +ZMhTxllRrq1/P7FphQKKyb2a5X9p6c1ZLI48/ZsnTWacaeiyg0ZDWD286zdDahlPgWZ v7S8uflz0WJhLuZSAO/qbO2KwyrPEaPv/lZj/QWzoBeTyXkdwzh7nuVcLa/yRNjJBhpr g4HmoKnwbZ9LofnoqRmw/qYh+gdC13hC2uVFfLlo1TZzaC6YeiL+2hZMSiBEeJZTOkcQ V5a08WnybmemdcRtLHKGOR1LZqM6zhCNF8hr+to6ol2pt8Clfnb0GqOk5O+nvwSCLShc e8rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=gfCnOTMWBGaQ9EtuvEblhtZqjLaDKJa4eek8GzzpNew=; fh=d9xpOoJZPwk4xAFItxm4nT5oXBnmK9etmDf6hIf4S2Y=; b=1Co6a6qWah1OvLoOyZg+gabhRbkfWZBhGBq7Gw/DKGnk0QNbeKzlhllwIsqAsoKTm2 gMouwZzLIUxAN+oJ3wZ9KOMDCiYznjs/IwVQrp6S0amoRP/dD2SYm6nFxjIWBa0baax9 YX/Ko6Kh1kYrRctJCly59QnOEfluKTSEu6y9q2gUCuURnrG6XewrehF2kC3+7GHkwfX5 ZFkr3YRI2pVrNw69ofZUO8Ss55o9JAm5MZZ/St2DqjR/RbAhuRknzw0jF+aeNUtuUsJF 2SX5bBnfRSP1JjsDhE5pGkFlxPV1fwVAsnXDGXluCK6HSSkmK/STegyf+zPLhev/LjTu D7YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=SsqqBrXS; spf=pass (google.com: domain of linux-ext4+bounces-102-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-102-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t13-20020a1709027fcd00b001cf8c062611si126430plb.266.2023.11.22.23.09.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 23:09:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-102-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=SsqqBrXS; spf=pass (google.com: domain of linux-ext4+bounces-102-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-102-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2CB47B21056 for ; Thu, 23 Nov 2023 07:09:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4F2314A9E; Thu, 23 Nov 2023 07:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="SsqqBrXS" X-Original-To: linux-ext4@vger.kernel.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A95AA83; Wed, 22 Nov 2023 23:09:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=gfCnOTMWBGaQ9EtuvEblhtZqjLaDKJa4eek8GzzpNew=; b=SsqqBrXS2BCELuoQIKvB+FR60B UYdqZwGstD3l8GEeErtSiNDBLcKi7uYc5VgDm6GYMhrm8GbBdGQbjHofRwLPn1PXGYqxFrI/pPiyQ 29W+DFSray+cnn88j4IMTsVyz/FSdre2xoN8QN9qW5kr104euAhcfN0RTIi2kBEDsit44HWDdvKUO YAL6NJxfeayl69nbxN/fYc+y7YyFAk5udjjGz4J+881IeUI6YZfCKZkOL6dKHgbC6VHDg8MW+fUEv rNV0/olJ4yaSOwnWnGK5Frlx4OC0od4n4xZtDZ9+tlwjJnPjmfRfdwkB2MFIe3569dfr8crEpdaWF gSvtUMYQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1r63pt-003zAg-1p; Thu, 23 Nov 2023 07:09:17 +0000 Date: Wed, 22 Nov 2023 23:09:17 -0800 From: Christoph Hellwig To: "Darrick J. Wong" Cc: Dave Chinner , Christoph Hellwig , Jan Kara , "Ritesh Harjani (IBM)" , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [RFC 2/3] ext2: Convert ext2 regular file buffered I/O to use iomap Message-ID: References: <20231122122946.wg3jqvem6fkg3tgw@quack3> <20231123040944.GB36168@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231123040944.GB36168@frogsfrogsfrogs> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html On Wed, Nov 22, 2023 at 08:09:44PM -0800, Darrick J. Wong wrote: > The particular idea I had is to add a u64 counter to address_space that > we can bump in the same places where we bump xfs_inode_fork::if_seq > right now.. ->iomap_begin would sample this address_space::i_mappingseq > counter (with locks held), and now buffered writes and writeback can > check iomap::mappingseq == address_space::i_mappingseq to decide if it's > time to revalidate. So I think moving this to the VFS is probably a good idea, and I actually argued for that when the sequence checking was first proposed. We just have to be careful to be able to map things like the two separate data and cow seq counts in XFS (or anything else complicated in other file systems) to it. > Anyway, I'll have time to go play with that (and further purging of > function pointers) Do we have anything where the function pointer overhead is actually hurting us right now? One thing I'd like to move to is to merge the iomap_begin and iomap_end callbacks into one similar to willy's series from 2020. The big benefit of that would be that (together with switching write_cache_pages to an iterator model) that we could actually use this single iterator callback also for writeback instead of ->map_blocks, which doesn't really work with the current begin/end based iomap_iter as the folios actually written through write_cache_pages might not be contiguous. Using the same mapping callback would not only save some code duplication, but should also allow us to nicely implement Dave's old idea to not dirty pages for O_SYNC writes, but directly write them out. I did start prototyping that in the last days, and iomap_begin vs map_blocks is currently the biggest stumbling block.