From patchwork Wed Jul 5 19:01:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 116357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2096282vqx; Wed, 5 Jul 2023 12:42:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ57VoCfKqLc8W60kH3ZIEP+NEk3N9GyvBwOsLYfvgJtsygi5ijN5PQzccVsh13SODEM4LeX X-Received: by 2002:a05:6a21:6d88:b0:122:e4f:25c7 with SMTP id wl8-20020a056a216d8800b001220e4f25c7mr15567491pzb.31.1688586129764; Wed, 05 Jul 2023 12:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688586129; cv=none; d=google.com; s=arc-20160816; b=w12dWQi9dPQEzwwQtemKp/hglLT25TLHvrAoFSO6/BIEduuIvIfCn8dHdTLyiQbLDC 7fJ4HC1qkicT3Ftu+vlA7GMp67jgA3W40WoshZP30vvqht1sIqK3rJXfog13cOXNCI+2 VkDNBIzO3RLAf/GLQMtzZKXQx8bRoJW0jGkZ8an9jRYu9cnZiPRFAFR259Saeamxy4V7 Oj/SRgyaMmgA+RiXtUb+jOd3xTxL5wIovdqWt/M59SeyR3PkxySDvFWa0WufPKZX9QZy qJRZF1EKssUmWeuB62nezXjRub/2BivRrENOI1tLNw0zmx8r578EzGKrGrfh/w9m720P b1lA== 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=Rth1t+yZAO6WuRgzc6NaInNv3oaRpJ18BYPDD6lk4KY=; fh=NSc8dZdErb2gdcRKDV2tZv9WN36uFA+9uWEteurYwJA=; b=a4fV1dE8rgRuU1rikJELWivIb1XlmUMe68pMHWXmGUnLGaIxhdwfHyz6GhLvXNPeDa u98p1vKVldHwsCyujK2BW7uEcXDdgzHxyWvHMluRHXyPsZNPhljy677Ag+4GcCIgDcZd ChiPmEPFsRhAq4E35va+PYN3qRopqjKT58SCITUt6Pm/FBfFw5NNFtt+1dVbWyM2lw2f TafqFd7KaSca3qKfRufSn7F99g5U4F1qaySgiiNUFsYR7rOuFex7WADqSZ2NuPZ7g/4x wIGP6Kjf/8sj88SgMKNwUGYCMYW5j+g812pxbghDU4subMsF+DbYdRLJUbePBrXlXZ8b 7ltw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gyAtYMyc; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l5-20020a056a0016c500b0065ee6c40f91si25033272pfc.159.2023.07.05.12.41.55; Wed, 05 Jul 2023 12:42:09 -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=gyAtYMyc; 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 S233781AbjGETHT (ORCPT + 99 others); Wed, 5 Jul 2023 15:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233375AbjGETGR (ORCPT ); Wed, 5 Jul 2023 15:06:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0653273C; Wed, 5 Jul 2023 12:04:22 -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 CED1161701; Wed, 5 Jul 2023 19:04:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2D94C433C9; Wed, 5 Jul 2023 19:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688583862; bh=EE1pMrQ7eUtaCqd78aDEt+l5fcwyOfnOdSwd15ijX/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gyAtYMycE2dNDYESwnLkyjwZ2jj7Wj2l2RbcnD8pGImfzoiHw4JLq17FhFfjhZ5rn u90N7i5SUOWEwsJpAps+KyFTPl+odwR5AisrTwBzk5DbwenAUVE0S+rDNwHcOVKNxz IpGRBrsFDqXdyP0EKogBhkafqbVs25wCr3f8fMyoAbHHB+9DedwZw10Tx+h8X2csQB OJoWI8Bd4LkN2W0nQO19G7pk8AHZxarXXs7P9yz5kI4QZ1HFYCxBwEyauVzd2t8nK+ 6fyvuk/SLiIsHo/n9uI5xYuef4rusM8rEzCo+Wpw+b3J6L9mqtZxl7OWv58wMAF5t3 FKY7zkSWSWt6Q== From: Jeff Layton To: Christian Brauner , OGAWA Hirofumi Cc: Al Viro , Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 44/92] fat: convert to ctime accessor functions Date: Wed, 5 Jul 2023 15:01:09 -0400 Message-ID: <20230705190309.579783-42-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-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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770610889500072649?= X-GMAIL-MSGID: =?utf-8?q?1770610889500072649?= 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 --- fs/fat/inode.c | 7 ++++--- fs/fat/misc.c | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/fat/inode.c b/fs/fat/inode.c index d99b8549ec8f..2be40ff8a74f 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -562,7 +562,7 @@ int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) & ~((loff_t)sbi->cluster_size - 1)) >> 9; fat_time_fat2unix(sbi, &inode->i_mtime, de->time, de->date, 0); - inode->i_ctime = inode->i_mtime; + inode_set_ctime_to_ts(inode, inode->i_mtime); if (sbi->options.isvfat) { fat_time_fat2unix(sbi, &inode->i_atime, 0, de->adate, 0); fat_time_fat2unix(sbi, &MSDOS_I(inode)->i_crtime, de->ctime, @@ -1407,8 +1407,9 @@ static int fat_read_root(struct inode *inode) MSDOS_I(inode)->mmu_private = inode->i_size; fat_save_attrs(inode, ATTR_DIR); - inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec = 0; - inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = 0; + inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode_set_ctime(inode, + 0, 0).tv_sec; + inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = 0; set_nlink(inode, fat_subdirs(inode)+2); return 0; diff --git a/fs/fat/misc.c b/fs/fat/misc.c index 7e5d6ae305f2..67006ea08db6 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c @@ -332,7 +332,8 @@ int fat_truncate_time(struct inode *inode, struct timespec64 *now, int flags) * but ctime updates are ignored. */ if (flags & S_MTIME) - inode->i_mtime = inode->i_ctime = fat_truncate_mtime(sbi, now); + inode->i_mtime = inode_set_ctime_to_ts(inode, + fat_truncate_mtime(sbi, now)); return 0; }