Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2804930rdb; Wed, 4 Oct 2023 11:57:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHecdRkxPKS3U6NjDZ3q497JVliR4/hkUTJcahJ2/feVrRdwZ/XyfGiexGB0Uet6FByCS1/ X-Received: by 2002:a05:6808:2a53:b0:3a9:bb4f:9efd with SMTP id fa19-20020a0568082a5300b003a9bb4f9efdmr2976223oib.29.1696445852132; Wed, 04 Oct 2023 11:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696445852; cv=none; d=google.com; s=arc-20160816; b=POAJPW3eaYc9hvUI9fG2SCoHtPNJ6CYM6+t1xIPDZGAvViWnA6km5int/YDOJ6Y9sv +HyBZVOpQxclTBML/kZcNqdYX9p/goTCDAyQ1eMXmZB408YSfrjHZ1IaK8zdCUf74iQj Qrls3IRvyOE/nX5atdP+vMQNvp05qgRHoSTWgbJ+QFtqHSdDATJXEoFKNPvJ/z7A4ASJ 93V+IHP3wazjX4EvwkQebhZdaEQRiGtvX/PKFMYhk4yr2vVVEEIX4J8cB47RPCYeu4DV f+xCeVja5GE15t6M7dYQ3DajCoOheytwu1KEtO2t9rrCyp9gJ7Y2nI0S14+lnQmKZuV3 ieBQ== 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:to:from :dkim-signature; bh=DhOOT0leIxEM7rLq5n3xQoXmH61sBsqkkv4jRr2k9q4=; fh=c1hve9LK7bidUltaxotdOOkNtWZ8Drk/KOyPdUWU/OI=; b=hM9BFKQhp3imdfXQ6d+YPE9WzA4E6X96Bx5tRcEPhzTDadgsC87jRpbY0GS9n7meL/ MAvQbXmua2mOm5EopDwA/oEqjJBqYyUf+Gpia91ZmxTs4GUHDFroc2LDdo9rV1OM/6m7 bJ4Gtb0XeS2yRp06RKm3nPF8fL2c90hF/asM3KfpsRM3yJ4ZTTjZhbBjE5H7Wr+7EWgv b38w6ApJt6tN6ag8d6piG6i1YIxMw4JtmbklTLuVcF5imB9QC/Mg/S91NHzLcSXwFcWs GZOzfU4LF0y/ZEJVxA3zbVsq3nJoBMl6fIgtpBk3f/u4+62G9NtSgAsmB43/6N5IjMuf N++g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sQNNxDf3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id be3-20020a656e43000000b00588e13f4cc8si4303363pgb.519.2023.10.04.11.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 11:57:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sQNNxDf3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B9E6E827004A; Wed, 4 Oct 2023 11:57:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245185AbjJDS51 (ORCPT + 99 others); Wed, 4 Oct 2023 14:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244845AbjJDSyy (ORCPT ); Wed, 4 Oct 2023 14:54:54 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3996F10EC; Wed, 4 Oct 2023 11:54:30 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 550FFC433CA; Wed, 4 Oct 2023 18:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696445669; bh=F1w46M8uNPh8dz51qRijLO0+0UFVX+P0B4bmFxVHd34=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sQNNxDf3hAYMEpihh9arqCjkOyLgNsRjzSacYhqh9DV5Ll2zT5dPNrBqiatsTTgLN 6C2q+UexIKOqn+Oe3toL6RNtw69QewLLzivk2wk64y8k5EI0NwZ63PoE6TNmLYQ9UP WTeKEyKKYiyrv+UgPj8n1PE7fjfrNuRo6lNGcTcbtzPnG/0CD1Igs0dQwCzUOhpo73 NCRX5ycxcPVWFhU77cwpcBMyTGKaIj+WVxAAvJUZeArWVBTlZh9rNEAH+dK0wAI2MF e066QfpvLl3VVfa4mZdScCxhtRz5LjZBk0QLkPUPJC5KyvY9shgBP4Mu6m/d1YNS/E h4BvqcBVuYegQ== From: Jeff Layton To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 37/89] fat: convert to new timestamp accessors Date: Wed, 4 Oct 2023 14:52:22 -0400 Message-ID: <20231004185347.80880-35-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231004185347.80880-1-jlayton@kernel.org> References: <20231004185221.80802-1-jlayton@kernel.org> <20231004185347.80880-1-jlayton@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 11:57:31 -0700 (PDT) Convert to using the new inode timestamp accessor functions. Signed-off-by: Jeff Layton --- fs/fat/inode.c | 25 +++++++++++++++++-------- fs/fat/misc.c | 6 +++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/fs/fat/inode.c b/fs/fat/inode.c index cdd39b6020f3..aa87f323fd44 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -512,6 +512,7 @@ static int fat_validate_dir(struct inode *dir) int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) { struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); + struct timespec64 mtime; int error; MSDOS_I(inode)->i_pos = 0; @@ -561,14 +562,18 @@ int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1)) & ~((loff_t)sbi->cluster_size - 1)) >> 9; - fat_time_fat2unix(sbi, &inode->i_mtime, de->time, de->date, 0); - inode_set_ctime_to_ts(inode, inode->i_mtime); + fat_time_fat2unix(sbi, &mtime, de->time, de->date, 0); + inode_set_mtime_to_ts(inode, mtime); + inode_set_ctime_to_ts(inode, mtime); if (sbi->options.isvfat) { - fat_time_fat2unix(sbi, &inode->i_atime, 0, de->adate, 0); + struct timespec64 atime; + + fat_time_fat2unix(sbi, &atime, 0, de->adate, 0); + inode_set_atime_to_ts(inode, atime); fat_time_fat2unix(sbi, &MSDOS_I(inode)->i_crtime, de->ctime, de->cdate, de->ctime_cs); } else - inode->i_atime = fat_truncate_atime(sbi, &inode->i_mtime); + inode_set_atime_to_ts(inode, fat_truncate_atime(sbi, &mtime)); return 0; } @@ -849,6 +854,7 @@ static int __fat_write_inode(struct inode *inode, int wait) struct msdos_sb_info *sbi = MSDOS_SB(sb); struct buffer_head *bh; struct msdos_dir_entry *raw_entry; + struct timespec64 mtime; loff_t i_pos; sector_t blocknr; int err, offset; @@ -882,12 +888,14 @@ static int __fat_write_inode(struct inode *inode, int wait) raw_entry->size = cpu_to_le32(inode->i_size); raw_entry->attr = fat_make_attrs(inode); fat_set_start(raw_entry, MSDOS_I(inode)->i_logstart); - fat_time_unix2fat(sbi, &inode->i_mtime, &raw_entry->time, + fat_time_unix2fat(sbi, &mtime, &raw_entry->time, &raw_entry->date, NULL); + inode_set_mtime_to_ts(inode, mtime); if (sbi->options.isvfat) { + struct timespec64 ts = inode_get_atime(inode); __le16 atime; - fat_time_unix2fat(sbi, &inode->i_atime, &atime, - &raw_entry->adate, NULL); + + fat_time_unix2fat(sbi, &ts, &atime, &raw_entry->adate, NULL); fat_time_unix2fat(sbi, &MSDOS_I(inode)->i_crtime, &raw_entry->ctime, &raw_entry->cdate, &raw_entry->ctime_cs); } @@ -1407,7 +1415,8 @@ 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 = inode->i_atime = inode_set_ctime(inode, 0, 0); + inode_set_mtime_to_ts(inode, + inode_set_atime_to_ts(inode, inode_set_ctime(inode, 0, 0))); set_nlink(inode, fat_subdirs(inode)+2); return 0; diff --git a/fs/fat/misc.c b/fs/fat/misc.c index f2304a1054aa..c7a2d27120ba 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c @@ -325,15 +325,15 @@ int fat_truncate_time(struct inode *inode, struct timespec64 *now, int flags) } if (flags & S_ATIME) - inode->i_atime = fat_truncate_atime(sbi, now); + inode_set_atime_to_ts(inode, fat_truncate_atime(sbi, now)); /* * ctime and mtime share the same on-disk field, and should be * identical in memory. all mtime updates will be applied to ctime, * but ctime updates are ignored. */ if (flags & S_MTIME) - inode->i_mtime = inode_set_ctime_to_ts(inode, - fat_truncate_mtime(sbi, now)); + inode_set_mtime_to_ts(inode, + inode_set_ctime_to_ts(inode, fat_truncate_mtime(sbi, now))); return 0; } -- 2.41.0