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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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;