From patchwork Wed Jul 5 19:00:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13302757 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 DD4AEC001B0 for ; Wed, 5 Jul 2023 19:03:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6466C8D0002; Wed, 5 Jul 2023 15:03:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CFE18D0001; Wed, 5 Jul 2023 15:03:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 470CC8D0002; Wed, 5 Jul 2023 15:03:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 31FDC8D0001 for ; Wed, 5 Jul 2023 15:03:27 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 057511A0BAA for ; Wed, 5 Jul 2023 19:03:27 +0000 (UTC) X-FDA: 80978481654.15.1334130 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id 35FAE80019 for ; Wed, 5 Jul 2023 19:03:24 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NJB7XRGZ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688583805; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xKAUX1gAiGeMAe4hDD9pQTq1NUzFHWrVLxy+KkYN7Hk=; b=FwP6IsyIdIniEBdk6alXxbuidVmlPcp6GdhPrKEksEJHwgyGmcoRVLwH6Y51dbfVNEm19n w69FCJLT1DBPhXg//ehsEFwTXtCv+rNduKVxuDtCVH+JAD+4I2ddYwglagN0dJpayqtBVP DyVdPKOSUAn3szi7k+V0X3unAHI9kMs= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NJB7XRGZ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688583805; a=rsa-sha256; cv=none; b=RnsRQbZL+ObIa021TWfrdg68LRMgC8e5alX0wBnsn21laDUxZtetXBCRHFU00e5xeUqwC6 U0+Qa7MoUKt2YtUUojwzi3b/he+CUXwD9PAo9giDa6gw/RlWSPAH/w7XerFxiGnP+I1JB+ 8rXcdix87qVC2EdL2N37ZXvMI2wvkeU= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B99E616D1; Wed, 5 Jul 2023 19:03:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03D32C433C8; Wed, 5 Jul 2023 19:03:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688583803; bh=L6EzW1gN0+SRZxIErz0sW6Tb73or6lNTvn+UvQ+UhLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJB7XRGZ9/2aNYHQfjzBlRCDmmvV+Ti6HLP+oIQ9g5KZrdjQjm0y+Jhl8rdVoiCqG yNAQ8W/mgqYsGvz9nBNxe8BJ21A3QMuv0zJQYxL9guo6asboijEkgDeRQSrBfSig/p y3um6RHGyvKy2DmOpaWHlvqNe+TYIVNtPu4I/5h85aojGvgO6+zM0Ewv62AZ5sItYJ BGFhUukmOesc8UyqgAF96u85MDN4IqtfnbWGFTIJ63/U+8my5inkcImSFEKNDrDBdG voaAhfGJLsCJB7IlrDCNOmZcmkHZs+5FZ8A/Dag+FPXM+vt3V1xLIcdts0ws7Ae+oa roSY/5/VnBDgw== From: Jeff Layton To: Christian Brauner , Hugh Dickins , Andrew Morton Cc: Al Viro , Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 11/92] shmem: convert to simple_rename_timestamp Date: Wed, 5 Jul 2023 15:00:36 -0400 Message-ID: <20230705190309.579783-9-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230705190309.579783-1-jlayton@kernel.org> References: <20230705185755.579053-1-jlayton@kernel.org> <20230705190309.579783-1-jlayton@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 35FAE80019 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 3rz1xfx7kgs1dj9igyf4acwi8pckfm8x X-HE-Tag: 1688583804-657362 X-HE-Meta: U2FsdGVkX18IxhUPddy9YXdBuuQh+tGwogbjbug+WDTCyawZGhWFN8IxLbyUW5VavY5Kolk6FvPXk733CIxCfwN/6uhD6rLSR2ppIi1d8t03MyBkU0irB4khVJKkremHqy8FJxMl8X0UcMIKlyecVlzV/XfSOlLLIEKbXC3vMzmJcuORqkqX48+hq1mDl/Z4J2I9blEcxhGY43vFpOdeHUezOLv3MOSDnuO9KvFfrdV1O06hMzXH+AXsZiP3DO4lmpSbC9xrYDps2gqzO4eWraT7au0ZuIlva+OhDLK67ysAReCmZ9sMxnDnH1szWf5WpZEKUPDrHNdblGJoMmgm2B1K25bXJC8gWn2rzyNXFJHgVs4f43vfRpSdoinFuN0VEtMSac21tRd1VRL6mWegDGg4PlTIeSL3JU/EKMVialpBCV2Tn4OwQE+vMX7cj6WtTGLReiBdlFGAiER33rbhpDr5TRTqlYIFYyD17VxeV3LNZaMfQy4Ea99mFVOSATGEt06IAq+61YF1YApZgNyEMob6ME+oU5U6aZBeVOnkaiUNrCGTfkXRKOtGSWIU4D0RFKj+1VnjDqDO2L76mJFivj4XVLORwFOVN4crSpVhOVqjKChhYxmDED1srE4sdQHDOtp55RcH7UGK0YdDpb1exUhqoeqr8xA3IO37PZdSiRw6BeVSO/6Hj7L81rnR/YHbiLt1GunAYxUHjPu9w/K1jfSR35jvQ37px4OzuWfoIbvPN4v83LkqAK9KdwqX37v/DlaibKnz/BqDUt64SkcIRBKWceYAWzP5ZNdshUqewRNzadgcyWuRyYp1Zp8ddgClMhaSxdPjXxm405e5+e71j1zrD7lfydXucaRsRk8zT1KdMUDvhr6egVLFaZB2Quz1LDHF29RbwzKTHfuU1EliqxVQqNcMlSvKsLYz2WMCYRzyvt+Yc9be2seVnjTxlTFrWI+on6b3XsJzrz1gJ/l ir71a/wo /OSilejwR4vEjHMKznAtHZAUlZZUsjzR2/5Q66kvr9AWkglUVwEtmZLzA7DbrHzx7LrAGr72obKwxVvHR6mPTcQVhO4kya56nbfj42uu7EvilD/WQwQAW4DPKDvMXSAaARg21oAgeG9s0PMopxUkAg6x1OmdmMOreXLpGlACS6SfkYAAp8AU1nrRQwIT6OM/L9ZcrsKAasgIX6OyhanfpOmREWXlIxXlvYKKcCiKARkzjRik50s18y5MU59VBlKXuRjAWGdYklgRnHfwK+icrC0jK6saoAYWPoc4zGSuBMwTJe0RwJ4SZJaVKK7ShKOUvomUCLs9RoUNDZRnclITs6ppOZzfTwimzmI0grVUNxvNrS9cOT3BiQaOCuRRpzMO30rCz 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: A rename potentially involves updating 4 different inode timestamps. Convert to the new simple_rename_timestamp helper function. Signed-off-by: Jeff Layton Reviewed-by: Jan Kara --- mm/shmem.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 0f45e72a5ca7..1693134959c5 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3306,9 +3306,7 @@ static int shmem_rename2(struct mnt_idmap *idmap, old_dir->i_size -= BOGO_DIRENT_SIZE; new_dir->i_size += BOGO_DIRENT_SIZE; - old_dir->i_ctime = old_dir->i_mtime = - new_dir->i_ctime = new_dir->i_mtime = - inode->i_ctime = current_time(old_dir); + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); inode_inc_iversion(old_dir); inode_inc_iversion(new_dir); return 0; From patchwork Wed Jul 5 19:00:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13302758 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 D77AEEB64DD for ; Wed, 5 Jul 2023 19:03:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 731578D0006; Wed, 5 Jul 2023 15:03:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BA648D0001; Wed, 5 Jul 2023 15:03:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 534B38D0006; Wed, 5 Jul 2023 15:03:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 43B1D8D0001 for ; Wed, 5 Jul 2023 15:03:51 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 08922AFF4F for ; Wed, 5 Jul 2023 19:03:51 +0000 (UTC) X-FDA: 80978482662.07.D737E93 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id B4C73100028 for ; Wed, 5 Jul 2023 19:03:48 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="Djy35r/J"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688583828; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=W1LJ1Ev958+v2cYpgmJ52/5bNelskmJS3SGOJ4WTHtA=; b=SfImQRW16hDB5qT9Mggx26AAaRh5bKIqvtgWbWFlWujZnTOtHep0SuiT8s79wJQtUHxwKW hAf/64/M2FKjsYTzLTxFflFhCxzsC0HUm7JruAC06RBX4ytJXkbP1ntKY2Mtw1fFWn5D6B HZdEol+LR8v2B2fOUYzDwx3GRRMPJwY= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="Djy35r/J"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688583828; a=rsa-sha256; cv=none; b=F4+wPeKXNBmh3OXpKkXdDBhDZHlq49qpDmOeBHo+e+0zX/glbm/SAFPg3R5lrH45UvC7Dm SVzo7LPRlCigy0YHwyUJd/yUrmSw8o3hawfdSbLVqKECVrUtViWgGs032dkXGl/QPHg9DX WeTucL3DZ4faI95oelHdK00Kq59MmMU= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DEC99616FB; Wed, 5 Jul 2023 19:03:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C394C433C8; Wed, 5 Jul 2023 19:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688583827; bh=7amT9DrYu70ALB4f/8ioI9ChjNtEorP9RC8mHDJNfS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Djy35r/JI60Pfe0ZiI+Z9tvfNL61rTokHFk5MxL+luQelNZiTKVK6XlUnKTqVOt7h 10wc/pvErEgXyHf2RIUkXE4zE0UH3TK539DVcK0STS8UwkLmUkQlS66S3CcESJUIjC AC8Hr7c/iVK6xSwF3K4jPkjuBHYKz6BBOczAdB0F23f+G6uCV10RTaUgr2OaFK+Esr snFQPsZmnj2p9zcyrG0UVBJOmgvGgCgXp07gJ6a38nxOzeW5Fo4L/+ar/BjgcCow6L wwYrrso5LR4MSzSjySjM4N3yXTZyJ2qAk7DRfIiMn2vE3HwCBbk1wo4IFo95+y6M58 6XAVG3Zw534ow== From: Jeff Layton To: Christian Brauner , Alexander Viro , Eric Biederman , Kees Cook Cc: Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 25/92] fs: convert to ctime accessor functions Date: Wed, 5 Jul 2023 15:00:50 -0400 Message-ID: <20230705190309.579783-23-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230705190309.579783-1-jlayton@kernel.org> References: <20230705185755.579053-1-jlayton@kernel.org> <20230705190309.579783-1-jlayton@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: B4C73100028 X-Stat-Signature: 7145dotcu75s4z7ctteob9fyfmzp4p9g X-HE-Tag: 1688583828-497941 X-HE-Meta: U2FsdGVkX1/Req4o/PL6S/jL13R87JwbLuPduo4zM+/GYD8KvWGud85nScrNn8ZUYlHtzqCd6M62IwG9CEnb7YcxneDxMoVsLFn/KZT5WydRU9ZeTTd4fzf6J6kiZwxFjZVScWZHTIFp0VMNJVmGjd7oIXWVZzEuyK3Dqx+axIIHtRsKRQTN6yrsRfCCwmETXSyw4JZm5XVhBIJd8f9s1R531t2ZkkwJS8yBfb/lK77xMFpSqBWgHsxbcPBg3WbO5nShWV5m0zzTezwrU/NYHK72AcaBEuzkhnItcDFH4XdNmQbN9YX4qvNYFbj+pUuPZ5tu3t0xTEr91SN/C+C7l19AGp9VV/7G2t7xY1eh7BWF8J3W7mFWmsg2aHhN7hXjgbwHbxZOlGuQy9oiWBfNzbcYS1TeGN/pe/qjNe8CJ0hMad2MOnZM1kFFBBaNiQcNxn84tHzHFylAStp5MhhEG3RYmRsH7yUjN85Kj4c8L4gHZubh0y8DMxlthVuRt5s8OKu6buiRbt5NAPIZ1MvO9uEFkUPx3gLaAeUR5O8GugFN/c34RWbyjgAc1XvAPgQpWdb8+PXLmchVHYHljdm8POLsJTRdip9rNHXH+VKj9PL/rHbC0ejA3N6nk/G6U1LSnTmLFRctI4b35gofcc9CZDaET9IRieRuomeDcpzVpjHTch+z9/vsGljzPSKA/VYws/bzppSyNZfit+xEm9EZ7OaM/0cmYU1GW/GzU63TqJ9go1uu3IHv1aMHFQSll735X/PmAl7O3mg4RSX/DYl5IZMBj3Yq3dV49PzzcVVI4cYqPCs7a0V2Z64fbAmMZtpN0/iLHNR1eritwnkfRGrBXQAm/1rOeGvvvD/Wd0gXrndrM7lW9GA2waddbIuLiKvHq7ENTI5pC1NRAY2qIMiq3va5Wlglxne8v11CdkjFaV2FCk0LiVAVqt9RdyA2GNcs/79Ewl4uKGDS7WcC2db ju6Z95AD L+sY4m+Pk6Pa1egtIq7hcPAvOsDouclY/iCuKo7lNPpH0n4j+p+QUUc7VLeELsHKal1KEQW5LjMSlHRbpCPHtobm/N+Do5TF4Dbw2WHERDHleM0+AUgEJS/EkJ5anDQYkDec0QggYFIX4z+2eVNPfSBwkhvUC3Vsns1S3lavZmXdmA8nI10CjWdtBJAjAVTRXknLVojM7iXnPzyOnQx+7L/quxkG5PnHIe5Hri9+h23hwD88DGnbUFUcW7A32LtsCyYft2/pbrWV8qBer2pc2QC8cM9eyvPVksrLdCkkceQoLNqccqigBZyE09InkmkuXn8bEx5fIe4yu3/69DZ5Tp1RvCQ== 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: In later patches, we're going to change how the inode's ctime field is used. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Reviewed-by: Jan Kara Signed-off-by: Jeff Layton --- fs/attr.c | 2 +- fs/bad_inode.c | 3 +-- fs/binfmt_misc.c | 3 +-- fs/inode.c | 10 +++++++--- fs/nsfs.c | 2 +- fs/pipe.c | 2 +- fs/posix_acl.c | 2 +- fs/stack.c | 2 +- fs/stat.c | 2 +- 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/fs/attr.c b/fs/attr.c index d60dc1edb526..599f6d14c0ed 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -312,7 +312,7 @@ void setattr_copy(struct mnt_idmap *idmap, struct inode *inode, if (ia_valid & ATTR_MTIME) inode->i_mtime = attr->ia_mtime; if (ia_valid & ATTR_CTIME) - inode->i_ctime = attr->ia_ctime; + inode_set_ctime_to_ts(inode, attr->ia_ctime); if (ia_valid & ATTR_MODE) { umode_t mode = attr->ia_mode; if (!in_group_or_capable(idmap, inode, diff --git a/fs/bad_inode.c b/fs/bad_inode.c index db649487d58c..6e21f7412a85 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c @@ -209,8 +209,7 @@ void make_bad_inode(struct inode *inode) remove_inode_hash(inode); inode->i_mode = S_IFREG; - inode->i_atime = inode->i_mtime = inode->i_ctime = - current_time(inode); + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); inode->i_op = &bad_inode_ops; inode->i_opflags &= ~IOP_XATTR; inode->i_fop = &bad_file_ops; diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index bb202ad369d5..e0108d17b085 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -547,8 +547,7 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode) if (inode) { inode->i_ino = get_next_ino(); inode->i_mode = mode; - inode->i_atime = inode->i_mtime = inode->i_ctime = - current_time(inode); + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); } return inode; } diff --git a/fs/inode.c b/fs/inode.c index 21b026d95b51..32e08c3fa9ff 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1851,6 +1851,7 @@ EXPORT_SYMBOL(bmap); static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, struct timespec64 now) { + struct timespec64 ctime; if (!(mnt->mnt_flags & MNT_RELATIME)) return 1; @@ -1862,7 +1863,8 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, /* * Is ctime younger than or equal to atime? If yes, update atime: */ - if (timespec64_compare(&inode->i_ctime, &inode->i_atime) >= 0) + ctime = inode_get_ctime(inode); + if (timespec64_compare(&ctime, &inode->i_atime) >= 0) return 1; /* @@ -1885,7 +1887,7 @@ int generic_update_time(struct inode *inode, struct timespec64 *time, int flags) if (flags & S_ATIME) inode->i_atime = *time; if (flags & S_CTIME) - inode->i_ctime = *time; + inode_set_ctime_to_ts(inode, *time); if (flags & S_MTIME) inode->i_mtime = *time; @@ -2071,6 +2073,7 @@ EXPORT_SYMBOL(file_remove_privs); static int inode_needs_update_time(struct inode *inode, struct timespec64 *now) { int sync_it = 0; + struct timespec64 ctime; /* First try to exhaust all avenues to not sync */ if (IS_NOCMTIME(inode)) @@ -2079,7 +2082,8 @@ static int inode_needs_update_time(struct inode *inode, struct timespec64 *now) if (!timespec64_equal(&inode->i_mtime, now)) sync_it = S_MTIME; - if (!timespec64_equal(&inode->i_ctime, now)) + ctime = inode_get_ctime(inode); + if (!timespec64_equal(&ctime, now)) sync_it |= S_CTIME; if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode)) diff --git a/fs/nsfs.c b/fs/nsfs.c index f602a96a1afe..647a22433bd8 100644 --- a/fs/nsfs.c +++ b/fs/nsfs.c @@ -84,7 +84,7 @@ static int __ns_get_path(struct path *path, struct ns_common *ns) return -ENOMEM; } inode->i_ino = ns->inum; - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); inode->i_flags |= S_IMMUTABLE; inode->i_mode = S_IFREG | S_IRUGO; inode->i_fop = &ns_file_operations; diff --git a/fs/pipe.c b/fs/pipe.c index 2d88f73f585a..174682103669 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -899,7 +899,7 @@ static struct inode * get_pipe_inode(void) inode->i_mode = S_IFIFO | S_IRUSR | S_IWUSR; inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); return inode; diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 7fa1b738bbab..a05fe94970ce 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -1027,7 +1027,7 @@ int simple_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, return error; } - inode->i_ctime = current_time(inode); + inode_set_ctime_current(inode); if (IS_I_VERSION(inode)) inode_inc_iversion(inode); set_cached_acl(inode, type, acl); diff --git a/fs/stack.c b/fs/stack.c index c9830924eb12..b5e01bdb5f5f 100644 --- a/fs/stack.c +++ b/fs/stack.c @@ -68,7 +68,7 @@ void fsstack_copy_attr_all(struct inode *dest, const struct inode *src) dest->i_rdev = src->i_rdev; dest->i_atime = src->i_atime; dest->i_mtime = src->i_mtime; - dest->i_ctime = src->i_ctime; + inode_set_ctime_to_ts(dest, inode_get_ctime(src)); dest->i_blkbits = src->i_blkbits; dest->i_flags = src->i_flags; set_nlink(dest, src->i_nlink); diff --git a/fs/stat.c b/fs/stat.c index 7c238da22ef0..8c2b30af19f5 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -58,7 +58,7 @@ void generic_fillattr(struct mnt_idmap *idmap, struct inode *inode, stat->size = i_size_read(inode); stat->atime = inode->i_atime; stat->mtime = inode->i_mtime; - stat->ctime = inode->i_ctime; + stat->ctime = inode_get_ctime(inode); stat->blksize = i_blocksize(inode); stat->blocks = inode->i_blocks; } From patchwork Wed Jul 5 19:01:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13302759 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 AF890EB64DD for ; Wed, 5 Jul 2023 19:04:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5835C8D0005; Wed, 5 Jul 2023 15:04:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 534458D0001; Wed, 5 Jul 2023 15:04:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FBC48D0005; Wed, 5 Jul 2023 15:04:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2E7408D0001 for ; Wed, 5 Jul 2023 15:04:40 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 04768120C1C for ; Wed, 5 Jul 2023 19:04:39 +0000 (UTC) X-FDA: 80978484720.22.CFDAF84 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id B05BB140028 for ; Wed, 5 Jul 2023 19:04:37 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=cT6gBYHC; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688583877; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Q0hjCfQouy2HldOFx4lZvIHbaxQxrlWvTefb6aOXcbs=; b=nVPCfPNBRPIp4S0SXR49o3ylfha6fRAsx1wvu+sI6jg8Q/rhFU7OP+s0tRsdRtxv7nrdkd 0FFaZdtoCZH+fstJVCi7eqflE51T+hMjeVdvO+xuhWVGzvkrUiB4jnl3v7bJeGuWfOx5xt W0kYn/DUFEVPBj29Zbfw2L5j/c8nywU= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=cT6gBYHC; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688583877; a=rsa-sha256; cv=none; b=Yub+q2LgsxDrfDJjMLu8PF2p8YdfUQrJFpsA3czVvtue23t6P+GiXnMKXkPOdR4eGRTF2W Z5mqZh4yfbuk/J5xjpPd0ZkukDiCh99WEoT9Ml2s/Y4vximezMTUZkO8smExEYbKQFvebW Vtpo92/arH0le3TTEnnBFVHdbgUhJVU= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 88458616E4; Wed, 5 Jul 2023 19:04:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93859C433C8; Wed, 5 Jul 2023 19:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688583876; bh=VTN22iDlc64pJ0V7tpQfQ3Y7pWhLYJcjLyC9KHu7DZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cT6gBYHCRs/6tnJ8EKp/GPZRquTdOojJPymszidSu2ZcARD5LhhDsRCtQ6+No8KUO rWhc+OTLxB7j9N3UYTZJn0n6tMjSqrC4/u/HuImKHsYD0G1SJxZvMx5NI2xIzOOwic rErhRbOUiS0DqVGDECpI1QGtTByyDJE6Mwf/oKnBXAozpV1CEFcb5FMAKc11ogfUFx /b/Cc3Xz+DkxbPOaudF4TIdmqE/pndqJs6e6BnoK9UDx/gEO0k1ygvDuk5VBLAY68d Blo/yJZIJajDp0TtVHTaS1MCU5xXSTP+iO8MID38E8as5ZqTXr5/Jti4q6QUzNNl6E i4xIcbxGtrIVw== From: Jeff Layton To: Christian Brauner , Mike Kravetz , Muchun Song Cc: Al Viro , Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 52/92] hugetlbfs: convert to ctime accessor functions Date: Wed, 5 Jul 2023 15:01:17 -0400 Message-ID: <20230705190309.579783-50-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230705190309.579783-1-jlayton@kernel.org> References: <20230705185755.579053-1-jlayton@kernel.org> <20230705190309.579783-1-jlayton@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: B05BB140028 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: e3e5gifeiq3ori69b8djefot5fzdqxa5 X-HE-Tag: 1688583877-578468 X-HE-Meta: U2FsdGVkX19eZ0Qz71tl3WTIsRQAmPF34BHtB2u5WFjUx3CpPRjPVx40toyR58aYmjDj59u+rVqfHvq5oX+ereS7tgToyr/xTKWRo6jcLz0etR4JnQRprrGKi5Iu2LCGlmrhGicV2pF6pDOAdCjOmSadS7+zOl2UI7V0lYI7WeC4Me0X4fNq+F6iLMosW/7aB1DUtA3agET/BHwTJndbz3rh6IuWhVy+/icYqtB6UPIM6zBgI3NpbLRztSgleOxF1dpohTCdMooH62ivVXt9Ezrev+4OMg3W6MIBbZhi0PWAcASg+kJp+Nf6DcemyzlAQXfBYJoxRm+bMIseM1gqMOgcuBEYV9+Y2rth8TxqZi/SWWGS8lfZ8i42cwXfKUZEiOXLa1C4+iv3LolNVqd4Vz3s0k5y1gjtogBt27MisGRvlusDKcOBkVKpZVK0twpPYkRRgR9sy8NYCnxfyimVX4F76qKVLP9dlDzOyXDrJnplvbWCFVeyqZTKrgmsiuIScEiLmirqvHAb1j+yMX0p98qmuImwR+E9BoEFnXBhJFlvWefRormrcl4GYQqK6hEbercVVD55gcAeODansD6JjL2hl8WC68w/QDQlF/KZUIxKs5k3SHOHGC1Tq1xcSA3d14+ff3o3fC46HbDHEbzmw2ZUPsAXotuSWmK/E0Lhe1rfAALgXxAM3C3HhD4MoEXqhL41rZ9+wWvKzPiHsCoPZB4LyjpiZ0yhmnyPPwC8F5m2BVohy8fcwzsGsy/208y2QXiaJSiGgFRXL+tq5d3MIjm6m5Np83p7TxxKpMfUwZq27HBuBwlLDefn+Ep0JRgC7AWMTTJAyM52lFjczHTpRNrsWWMAf7njyeLxfgahspnmIafVBAGQSm+Hs9FVYzgzUT+cCKA/BRKOCa9lIL3+2gMI3ckeuB0MUG0rPiMr3Ymy25mBPtBq4QQ2go1vgcUFrF1bfKTzOdG8VTRlXgB 0zV4H5ND w0wG4zWn2IdE5rf20x7LoyCcTwhzaVdZLge8ZgxGRp2yltfYu7g7o0DxzsQOJ+6P7FDWNA+yBMY/9LYFOs8bGsNQaZSVvSUPcnJ96AZewk77OgYg9amOQKVVtEPezkWEigaj2OFVkGCrdM9WqyZcsvWwiS9WWyLt9Swr84n0sPC5qFDICOAY7IdEYCn3t/gs4vhBbhwUj9yFLlkA+iZjX8mEirUGYpLY/EVqDfrHQmmybig3Yu40FFZKCVXmBj2Tl5UECkzcsj55wNjQs+rJSzKq9KF9WzngB7FtZhv5fYk0qyxDFBO4f+q98MzNDR0nXcGiV8PCbunhf339BHFLV7yCAYw== 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: In later patches, we're going to change how the inode's ctime field is used. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Signed-off-by: Jeff Layton Acked-by: Mike Kravetz Reviewed-by: Jan Kara --- fs/hugetlbfs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 7b17ccfa039d..93d3bcfd4fc8 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -887,7 +887,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) i_size_write(inode, offset + len); - inode->i_ctime = current_time(inode); + inode_set_ctime_current(inode); out: inode_unlock(inode); return error; @@ -935,7 +935,7 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb, inode->i_mode = S_IFDIR | ctx->mode; inode->i_uid = ctx->uid; inode->i_gid = ctx->gid; - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); inode->i_op = &hugetlbfs_dir_inode_operations; inode->i_fop = &simple_dir_operations; /* directory inodes start off with i_nlink == 2 (for "." entry) */ @@ -979,7 +979,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, lockdep_set_class(&inode->i_mapping->i_mmap_rwsem, &hugetlbfs_i_mmap_rwsem_key); inode->i_mapping->a_ops = &hugetlbfs_aops; - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); inode->i_mapping->private_data = resv_map; info->seals = F_SEAL_SEAL; switch (mode & S_IFMT) { @@ -1022,7 +1022,7 @@ static int hugetlbfs_mknod(struct mnt_idmap *idmap, struct inode *dir, inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev); if (!inode) return -ENOSPC; - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_set_ctime_current(dir); d_instantiate(dentry, inode); dget(dentry);/* Extra count - pin the dentry in core */ return 0; @@ -1054,7 +1054,7 @@ static int hugetlbfs_tmpfile(struct mnt_idmap *idmap, inode = hugetlbfs_get_inode(dir->i_sb, dir, mode | S_IFREG, 0); if (!inode) return -ENOSPC; - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_set_ctime_current(dir); d_tmpfile(file, inode); return finish_open_simple(file, 0); } @@ -1076,7 +1076,7 @@ static int hugetlbfs_symlink(struct mnt_idmap *idmap, } else iput(inode); } - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_set_ctime_current(dir); return error; } From patchwork Wed Jul 5 19:01:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13302760 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 71661EB64DD for ; Wed, 5 Jul 2023 19:05:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 13CD88D0006; Wed, 5 Jul 2023 15:05:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0ED628D0001; Wed, 5 Jul 2023 15:05:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF8318D0006; Wed, 5 Jul 2023 15:05:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DF8438D0001 for ; Wed, 5 Jul 2023 15:05:44 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A300D1A0C00 for ; Wed, 5 Jul 2023 19:05:44 +0000 (UTC) X-FDA: 80978487408.03.C0E3E78 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id C54C420025 for ; Wed, 5 Jul 2023 19:05:42 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VjCutnJI; spf=pass (imf03.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688583942; a=rsa-sha256; cv=none; b=CfdR6hOqhRhAWVLL/TwWMFRqSz/Ba9pFL7I64Os8qxkpmNu46sJtcxqEj42xOzE7wQ3OK0 mq7Z6gNhfvioGY94mvukWphrbVaHQtzhqj4n85JsGD0N4S7ZaVMrApGXOrXY7TUa3XNZts kUdD4RGL8tTUnMswBBbJBwhXi0iJyZY= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VjCutnJI; spf=pass (imf03.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688583942; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=L3pU5Q00INptaBFAO9mFc3Gi0t16lE110/oKSVwhMEg=; b=a0IlAz72pRaf/unjg14k3HybiGZdLzVv0fTwlN3qTXIGIuyjq/eCyYdyQFVpmJV/oZ5NK4 aQY3VjPexSzCghGQwuMLF9n1TouBmcqiw5wxoe7qiTFBK9tyQFLmtnWlMO4GcMUfahFfDh gxJ/5ywV/EOxnGgzfSPvq8hMnlwBBBM= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B197161701; Wed, 5 Jul 2023 19:05:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59D8DC433C9; Wed, 5 Jul 2023 19:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688583941; bh=GKBCwLrYWAi3v0y6MO93lIfNnq+o58agxgcNSmD247M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VjCutnJIUPMgnmCBtHf33PNh66QZiXyZbegxgDSHMXLyEpi+E2XZBS7unmk8g5A/E 1vRwbOcVg4MwoSTulTtqWD0yc1P69v1xHCJV2TMVBBJoxmXNBIRwRd0uEEIJWTotPd wxit/iq+dAgVTkGNqSQYiC9d5RYFXT1Ct1ySxYchal2VyA1P7wrcmB1oXBE87t0tWS 08zPWFehqqaG8ePSrnTE+HN/vd5S0N1pAxoYU7s3aoKTrQVfbRMXKh2JCs67bTUQkQ VygI7K4nV0a1+8iHMw7HZrrGWS5C8bZmEz03rcLQBUucWi0VIBEWLmYHSbaViiOSvy CR1BGZAbDI8Wg== From: Jeff Layton To: Christian Brauner , Hugh Dickins , Andrew Morton Cc: Al Viro , Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 87/92] shmem: convert to ctime accessor functions Date: Wed, 5 Jul 2023 15:01:52 -0400 Message-ID: <20230705190309.579783-85-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230705190309.579783-1-jlayton@kernel.org> References: <20230705185755.579053-1-jlayton@kernel.org> <20230705190309.579783-1-jlayton@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: C54C420025 X-Stat-Signature: rdqbtgyypch4epgb6tarfbc95gugffq8 X-Rspam-User: X-HE-Tag: 1688583942-327133 X-HE-Meta: U2FsdGVkX19WVT/JX9HvUiqk3DasB5KzuXgeDR4xYQ20THOwo2kdsNwY1oryWgW5Ql+sd4rGoZGKehQgSIuTu2b3nhe+6udUKVNM1lgNYAz+NtztRLzS+wvNM3Bp8lsPq39Laz4UeJJduutY48gR5aRM4ajpA7+JGz1L+ubEggQopQ+babKCVJOknBA8GIez8v80iLGiZFAwy++2YqFOV0wx4HlfGmle4Zi+KDP6BP5/rbhWaBF3eTWHfxickmWzL+qWC6n1LeOnyyb+C/BTqHL9T3R9F47Z827j3WAhYPVSfu1XzV/hfqXIKdFV4gT7Hb4Cw78DW5FTatFu51f/VXjHJZRK8FVQCtdc0RjMS+PidtqFMMacePrj5VYekfOexbLTsLaoGCYmEgvxOD6LGCAtur7oLnogkpJCeLXH1qkleNiOth+H6Jj8mLzBln0KmlVTq/LqPRzMyfHqMKpnZlA9AhJ9M1OYZznVtwhN7r2oIoKdsw+fRxmHYpiSfmsoAyye6YlqNfh94tuOaWO8gUVZGSh5lopP7Z9VgE7kJe49PlrUm3VGwFkS3nmgqCDt+0OoVwNfoueutzADRJSM1dMP8Hbzw5rODCgtW7ciIeAAOq6VndtvXb1Gem8q3RINPIfxMWm0+J6TsvvF0NO+ls8St39Uhc+q04l3Y6DOXbnUsaea9tYXcSMSk+vogolwtLtKSU6C891rLuqzd6F2uAgP3N0reET7pZm+vEBkJREa0AWph59NiADaH3ooj2WAgDR6/ejplkrYpexHG4KzO+YhUHhwoC8mrIRmmnkvHSS6z9csygWyt32ZpRxxnKhf6j5ZV7wt5s+4e4EeHADiraotkXeUmLWjfJXUY9aCKEnaM/CRhwmzQlNWxrVstb6jzcqOTUgfyfqpqc1Iv46UuYCQ0czirJ79C3OLWiBfkz6UZftX1pOgvhQ27uThtv/6Do+jWlVdTkcLYP/Qofq O/ttRKyi qEHEQq+wQ8BImKOlsoAuQxzS+qtuamC0lMwzQZAwoyjNCV2rwsmD94r6CBJJb8vtEhUW+w/uK3YXu7ZTmQoD8LysxDDnnS+QLPi8pQXJGrs+fTcxJMQdINIvDgQ3meDpHmot4bLWrl6y5P/aAacP6dPAHagJHg2vl/a9+yNXs60Mu3p4DBAQrifKXbwEOfs25l5xbnT3Wa3UG0wS2W10IMCJeLB/GkNERvJZdtv7OQ8eUK2EEDuK+kqM71Qj2ZPwSlU5bcWOHWMmYk//wHIm6313HoMeymTXJx3Cqts9H7hn8a7vgG63aeyLFLr3JtBaW23MIhBeVo7KStJELYxlUIR/WSg== 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: In later patches, we're going to change how the inode's ctime field is used. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Signed-off-by: Jeff Layton Reviewed-by: Jan Kara --- mm/shmem.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 1693134959c5..51aaaf479437 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1064,7 +1064,7 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend, void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend) { shmem_undo_range(inode, lstart, lend, false); - inode->i_ctime = inode->i_mtime = current_time(inode); + inode->i_mtime = inode_set_ctime_current(inode); inode_inc_iversion(inode); } EXPORT_SYMBOL_GPL(shmem_truncate_range); @@ -1161,9 +1161,9 @@ static int shmem_setattr(struct mnt_idmap *idmap, if (attr->ia_valid & ATTR_MODE) error = posix_acl_chmod(idmap, dentry, inode->i_mode); if (!error && update_ctime) { - inode->i_ctime = current_time(inode); + inode_set_ctime_current(inode); if (update_mtime) - inode->i_mtime = inode->i_ctime; + inode->i_mtime = inode_get_ctime(inode); inode_inc_iversion(inode); } return error; @@ -2394,7 +2394,7 @@ static struct inode *shmem_get_inode(struct mnt_idmap *idmap, struct super_block inode->i_ino = ino; inode_init_owner(idmap, inode, dir, mode); inode->i_blocks = 0; - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); inode->i_generation = get_random_u32(); info = SHMEM_I(inode); memset(info, 0, (char *)inode - (char *)info); @@ -3110,7 +3110,7 @@ shmem_mknod(struct mnt_idmap *idmap, struct inode *dir, goto out_iput; dir->i_size += BOGO_DIRENT_SIZE; - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_set_ctime_current(dir); inode_inc_iversion(dir); d_instantiate(dentry, inode); dget(dentry); /* Extra count - pin the dentry in core */ @@ -3193,7 +3193,8 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr } dir->i_size += BOGO_DIRENT_SIZE; - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); + dir->i_mtime = inode_set_ctime_to_ts(dir, + inode_set_ctime_current(inode)); inode_inc_iversion(dir); inc_nlink(inode); ihold(inode); /* New dentry reference */ @@ -3213,7 +3214,8 @@ static int shmem_unlink(struct inode *dir, struct dentry *dentry) simple_offset_remove(shmem_get_offset_ctx(dir), dentry); dir->i_size -= BOGO_DIRENT_SIZE; - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); + dir->i_mtime = inode_set_ctime_to_ts(dir, + inode_set_ctime_current(inode)); inode_inc_iversion(dir); drop_nlink(inode); dput(dentry); /* Undo the count from "create" - this does all the work */ @@ -3360,7 +3362,7 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir, folio_put(folio); } dir->i_size += BOGO_DIRENT_SIZE; - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_set_ctime_current(dir); inode_inc_iversion(dir); d_instantiate(dentry, inode); dget(dentry); @@ -3438,7 +3440,7 @@ static int shmem_fileattr_set(struct mnt_idmap *idmap, (fa->flags & SHMEM_FL_USER_MODIFIABLE); shmem_set_inode_flags(inode, info->fsflags); - inode->i_ctime = current_time(inode); + inode_set_ctime_current(inode); inode_inc_iversion(inode); return 0; } @@ -3508,7 +3510,7 @@ static int shmem_xattr_handler_set(const struct xattr_handler *handler, name = xattr_full_name(handler, name); err = simple_xattr_set(&info->xattrs, name, value, size, flags, NULL); if (!err) { - inode->i_ctime = current_time(inode); + inode_set_ctime_current(inode); inode_inc_iversion(inode); } return err;