From patchwork Wed Jun 21 14:46:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13287440 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 5D664EB64D7 for ; Wed, 21 Jun 2023 14:49:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E11508D0003; Wed, 21 Jun 2023 10:49:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC0038D0002; Wed, 21 Jun 2023 10:49:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD60B8D0003; Wed, 21 Jun 2023 10:49:48 -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 BD7138D0002 for ; Wed, 21 Jun 2023 10:49:48 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 74E931C84B2 for ; Wed, 21 Jun 2023 14:49:48 +0000 (UTC) X-FDA: 80927039256.22.3A4505D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 871FC4002B for ; Wed, 21 Jun 2023 14:49:46 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=vFGsyrgq; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.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=1687358986; 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=3wI1FotU3VTqXLiliGTvn7irpD4LlKRhlI8DOB7eB8s=; b=LXXA2hJ9qxihICbR2He5KzpiaZJvjDHHSB2PK+z1tCBGj8msCL7AQzSrX34rH2sIhJVKBn xpjkRnyafkUfO91r56Pzqrz7oEd1E5KaJdQCIqmvPSAbFu6/QuBZw/EYD8NyxSJtkcKcNX gQezQ3RghKyLxHd+NqWDGvaCIkdjf38= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=vFGsyrgq; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.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=1687358986; a=rsa-sha256; cv=none; b=kp6dOP7rkpL4ce6YRMB0a1rtzKCVxEFpSyW8y/Ia1otKML4Y2+BC7BUbnaFSVIj4p6GNtX swDwj+6434dOHgJ1hlyzLMb4E9Fp8DUqCvbwOcYWSrMAO0i+Bb/kyKRjD43EG3D24mNpMV 1RRT3ArQAFhHBWG/Rjm4q/IgmvdBlKA= 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 C71C2615CC; Wed, 21 Jun 2023 14:49:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A48FEC433C8; Wed, 21 Jun 2023 14:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687358984; bh=rf2ZGKofEWdIrdzCw9fnlqHLrcKo5aaZCkZqt6T8HY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vFGsyrgqrZj9JG6n3lwXYoh17JzM5aGaXfMaXhu8JYQJbeWxMESNSVX+/Cy+0mIEb xrfuJbHf2/jnTyanOxmsNb+PW2TJ30MJEC0p4pb9QhJU+4THKGpleOax60RFFGyFPv gXpPqI6dtzGaGDQc/FjNC/nbT7F8IFwo4QT6uiADNbBG0gWtNm6k0eeMAbL7OrZa+o R7WJt7wWt/ylML88EArNa50Nm1t6aFjCxmjad+Dt6VkPqsEssRWfKj6X2i+1JHaNoO 0HSt7UeZhqnkvwXFmr/UrKldM1Ro0pFRnhO0s3L9gCxOVgpmOvB0Hq/L1O0eHfw5Ls sUhw8iaL9Izww== From: Jeff Layton To: Christian Brauner , Hugh Dickins , Andrew Morton Cc: Al Viro , Jan Kara , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 74/79] shmem: switch to new ctime accessors Date: Wed, 21 Jun 2023 10:46:27 -0400 Message-ID: <20230621144735.55953-73-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230621144735.55953-1-jlayton@kernel.org> References: <20230621144507.55591-1-jlayton@kernel.org> <20230621144735.55953-1-jlayton@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 871FC4002B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 1ujcxmex19pdoj63x3k6xdno7j5orfxx X-HE-Tag: 1687358986-725473 X-HE-Meta: U2FsdGVkX18revLcLMe2Ik3sibFTlg8P7pAkTNU1mZ31LrFzhLjJ2XSWPmiXKOyGPn5ubzCib8wmpDYpeQOx/V1XBwm1PmcdjyNky0gP3P7fXSmbL6YGALlZgQIzXVNShW4Vy4XXt3kkHuJ/pdohnwW1qnyTvXCmc8ItWukYW7LHLn3xk2I7hfOfzbHuIpPSr4/n63WX4H+N43gqBQpg2bq+nVQWbYZTHYr7OZPrmvIn4ZZ4t8IFxT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65WN/22PX6fkg== 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 ctime.tv_nsec field is utilized. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Signed-off-by: Jeff Layton --- mm/shmem.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 4752084720b2..4979cb3e37e5 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_ctime_set_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_ctime_set_current(inode); if (update_mtime) - inode->i_mtime = inode->i_ctime; + inode->i_mtime = inode_ctime_peek(inode); inode_inc_iversion(inode); } return error; @@ -2389,7 +2389,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_ctime_set_current(inode); inode->i_generation = get_random_u32(); info = SHMEM_I(inode); memset(info, 0, (char *)inode - (char *)info); @@ -3101,7 +3101,7 @@ shmem_mknod(struct mnt_idmap *idmap, struct inode *dir, error = 0; dir->i_size += BOGO_DIRENT_SIZE; - dir->i_ctime = dir->i_mtime = current_time(dir); + dir->i_mtime = inode_ctime_set_current(dir); inode_inc_iversion(dir); d_instantiate(dentry, inode); dget(dentry); /* Extra count - pin the dentry in core */ @@ -3177,7 +3177,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_ctime_set_current(inode); + inode_ctime_set(dir, dir->i_mtime); inode_inc_iversion(dir); inc_nlink(inode); ihold(inode); /* New dentry reference */ @@ -3195,7 +3196,8 @@ static int shmem_unlink(struct inode *dir, struct dentry *dentry) shmem_free_inode(inode->i_sb); dir->i_size -= BOGO_DIRENT_SIZE; - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); + dir->i_mtime = inode_ctime_set_current(inode); + inode_ctime_set(dir, dir->i_mtime); inode_inc_iversion(dir); drop_nlink(inode); dput(dentry); /* Undo the count from "create" - this does all the work */ @@ -3283,9 +3285,9 @@ 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); + old_dir->i_mtime = inode_ctime_set_current(old_dir); + new_dir->i_mtime = inode_ctime_set_current(new_dir); + inode_ctime_set_current(inode); inode_inc_iversion(old_dir); inode_inc_iversion(new_dir); return 0; @@ -3339,7 +3341,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_ctime_set_current(dir); inode_inc_iversion(dir); d_instantiate(dentry, inode); dget(dentry); @@ -3411,7 +3413,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_ctime_set_current(inode); inode_inc_iversion(inode); return 0; } @@ -3481,7 +3483,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_ctime_set_current(inode); inode_inc_iversion(inode); } return err;