Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp199193rdb; Thu, 30 Nov 2023 02:19:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHG4SWI6nA2lj3MOmHFjfpFjvT4mLtDbTPPeW7OmrjLbhF7LlGyo26XBWiQi0znKH4rT9eM X-Received: by 2002:a05:6358:60c4:b0:16e:d70b:a1a5 with SMTP id i4-20020a05635860c400b0016ed70ba1a5mr3321172rwi.25.1701339557084; Thu, 30 Nov 2023 02:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701339557; cv=none; d=google.com; s=arc-20160816; b=AZ9ZD/IQSS9nz65wiLCygjRPSrSyoq8owWvMJV4H17F2CG8NzAP9iRZDi2dWB2qqG7 xwX93VhKp6a3qI07pTbewRm5xtQlsyG8Fm1iCr4wpSdfHcthV5CoKhbvWEz8zRSe29RP Kzy9bUO0CSHCB0Pc8pqITJH2hGNhyqTyYMK/gZPrcDI2ob068YCKOdEVe3+RM75CI/HE 1VJ13xwYGUkvFIjLSkr0AktUSs5LXgewee5+CV1sa3j8MJHA9qh5m9VhJUT69YtUmbfz VPiSIG6CNDdwSZ0dv9xT0vvf1hEZ0QBI9MTHmooftQL7yAg1Ot7CEKRxMV+IQqANauBB PEbg== 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; bh=JT5c1LgTP7NLCc0wvaKLNfM49bt6hg6RfOzbzddJ9Uo=; fh=V27LbAvSmQJYIXm5tSWviLTBmLElXzk2J/hfFga/8SY=; b=MnLW4HLwKZ8Ni1fTKj5Al/Bg916b85RUMhs0Gz1nyx8VdvlD3NbUocpkt5p/HqHF0L 2CIY8VmFkA9pAqL6Rr564j0J4Km1w56wGb1G98b+shw6IisWh3cjTCOx8n8HvkqA+2O7 OUmhpeQHBmmahTgIjgAXig7C6OTFVaGg1F/X9mVbWaRysJ+uaND3lRllSg85VQh73wU3 ojgcQIWgSog2OhvAxPkiCFW1Wz9anysuAYB+mnQskyuVDUAgLo0IKDFIWsj3IkDBT9Cu DwbBiBSyL4wOhjF+NF7iAUaGjO14TCTFiJlywxS0flhjG0bCRe+T8EADJseGW2hTKHLL 9tAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-235-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e5-20020a636905000000b005bf77518dc6si939810pgc.286.2023.11.30.02.19.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:19:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-235-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5C0672822B2 for ; Thu, 30 Nov 2023 10:19:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C40E3BB2B; Thu, 30 Nov 2023 10:18:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E122D10DB; Thu, 30 Nov 2023 02:18:47 -0800 (PST) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4447F1FCE9; Thu, 30 Nov 2023 10:18:46 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 336A113A5C; Thu, 30 Nov 2023 10:18:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id jbs+DIZhaGV6MgAAn2gu4w (envelope-from ); Thu, 30 Nov 2023 10:18:46 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id A5C17A07E3; Thu, 30 Nov 2023 11:18:45 +0100 (CET) Date: Thu, 30 Nov 2023 11:18:45 +0100 From: Jan Kara To: Ritesh Harjani Cc: Christoph Hellwig , Jan Kara , 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: <20231130101845.mt3hhwbbpnhroefg@quack3> References: <8734wnj53k.fsf@doe.com> <87ttp3hefd.fsf@doe.com> 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: <87ttp3hefd.fsf@doe.com> X-Spamd-Bar: +++++ Authentication-Results: smtp-out2.suse.de; dkim=none; dmarc=none; spf=softfail (smtp-out2.suse.de: 2a07:de40:b281:104:10:150:64:98 is neither permitted nor denied by domain of jack@suse.cz) smtp.mailfrom=jack@suse.cz X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [5.89 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:98:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(1.20)[suse.cz]; R_SPF_SOFTFAIL(4.60)[~all]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; MID_RHS_NOT_FQDN(0.50)[]; MX_GOOD(-0.01)[]; BAYES_HAM(-3.00)[100.00%]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,infradead.org:email]; FREEMAIL_TO(0.00)[gmail.com]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(2.20)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Score: 5.89 X-Rspamd-Queue-Id: 4447F1FCE9 On Thu 30-11-23 13:15:58, Ritesh Harjani wrote: > Ritesh Harjani (IBM) writes: > > > Ritesh Harjani (IBM) writes: > > > >> Christoph Hellwig writes: > >> > >>> On Wed, Nov 22, 2023 at 01:29:46PM +0100, Jan Kara wrote: > >>>> writeback bit set. XFS plays the revalidation sequence counter games > >>>> because of this so we'd have to do something similar for ext2. Not that I'd > >>>> care as much about ext2 writeback performance but it should not be that > >>>> hard and we'll definitely need some similar solution for ext4 anyway. Can > >>>> you give that a try (as a followup "performance improvement" patch). > > ok. So I am re-thinknig over this on why will a filesystem like ext2 > would require sequence counter check. We don't have collapse range > or COW sort of operations, it is only the truncate which can race, > but that should be taken care by folio_lock. And even if the partial > truncate happens on a folio, since the logical to physical block mapping > never changes, it should not matter if the writeback wrote data to a > cached entry, right? Yes, so this is what I think I've already mentioned. As long as we map just the block at the current offset (or a block under currently locked folio), we are fine and we don't need any kind of sequence counter. But as soon as we start caching any kind of mapping in iomap_writepage_ctx we need a way to protect from races with truncate. So something like the sequence counter. Honza -- Jan Kara SUSE Labs, CR