Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3150078rdh; Thu, 28 Sep 2023 04:22:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYZQuJH7DFmAQ1t6f2cGmNOHNvFzFUPCj6KOJmptMaghaf7BOZzb3Mg+iX+gbY7DXNumct X-Received: by 2002:a17:903:41d1:b0:1c5:e527:68b0 with SMTP id u17-20020a17090341d100b001c5e52768b0mr882749ple.62.1695900137812; Thu, 28 Sep 2023 04:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695900137; cv=none; d=google.com; s=arc-20160816; b=EmIOrWhKMz0RTPZjhVA/u14pJxNwvKrSfT10bpvHy0eGkmWtH5vdSvHr1xmj9X9NAD 0UnPd3XzntkOIqYQJSyoarGoWA0Y188RpUlCKLbim8cwvk+5w6mNc9qJhBs62iB8Epbw bDcUB/A1kSpwBL6IIjSH6gTPVrPkfs8eVgULpQ0LA1dK+s80CbYYIxsk93+0LwsDuxRl ZrE2SAhV3UlRpGSfKRw/gOX58En/ebhU/HL1K2AE4FhKAIWrOojBIjxc3IkfNN4rRwKI 2L8xAAcr0QizVD0duoxuPex1armdY+W/p7PrCwuQoEwo7dGgderujeZYlwjpyK7AS1Gc OZBw== 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=CICgy+tiSSF211JXqYdTxRL5yiJ8DGmCiXKa5XeGzc8=; fh=c1hve9LK7bidUltaxotdOOkNtWZ8Drk/KOyPdUWU/OI=; b=sLHm3EP8ge7ak+UA3QqQPrnKAyAva/QYdQGBFkNRqI5IMVdYJbA5jleA7GswP9wETU K+ZGaXjvFPwjWXU6bIfbOTFgWPNiKrUGFGpOB3i7G8ik4Ynq0sxGOT2lNsz/vb5dbWnM zH3fFNLbhaD10RfX2D3IRHNE3yoErxtgMSIKzZoxCiQmD3HGSRivK9KL3qO21TGXt0uo QJEB9Y96I342dqhD7G4WNNiPAEYMlJJUpRuqPt996Ki7L2DBrXQns7cx4Q2GczpPCDpM 39Q8ct9Ghrqc7KrqxmfN70EhQp+yubsKgkFNapooH+KO6w9HWMJWeHeiBgCE9urWXj33 rv2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="YD/Je98w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q5-20020a17090311c500b001c3fa95ca18si19382975plh.333.2023.09.28.04.22.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 04:22:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="YD/Je98w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 621E382F7F91; Thu, 28 Sep 2023 04:07:06 -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 S232087AbjI1LGz (ORCPT + 99 others); Thu, 28 Sep 2023 07:06:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbjI1LF2 (ORCPT ); Thu, 28 Sep 2023 07:05:28 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 950CE10E4; Thu, 28 Sep 2023 04:04:55 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7C7CC43397; Thu, 28 Sep 2023 11:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695899095; bh=/4u38zrIHT4H4rJuHYzj6iHq3abwIxPz2pUOPVzS09Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YD/Je98wuNprpf4cjTZyE6IwYPCYAgDUCZErZqdHCK9qsBf+xBLe9ipZ+SohaJgCN OMHKKUxW4olBgdcqgc9EMhdhIT5opdTlNc1hMY71VDSwCiClUBHa31TUm+1/2H9W3W RdalLk8Ohtch1SJ3Fl/Vcoa8z7xFT+OkyNmvtQs5sZpehfO9dy18gkmaTw8CKzrkpg OJBx/t3D2wSl+qFmZJyzVG1SXChaPMGby9UE7QT2g44UEUidD3XtjBZxcf5sTCVaPH 675Z/LQRq9M/kLCgUfF6+Y0hD61H2D8snmTEd1xk7LtVSa315cdT0RiEE6st1Kdd+6 Hg6sIga529+3Q== From: Jeff Layton To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 36/87] fs/fat: convert to new inode {a,m}time accessors Date: Thu, 28 Sep 2023 07:02:45 -0400 Message-ID: <20230928110413.33032-35-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230928110413.33032-1-jlayton@kernel.org> References: <20230928110300.32891-1-jlayton@kernel.org> <20230928110413.33032-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]); Thu, 28 Sep 2023 04:07:06 -0700 (PDT) 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