Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2549865lqb; Tue, 28 May 2024 03:36:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwtiCpRtwe3l/p+DueUKOiqpcu9AnBdbDr5nKSYHxxS8YTprQUt9UeV4sbdpkcTtc4dNfoGNFfjSJq81Dj3YZUCJvaB4Cc5xIXRYAUAA== X-Google-Smtp-Source: AGHT+IFBlXn+YnNxztz+cXaATiYbIyL2owvejTNytVGLIg/wyqPyBnzAK7jsXZJ6I36aCOj+IUUo X-Received: by 2002:a05:620a:8116:b0:792:cd03:2fbe with SMTP id af79cd13be357-794aaf8fe26mr1125251485a.0.1716892578374; Tue, 28 May 2024 03:36:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716892578; cv=pass; d=google.com; s=arc-20160816; b=SlTDCBpOK46okFvLo6JuVkmfdfJW7KCCDSGCkSR+GN01GVuccOhkzWFUBWJXmwNU2d C5CnEi0gcvGsjBONjoySr6vH7G8YNC1BKb0E2CNfO3gjhJxwHN3UxKkI2KDecipaU8aR maA0CUip8gFDVZENA4yFjMTz6hUgr+fuwQ49ooS81g2USLIKMZjnDnZK9skGTYVnyRX1 BDMom3/+ehIG7EqXoNoCSnbmocZk9DzZ4NL6aFN4m+Qsl49pwHC3Pfq2rP4OQnUDlvfO EiUSoyIKRC7wzFE2Dmlf807rsTKiJQdT2cWM/LsPgwvCY+iIo2m7X3uTIoPvFS0DmOPx cKkA== ARC-Message-Signature: i=2; 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:dkim-signature:dkim-signature :dkim-signature; bh=qswTp52Q9fxeW+fWSCeNmwF/WH060c+KKNXM6cNFzgQ=; fh=aqNwIBGo4iGZLgHmpO86grjELCfCRwXoK+sew07I+U4=; b=HTiXqGb7Kiwz8mIwBtiJ2EAJfBvNw0gemRaJNeEvCBAGvC4reGSasRCh16XDv0qqGQ AeGd5lNKTKKCO1WXBulseUi7ZrtWe8u3eGO0zlcY8vsS7V4x6gUaqwSV5FfxHNm09fda 9ptXPci37gmehzZST7nxCnakcBk9RU8AE7CiIuJa9PlhUoPHfnZvnmRrYDLnrDlfMxDa icxJyrc+mbb3rXOvRyzSS9yzywzJA6qtU22lkSd818+yE7BnfW/7tWDUNScdD23HGmfw wvaQsxoYVFBgD0jbwf+9if++gfRww9a+TutzP2d/sCvsP2JoCeNdWq8ICmlhtzCj8jWG jqIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="N/gr3ipg"; dkim=neutral (no key) header.i=@suse.cz; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=gl8IA2xk; dkim=neutral (no key) header.i=@suse.cz header.b=qflg+ggn; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-192123-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192123-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abd15ee6si971481985a.354.2024.05.28.03.36.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 03:36:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192123-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="N/gr3ipg"; dkim=neutral (no key) header.i=@suse.cz; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=gl8IA2xk; dkim=neutral (no key) header.i=@suse.cz header.b=qflg+ggn; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-192123-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192123-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id EDE0E1C21D04 for ; Tue, 28 May 2024 10:36:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A463E16B73D; Tue, 28 May 2024 10:36:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="N/gr3ipg"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="0hdfF0cT"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="gl8IA2xk"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="qflg+ggn" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1DD416A39F; Tue, 28 May 2024 10:36:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716892566; cv=none; b=iKRlRmp2sErXcYnTbdW01pZNzppdTlGPmdehFjIVdKyhRjYhSPPsBBbtLrO6o/GXjajXMaqrTFyzF4yJOgthZFayB8s9QmGUVPHTSSBk0bzDZBOk8Ih164SYG9XGAuoiydHEFPbv9uzFn5TetD9jBl8/2Fz+iaaMTHTnXFQ7agQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716892566; c=relaxed/simple; bh=e4Tacb0g7ItBREbXUIbltXpa3GLPXxhz5nKnawPTpfs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pbA/TrkWEw7Qv2dDmg8W9M/BEDx9BP54CwxSltT3x1HGei+Ea8SBdn1rBNbfRWeFSuYFX9izRPkaKd2EBxeIkZsbTBBqPAFT3L4AKfNYSlKijoX4bsmhaTxjFqooHQpZ7aHarYlaSjDYgXsY3fXc0M/gpxLG0XC4dMPgflaon/Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=N/gr3ipg; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=0hdfF0cT; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=gl8IA2xk; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=qflg+ggn; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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-out1.suse.de (Postfix) with ESMTPS id F119122775; Tue, 28 May 2024 10:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1716892563; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qswTp52Q9fxeW+fWSCeNmwF/WH060c+KKNXM6cNFzgQ=; b=N/gr3ipgbrnaZzs9HUtmm2xDkyon6q2BFjjv/XgFokicH4j5+kL3pcFeNMBAMfFckBrlBG 4E5M4FnhIHImpzNESnx/84bpKGeor4BXWoYxQ8PhUXN1eiWGHGPuxdwnawugY71626uxBA 0s2KansAhoxlWmcg4ceRjpaFdhQmo8w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1716892563; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qswTp52Q9fxeW+fWSCeNmwF/WH060c+KKNXM6cNFzgQ=; b=0hdfF0cTtCgpqaAesTh59M+RThjdrpl3omy1XS9cKVYDLWntakEBccCvXh5A6Xw7wd6Rga Hft6mmAgmCVYN9BA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1716892562; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qswTp52Q9fxeW+fWSCeNmwF/WH060c+KKNXM6cNFzgQ=; b=gl8IA2xkjObeKSquUIUWPUyzj727NIeD9GtbFxw1/2JtvbHivE3PtfZXuU5qXb0rR6HRc1 DP+0KjLAWLwD6atHbUSqoHqLN47LAxNQndhsn8EbSxD3mQXd1pluQlqgB95HTfRsVNoVHV FzhozAJXUi2LVG3OKf7TzlwRBCkrGEI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1716892562; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qswTp52Q9fxeW+fWSCeNmwF/WH060c+KKNXM6cNFzgQ=; b=qflg+ggnXI/6lafeohjutN42qKYRv6X1AAe6F6Zj7I5MiUJfJnnRCDdv60SIyPt89D6UDz /xwcecfc9eUEyiAA== Received: from imap1.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E6D7813A6B; Tue, 28 May 2024 10:36:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id C71WOJKzVWbeLwAAD6G6ig (envelope-from ); Tue, 28 May 2024 10:36:02 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 9301FA07D0; Tue, 28 May 2024 12:36:02 +0200 (CEST) Date: Tue, 28 May 2024 12:36:02 +0200 From: Jan Kara To: Luis Henriques Cc: Jan Kara , Theodore Ts'o , Andreas Dilger , Harshad Shirwadkar , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] ext4: fix fast commit inode enqueueing during a full journal commit Message-ID: <20240528103602.akx2gui5ownj25l3@quack3> References: <20240523111618.17012-1-luis.henriques@linux.dev> <20240524162231.l5r4niz7awjgfju6@quack3> <87h6ej64jv.fsf@brahms.olymp> <87msob45o7.fsf@brahms.olymp> Precedence: bulk X-Mailing-List: linux-kernel@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: <87msob45o7.fsf@brahms.olymp> X-Spam-Flag: NO X-Spam-Score: -3.80 X-Spam-Level: X-Spamd-Result: default: False [-3.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCVD_COUNT_THREE(0.00)[3]; ARC_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; FREEMAIL_CC(0.00)[suse.cz,mit.edu,dilger.ca,gmail.com,vger.kernel.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email] On Mon 27-05-24 16:48:24, Luis Henriques wrote: > On Mon 27 May 2024 09:29:40 AM +01, Luis Henriques wrote; > >>> + /* > >>> + * Used to flag an inode as part of the next fast commit; will be > >>> + * reset during fast commit clean-up > >>> + */ > >>> + tid_t i_fc_next; > >>> + > >> > >> Do we really need new tid in the inode? I'd be kind of hoping we could use > >> EXT4_I(inode)->i_sync_tid for this - I can see we even already set it in > >> ext4_fc_track_template() and used for similar comparisons in fast commit > >> code. > > > > Ah, true. It looks like it could be used indeed. We'll still need a flag > > here, but a simple bool should be enough for that. > > After looking again at the code, I'm not 100% sure that this is actually > doable. For example, if I replace the above by > > bool i_fc_next; > > and set to to 'true' below: > > >>> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c > >>> index 87c009e0c59a..bfdf249f0783 100644 > >>> --- a/fs/ext4/fast_commit.c > >>> +++ b/fs/ext4/fast_commit.c > >>> @@ -402,6 +402,8 @@ static int ext4_fc_track_template( > >>> sbi->s_journal->j_flags & JBD2_FAST_COMMIT_ONGOING) ? > >>> &sbi->s_fc_q[FC_Q_STAGING] : > >>> &sbi->s_fc_q[FC_Q_MAIN]); > >>> + else > >>> + ei->i_fc_next = tid; > > ei->i_fc_next = true; > > Then, when we get to the ext4_fc_cleanup(), the value of iter->i_sync_tid > may have changed in the meantime from, e.g., ext4_do_update_inode() or > __ext4_iget(). This would cause the clean-up code to be bogus if it still > implements a the logic below, by comparing the tid with i_sync_tid. > (Although, to be honest, I couldn't see any visible effect in the quick > testing I've done.) Or am I missing something, and this is *exactly* the > behaviour you'd expect? Yes, this is the behavior I'd expect. The rationale is that if i_sync_tid points to the running transaction, it means the inode was modified in it, which means fastcommit needs to write it out. In fact the ext4_update_inode_fsync_trans() calls usually happen together with ext4_fc_track_...() calls. This could use some cleanup so that we don't set i_sync_tid in two places unnecessarily but that's for some other time... Honza -- Jan Kara SUSE Labs, CR