From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C566FC001DF for ; Tue, 8 Aug 2023 09:39:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 586DA6B0071; Tue, 8 Aug 2023 05:39:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50FD26B0078; Tue, 8 Aug 2023 05:39:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B1008D0001; Tue, 8 Aug 2023 05:39:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 280456B0071 for ; Tue, 8 Aug 2023 05:39:08 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E2F8B1A0C3E for ; Tue, 8 Aug 2023 09:39:07 +0000 (UTC) X-FDA: 81100438734.29.6B259A9 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf30.hostedemail.com (Postfix) with ESMTP id E145B80010 for ; Tue, 8 Aug 2023 09:39:05 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="Ih/dtuDl"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=j1Qrid+U; spf=pass (imf30.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691487546; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PVeErVjOshT1HL9BKit56tV7zQvJsI4KiQWED3rMFuk=; b=wkCsVH0xOq+w44zx1jIrGr0qD7svoOjPkJ6LnoTSNNQQjTmeKfSi6hkIrGWh6Hgt4ViIdd P/lZTZZJbljo/X7WJaogW674/2minIb5G2+DM1JLVEzzAlFuMNqA8VRLxVWnEG3wzE1I4A yhLcVCUCUIpyt23dbgqNHJwihyYSZIU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691487546; a=rsa-sha256; cv=none; b=V2N3oJhBHmCw/cMPU38P4tgS4NlJ50O+3XT/A6isVaTGJZOXNL+U+PYwmGywkj+8PGMajp feifaVkoKEwBcmvyFHiR4ah/Ox57vis+4LigyZlQFIPIIhcyqc3c3ZoUozTpuxhwiuaiMh H03Jr0047MvkxnmtUyBlPXdwCg3/q0w= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="Ih/dtuDl"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=j1Qrid+U; spf=pass (imf30.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none 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-out2.suse.de (Postfix) with ESMTPS id 186E41F88D; 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 01B42139E9; Tue, 8 Aug 2023 09:39:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id u1hdADgN0mRKHgAAMHmgww (envelope-from ); Tue, 08 Aug 2023 09:39:04 +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-Stat-Signature: p66wrdy8mywda17gox9dcsxs4y6w1eij X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: E145B80010 X-Rspam-User: X-HE-Tag: 1691487545-662232 X-HE-Meta: U2FsdGVkX187/Hv+Jth3KPSulf2vcWAySUc+5lWdnI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4cxm/g2GwXcEVvuT+fMtF3eoiYlUq3POL6uC4hbbGcuUH7sQjW1oSFcUcrHgbgeu0Np1Jh2HEquC51RNi3Z3xHwU0GkdZ+4epTEaZUnOBkHNe30j+hxrnVJYFufA33KooL8q6vW1Pi7apcum2WG42hwlhs9KmJl22pQ2skcOVim9bJdJ0WHWySj08lj+ndIn1WD3+fyZGdYrOnv/LVLwFTIGV4iur98VrIlZfgDcbCiUM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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