Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2805312rdb; Wed, 4 Oct 2023 11:58:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IErRxDtKur11UxrZwiThg8/wnQEgC11SRHDlZY5CyDG6ykxEzVNp/nU6d2m5SzvCzPZU7vG X-Received: by 2002:a17:902:d382:b0:1c5:ed6e:2534 with SMTP id e2-20020a170902d38200b001c5ed6e2534mr3059056pld.26.1696445903954; Wed, 04 Oct 2023 11:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696445903; cv=none; d=google.com; s=arc-20160816; b=T9IeWeSBbL/anBvnshxK037WTowPR+YUkwg20p17oX/Gy5mWGPKwyeS8B160ES7YeH Pn+mAnpJItK2Ji0F/dez4SbTpYC8PqW4FhrXZ4/5rxufSdcb477TPTK3iYWNg2KKWwej s+LkXt5D3YKgFQf1M5hLgTB4dWANIldHUeTflvWTa5fPYUYRMELD90Fcr7nxZGKaIiLO AjA4Fr9PSnFSeFL3QmU0Sql/QLHf0Dcr/tVUiLX5jR+Gn1UACJFZ4uvCHTtlgtF1WYGz nzthzC6sCDavAzYuo1e4MNn5dbRIHsfllesuwRm0otRVvBe/RiaWv1pX07v5e0lh9AX0 Y3dA== 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=8SA1J+pSRD9omwdMaL7l+I3Jh6EChsmrr1FwyJ4+egw=; fh=c1hve9LK7bidUltaxotdOOkNtWZ8Drk/KOyPdUWU/OI=; b=ExStkDNoUXUmdTbge2HgPV5HLmevYXgHTjyMUDxy/wUgUBzgeNfC+1LZPEoKObaCaD 0anTWFMz3egjtkLZrPYXjyFnaikI7JULbwyy0tUEo7C1nvpmqlW3W+itAZ53zFitlXDQ 5aLIwLlUZOOW3oLcJ8PbEikt4plPJ2zO3u3fLnxvxKxJdFeAyjhhUef9wMCQbWTtpJs+ dg28xaoMmFLqjj5HxFCZ5ck9zHWvRcl/NWKrs83KINwegbtMo6eyrU4Pd4SxyEDFH2mI MWeoW7vd89/zq+7KW0letUptZwbOoZfhgcGZ967xp/KxxI7NxTKm6kli2HsDQ72maOr3 yEzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AeoFQ1nO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id q5-20020a17090311c500b001bc52116351si4546612plh.70.2023.10.04.11.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 11:58:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AeoFQ1nO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 50D31807FD54; Wed, 4 Oct 2023 11:57:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245103AbjJDS4c (ORCPT + 99 others); Wed, 4 Oct 2023 14:56:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244821AbjJDSyr (ORCPT ); Wed, 4 Oct 2023 14:54:47 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77494192; Wed, 4 Oct 2023 11:54:24 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7637DC433C8; Wed, 4 Oct 2023 18:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696445663; bh=PdvRjpk7Uq2h9jWOsaIRpYPti7242OhJxoh6M5gZNDo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AeoFQ1nOYMJMiJwItTy8f1vsdT50nfGsKewjXG2dMxuRNEL2X+JnZX+0RTeuJS73C 8ZGVh8s4aXdKTRO6CiM8WUIwugiVBH/MEkPrzQ4x7bZPeX55ijUlG6PFMXMNH3GzpN p0VxNsewQXNkUhe1cb8Glh4C6did42Usd8ovfP6NLa3v4F2mRKEs6qMF/qlSS1D4Qx B9xsVTMR6v3P2/biD576G49USFvRj3JHBiCAbCDrAHSiCT+2xEgBU5/nUmLWCHeSUN n/Wyf7ja8Th97TrLvUJEQimtJtiNTRTOXm1+lZtyrtFKvVh78jcaBQxCH3BV61sS5M 1DOOVv73uMZWQ== From: Jeff Layton To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 33/89] exfat: convert to new timestamp accessors Date: Wed, 4 Oct 2023 14:52:18 -0400 Message-ID: <20231004185347.80880-31-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=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Wed, 04 Oct 2023 11:57:51 -0700 (PDT) X-Spam-Level: ** Convert to using the new inode timestamp accessor functions. Signed-off-by: Jeff Layton --- fs/exfat/exfat_fs.h | 1 + fs/exfat/file.c | 7 +++---- fs/exfat/inode.c | 31 +++++++++++++++++-------------- fs/exfat/misc.c | 8 ++++++++ fs/exfat/namei.c | 31 ++++++++++++++++--------------- fs/exfat/super.c | 4 ++-- 6 files changed, 47 insertions(+), 35 deletions(-) diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index 219b1cf9d041..b4d3f791a2e0 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -557,6 +557,7 @@ void __exfat_fs_error(struct super_block *sb, int report, const char *fmt, ...) void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, u8 tz, __le16 time, __le16 date, u8 time_cs); void exfat_truncate_atime(struct timespec64 *ts); +void exfat_truncate_inode_atime(struct inode *inode); void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, u8 *tz, __le16 *time, __le16 *date, u8 *time_cs); u16 exfat_calc_chksum16(void *data, int len, u16 chksum, int type); diff --git a/fs/exfat/file.c b/fs/exfat/file.c index f47620eef71b..2a4ec907e42f 100644 --- a/fs/exfat/file.c +++ b/fs/exfat/file.c @@ -24,7 +24,7 @@ static int exfat_cont_expand(struct inode *inode, loff_t size) if (err) return err; - inode->i_mtime = inode_set_ctime_current(inode); + inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); mark_inode_dirty(inode); if (!IS_SYNC(inode)) @@ -292,10 +292,9 @@ int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry, } if (attr->ia_valid & ATTR_SIZE) - inode->i_mtime = inode_set_ctime_current(inode); + inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); - setattr_copy(&nop_mnt_idmap, inode, attr); - exfat_truncate_atime(&inode->i_atime); + exfat_truncate_inode_atime(inode); if (attr->ia_valid & ATTR_SIZE) { error = exfat_block_truncate_page(inode, attr->ia_size); diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index 13329baeafbc..a2185e6f0548 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -26,6 +26,7 @@ int __exfat_write_inode(struct inode *inode, int sync) struct exfat_sb_info *sbi = EXFAT_SB(sb); struct exfat_inode_info *ei = EXFAT_I(inode); bool is_dir = (ei->type == TYPE_DIR) ? true : false; + struct timespec64 ts; if (inode->i_ino == EXFAT_ROOT_INO) return 0; @@ -55,16 +56,18 @@ int __exfat_write_inode(struct inode *inode, int sync) &ep->dentry.file.create_time, &ep->dentry.file.create_date, &ep->dentry.file.create_time_cs); - exfat_set_entry_time(sbi, &inode->i_mtime, - &ep->dentry.file.modify_tz, - &ep->dentry.file.modify_time, - &ep->dentry.file.modify_date, - &ep->dentry.file.modify_time_cs); - exfat_set_entry_time(sbi, &inode->i_atime, - &ep->dentry.file.access_tz, - &ep->dentry.file.access_time, - &ep->dentry.file.access_date, - NULL); + exfat_set_entry_time(sbi, &ts, + &ep->dentry.file.modify_tz, + &ep->dentry.file.modify_time, + &ep->dentry.file.modify_date, + &ep->dentry.file.modify_time_cs); + inode_set_mtime_to_ts(inode, ts); + exfat_set_entry_time(sbi, &ts, + &ep->dentry.file.access_tz, + &ep->dentry.file.access_time, + &ep->dentry.file.access_date, + NULL); + inode_set_atime_to_ts(inode, ts); /* File size should be zero if there is no cluster allocated */ on_disk_size = i_size_read(inode); @@ -355,7 +358,7 @@ static void exfat_write_failed(struct address_space *mapping, loff_t to) if (to > i_size_read(inode)) { truncate_pagecache(inode, i_size_read(inode)); - inode->i_mtime = inode_set_ctime_current(inode); + inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); exfat_truncate(inode); } } @@ -398,7 +401,7 @@ static int exfat_write_end(struct file *file, struct address_space *mapping, exfat_write_failed(mapping, pos+len); if (!(err < 0) && !(ei->attr & ATTR_ARCHIVE)) { - inode->i_mtime = inode_set_ctime_current(inode); + inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); ei->attr |= ATTR_ARCHIVE; mark_inode_dirty(inode); } @@ -576,10 +579,10 @@ static int exfat_fill_inode(struct inode *inode, struct exfat_dir_entry *info) exfat_save_attr(inode, info->attr); inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9; - inode->i_mtime = info->mtime; + inode_set_mtime_to_ts(inode, info->mtime); inode_set_ctime_to_ts(inode, info->mtime); ei->i_crtime = info->crtime; - inode->i_atime = info->atime; + inode_set_atime_to_ts(inode, info->atime); return 0; } diff --git a/fs/exfat/misc.c b/fs/exfat/misc.c index 2e1a1a6b1021..fa8459828046 100644 --- a/fs/exfat/misc.c +++ b/fs/exfat/misc.c @@ -126,6 +126,14 @@ void exfat_truncate_atime(struct timespec64 *ts) ts->tv_nsec = 0; } +void exfat_truncate_inode_atime(struct inode *inode) +{ + struct timespec64 atime = inode_get_atime(inode); + + exfat_truncate_atime(&atime); + inode_set_atime_to_ts(inode, atime); +} + u16 exfat_calc_chksum16(void *data, int len, u16 chksum, int type) { int i; diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 1e1ffda279cf..59600cc251ba 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -583,7 +583,7 @@ static int exfat_create(struct mnt_idmap *idmap, struct inode *dir, goto unlock; inode_inc_iversion(dir); - dir->i_mtime = inode_set_ctime_current(dir); + inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir)); if (IS_DIRSYNC(dir)) exfat_sync_inode(dir); else @@ -596,8 +596,9 @@ static int exfat_create(struct mnt_idmap *idmap, struct inode *dir, goto unlock; inode_inc_iversion(inode); - inode->i_mtime = inode->i_atime = EXFAT_I(inode)->i_crtime = inode_set_ctime_current(inode); - exfat_truncate_atime(&inode->i_atime); + EXFAT_I(inode)->i_crtime = simple_inode_init_ts(inode); + exfat_truncate_inode_atime(inode); + /* timestamp is already written, so mark_inode_dirty() is unneeded. */ d_instantiate(dentry, inode); @@ -830,16 +831,16 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry) ei->dir.dir = DIR_DELETED; inode_inc_iversion(dir); - dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir); - exfat_truncate_atime(&dir->i_atime); + simple_inode_init_ts(dir); + exfat_truncate_inode_atime(dir); if (IS_DIRSYNC(dir)) exfat_sync_inode(dir); else mark_inode_dirty(dir); clear_nlink(inode); - inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); - exfat_truncate_atime(&inode->i_atime); + simple_inode_init_ts(inode); + exfat_truncate_inode_atime(inode); exfat_unhash_inode(inode); exfat_d_version_set(dentry, inode_query_iversion(dir)); unlock: @@ -865,7 +866,7 @@ static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir, goto unlock; inode_inc_iversion(dir); - dir->i_mtime = inode_set_ctime_current(dir); + inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir)); if (IS_DIRSYNC(dir)) exfat_sync_inode(dir); else @@ -879,8 +880,8 @@ static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir, goto unlock; inode_inc_iversion(inode); - inode->i_mtime = inode->i_atime = EXFAT_I(inode)->i_crtime = inode_set_ctime_current(inode); - exfat_truncate_atime(&inode->i_atime); + EXFAT_I(inode)->i_crtime = simple_inode_init_ts(inode); + exfat_truncate_inode_atime(inode); /* timestamp is already written, so mark_inode_dirty() is unneeded. */ d_instantiate(dentry, inode); @@ -994,8 +995,8 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) ei->dir.dir = DIR_DELETED; inode_inc_iversion(dir); - dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir); - exfat_truncate_atime(&dir->i_atime); + simple_inode_init_ts(dir); + exfat_truncate_inode_atime(dir); if (IS_DIRSYNC(dir)) exfat_sync_inode(dir); else @@ -1003,8 +1004,8 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) drop_nlink(dir); clear_nlink(inode); - inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); - exfat_truncate_atime(&inode->i_atime); + simple_inode_init_ts(inode); + exfat_truncate_inode_atime(inode); exfat_unhash_inode(inode); exfat_d_version_set(dentry, inode_query_iversion(dir)); unlock: @@ -1330,7 +1331,7 @@ static int exfat_rename(struct mnt_idmap *idmap, inode_inc_iversion(new_dir); simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); EXFAT_I(new_dir)->i_crtime = current_time(new_dir); - exfat_truncate_atime(&new_dir->i_atime); + exfat_truncate_inode_atime(new_dir); if (IS_DIRSYNC(new_dir)) exfat_sync_inode(new_dir); else diff --git a/fs/exfat/super.c b/fs/exfat/super.c index 17100b13dcdc..17d35107b850 100644 --- a/fs/exfat/super.c +++ b/fs/exfat/super.c @@ -377,8 +377,8 @@ static int exfat_read_root(struct inode *inode) ei->i_size_ondisk = i_size_read(inode); exfat_save_attr(inode, ATTR_SUBDIR); - inode->i_mtime = inode->i_atime = ei->i_crtime = inode_set_ctime_current(inode); - exfat_truncate_atime(&inode->i_atime); + ei->i_crtime = simple_inode_init_ts(inode); + exfat_truncate_inode_atime(inode); return 0; } -- 2.41.0