Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4603073rwb; Tue, 8 Aug 2023 10:48:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXi87a2mBH8QA1WAbPSN4IZWdPiZDwZ0tN04cfwEt0tkhk9zv3a3lC89dr7lDpms0fPZUJ X-Received: by 2002:a05:6a20:1449:b0:140:8537:85bc with SMTP id a9-20020a056a20144900b00140853785bcmr235775pzi.41.1691516918400; Tue, 08 Aug 2023 10:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691516918; cv=none; d=google.com; s=arc-20160816; b=rhIdn8L6O3y6oi3SyBAwgzKCiBQpHIH6ZDOTO1VdMF5gkJxqewdpMrPa/K+zq86wdF IRQ6AEIlSuXcFXFCwg+PmncvRRz0ct5EZHm/HKCkDPeAcvPsS/E5bC6DyiFiKhgmlEPB 3e9WtTt2gYm2Qoo2motuYZYmNzqb3Z+Lr54BOBGRSWARv6/yDqQDbAvkW8W2wE1YlvWL lqdXmyahuaVhNQ9ZWMxM9fK+2rHDh3EgvPhpvhs+LfGRHDnpUDZlUlKTxWXRfAcm9GM3 JYRBcxWJksudMLi0EQsA7iM7ihMEXRebw7WjYIy5Qj2Ql0VS9/KfG8FDKbExxSBAyCby U2IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=PVeErVjOshT1HL9BKit56tV7zQvJsI4KiQWED3rMFuk=; fh=VDS1Ji1Jg94b8HYa+h+b069MTX7Y1JPYBeWAMaZH+VI=; b=Pq805J6poWu/LZE+ps5VdR4sPa+dYxwWCPEshylnbqJPfBn2sQ2n8YdBXWyFxIbYoX hiZL0Y1PtNkWYad64ywDoXuB659GTesrqcII59HNsXJ5S9M9L//5FIDNWSTML4yFyWLc Rkj6ZdpC81zLjADqAvh13NxocGNqWnBWwCAX5e2+LvulvWeGJAYOSP2O54Q9oqXFkuq6 Sc33c9x4Pvl8P7VW5u3xqRAoJ9sj4k2+rPXeAQ5YSyldv7nGGQBJaA2izfyVlhUVNx3I lMGdlepw0/TQdXBnS7CpyorbhI+YFmgR99Gjsk40W4DqtGC0KMofuPh6K4L9n71SCn7t NDhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="Ih/dtuDl"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k70-20020a638449000000b00564514df64bsi7492011pgd.897.2023.08.08.10.48.21; Tue, 08 Aug 2023 10:48:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="Ih/dtuDl"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233894AbjHHQ7d (ORCPT + 99 others); Tue, 8 Aug 2023 12:59:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232295AbjHHQ6L (ORCPT ); Tue, 8 Aug 2023 12:58:11 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE85D524C; Tue, 8 Aug 2023 08:42:55 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0F7CB21AAC; Tue, 8 Aug 2023 09:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1691487544; 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=PVeErVjOshT1HL9BKit56tV7zQvJsI4KiQWED3rMFuk=; b=Ih/dtuDlLjuehwLx/dl1alOHiAbINBHhQjqICxdO8QzvDNyayDD12QEIdQQqzzznj7Q14P c5hv8MUHhglxrWQtTaFcAIVopxDABjqy/dP+ec5Lv+rEt0nndTNahsaoLReC2CFkrCP+64 W8/atfzAfsnelhickcggtSiPj4yTuJM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1691487544; 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=PVeErVjOshT1HL9BKit56tV7zQvJsI4KiQWED3rMFuk=; b=j1Qrid+U1SfmOjtDLooGt12t1hCG9o0NAGXfAvVFTMysCO70VmrTAY263EbPzLWm1azsyz yYZCAZd1ftjgXqAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id ECC6813451; Tue, 8 Aug 2023 09:39:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Oj7GOTcN0mRIHgAAMHmgww (envelope-from ); Tue, 08 Aug 2023 09:39:03 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 732A5A0769; Tue, 8 Aug 2023 11:39:03 +0200 (CEST) Date: Tue, 8 Aug 2023 11:39:03 +0200 From: Jan Kara To: Jeff Layton Cc: Alexander Viro , Christian Brauner , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Chris Mason , Josef Bacik , David Sterba , Xiubo Li , Ilya Dryomov , Jan Harkes , coda@cs.cmu.edu, Tyler Hicks , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Namjae Jeon , Sungjong Seo , Jan Kara , Theodore Ts'o , Andreas Dilger , Jaegeuk Kim , OGAWA Hirofumi , Miklos Szeredi , Bob Peterson , Andreas Gruenbacher , Greg Kroah-Hartman , Tejun Heo , Trond Myklebust , Anna Schumaker , Konstantin Komarov , Mark Fasheh , Joel Becker , Joseph Qi , Mike Marshall , Martin Brandenburg , Luis Chamberlain , Kees Cook , Iurii Zaikin , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Sergey Senozhatsky , Richard Weinberger , Hans de Goede , Hugh Dickins , Andrew Morton , Amir Goldstein , "Darrick J. Wong" , Benjamin Coddington , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@coda.cs.cmu.edu, ecryptfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-mtd@lists.infradead.org, linux-mm@kvack.org, linux-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH v7 07/13] xfs: have xfs_vn_update_time gets its own timestamp Message-ID: <20230808093903.2cg5wwbwbvflkeph@quack3> References: <20230807-mgctime-v7-0-d1dec143a704@kernel.org> <20230807-mgctime-v7-7-d1dec143a704@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230807-mgctime-v7-7-d1dec143a704@kernel.org> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon 07-08-23 15:38:38, Jeff Layton wrote: > In later patches we're going to drop the "now" parameter from the > update_time operation. Prepare XFS for this by reworking how it fetches > timestamps and sets them in the inode. Ensure that we update the ctime > even if only S_MTIME is set. > > Signed-off-by: Jeff Layton > --- > fs/xfs/xfs_iops.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c > index 731f45391baa..72d18e7840f5 100644 > --- a/fs/xfs/xfs_iops.c > +++ b/fs/xfs/xfs_iops.c > @@ -1037,6 +1037,7 @@ xfs_vn_update_time( > int log_flags = XFS_ILOG_TIMESTAMP; > struct xfs_trans *tp; > int error; > + struct timespec64 now = current_time(inode); No need to fetch current_time() here where you overwrite it just a bit later... > @@ -1056,12 +1057,15 @@ xfs_vn_update_time( > return error; > > xfs_ilock(ip, XFS_ILOCK_EXCL); > - if (flags & S_CTIME) > - inode_set_ctime_to_ts(inode, *now); > + if (flags & (S_CTIME|S_MTIME)) > + now = inode_set_ctime_current(inode); > + else > + now = current_time(inode); > + > if (flags & S_MTIME) > - inode->i_mtime = *now; > + inode->i_mtime = now; > if (flags & S_ATIME) > - inode->i_atime = *now; > + inode->i_atime = now; > > xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); > xfs_trans_log_inode(tp, ip, log_flags); Otherwise the patch looks good to me so feel free to add: Reviewed-by: Jan Kara Honza -- Jan Kara SUSE Labs, CR