Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9557550rwd; Wed, 21 Jun 2023 08:52:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4bM2vrUTtTDF7cIYZoDKTqpI5AtZ7NnrdotE8vTERgLFnHjJHtxhHqlxaINy8IeN7bFGFw X-Received: by 2002:a05:6a00:2191:b0:667:85e6:4d1 with SMTP id h17-20020a056a00219100b0066785e604d1mr16778789pfi.33.1687362725826; Wed, 21 Jun 2023 08:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687362725; cv=none; d=google.com; s=arc-20160816; b=iQaqwn2ndOKQH6MvQ4/Ld2gIpAgDkNjh7EZq6IaxCRJuMIryLHJ9T4WjT/jggdMFfu qWXAMcnNKcrr5ZAiEN2fEpvWSQtUnfzq8O0/ER/4efN7LBISaa85q1sXQwkFPq/QpSlW VrD2LR/fbTtqj1zZASejlxqLre4mqH3BBCKs8KxZVtYwiwBvGRGCoFKsjc93m9asFTOV qKHQEMgwFjxJlcm79nW+tMr9WHn6e8Kb0lm8I+tdkjag5oGp4f4nFWv0OZNxyu8Vk7M4 qwcwLbWbNwMi+moC/AfnN1K3jCAxhQBLP73LO3LhRRs6uRfHiYlcqlXWWx5nrAxbYOlT 8GNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3wI1FotU3VTqXLiliGTvn7irpD4LlKRhlI8DOB7eB8s=; b=sVuhsgYEsDcQ3+hbAMbs+fSMS+r6peev89wulQRR+A8z6Wh2KplxI7wT10JwQykmlT r9hSQ+RjDZJtvsnCR5YNE9tyMIZX10uvfnq8NsiZk+anA2WHkXBo3nUKatITo5d9uPSV Tq4moM+L10fbxgPwgRYkqo+IqZGKGqecu4KeqdMjuZYHbeE/OvsgVlbo9eC4oYcCRsH/ FkiiSm3KViBeTdRIIqnF5h0wgc6KyIse36FpRYw9mW2ycMMXqAZHkzENUGGButKIySqS 8RxlkBjm74T5gBkZlLPMAeSKTldu6tEt3mr/wayK4HHKuzqZ8HK1kYlTjfYSqHPkZBVn tpnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vFGsyrgq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y79-20020a626452000000b00666e1259fa4si3367411pfb.141.2023.06.21.08.51.53; Wed, 21 Jun 2023 08:52:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b=vFGsyrgq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232112AbjFUO4D (ORCPT + 99 others); Wed, 21 Jun 2023 10:56:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233000AbjFUOxz (ORCPT ); Wed, 21 Jun 2023 10:53:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA9292134 for ; Wed, 21 Jun 2023 07:50:02 -0700 (PDT) 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 E8045615BE for ; Wed, 21 Jun 2023 14:49:44 +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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-kernel@vger.kernel.org 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; -- 2.41.0