Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2819673rdb; Wed, 4 Oct 2023 12:23:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IErUd1hVZPKcfCdQpRAgzqv1/fBiTObV0D6HK7iGkmZk4dVKRVJ30UAM9Thn/3g8GPGlIOx X-Received: by 2002:a05:6e02:b22:b0:351:9cc:8775 with SMTP id e2-20020a056e020b2200b0035109cc8775mr3819712ilu.5.1696447423277; Wed, 04 Oct 2023 12:23:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696447423; cv=none; d=google.com; s=arc-20160816; b=akJpypinj6q8SnBESMXM9FXTM3MuphiU9Sq98f+PCdUL2OZKVt73CiDhXvKdVAzxkb OO/AFjGtsXyj92PdtGxaDdjxWYe13QciQ7PAIAVuvfHwoNU3N+KUq1Ftu+EUKWBXPjmg +cHZtHoGRF4wn28BjYQfRdpZBKOlZMivIpVYwnflFGVYWP/X0JWl+l++5hggcEHsCKyX ci23tfOVyB6kKcTxQIAZ9IH6On2WX1bGBGtdk2YBezCsKl/sG1qdv33ANqMpXGl4xM3y 3ByfCPZyxrYgp5aaSbcIiKwTVmUwZfAdeuQHM1XBpqP1Y90ppk1iyDIrPssvcjKZs/ES xtDg== 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=RTEnheyFv9iDuEkvqBYnekqg0aEWjvVLUA/Jo1FQ4YI=; fh=/ddc8nBougnx9J9Jk+aiWj+G5DT4bYxfFV1UnmdJ16E=; b=GQy3iYOtO5tk5SeJ4uWTDk03Pjl/QBmdR+H5xpKKQOKDLR/M8rGBUbFunARxVOXx7P jQZjilgGQWj9ZtAmNXQRMt7fHDMcTzkB+hu5FeCuxBLjGSd1aFJ4IpAJ6a6mPxlk6Dpk Rx1sFa+EazMNax2Eh32pm0xdl8CcBWI4DAn+pb6zjNc+e6aRjBax4mPMnHv1ZrbmxGYi C3DdUVnS4YGrhWQSua5PO+Z31Zb6sSOhjQVY6kIrOH+Z/tTpvtbVpfFYg7oSrRRX6u8z Xcz+NPbvCoFRMrMzcsy1WtAU5kT9SwL2ENtsxMH112CI0jy2CgF+q3L4dlXtY8zQPyu8 HnSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=INItqUqa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id h11-20020a65480b000000b00577461b010fsi4121785pgs.685.2023.10.04.12.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 12:23:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=INItqUqa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 2E0748489E5F; Wed, 4 Oct 2023 12:23:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244900AbjJDS6B (ORCPT + 99 others); Wed, 4 Oct 2023 14:58:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244856AbjJDSzd (ORCPT ); Wed, 4 Oct 2023 14:55:33 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C5F91725; Wed, 4 Oct 2023 11:54:51 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D90DC433CC; Wed, 4 Oct 2023 18:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696445690; bh=vmHegbrB1oSokmePb7JoVPLdiAExigQLg7wn3ynfsJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=INItqUqaI27NvvvE5+f2tZOATG7etmaMQ+tvY1oJvHuuW4o8Y2c87saqn55UH9C6A l59gMO03/odl8au7XqZQiOVHe+bDbIn+ysKo01RdRJCpfFdoxXMr2SdUUramm+2B5j JyYL5mEpRvzVvSP8Qp2ViY3eozbrGuEvkbSBiKP8oQRRLXX2V7RubNokI/9gZ0GvpJ ES7lzuheQGCSyr73HqNRYcFJrpW00+J+RTlHzy9rQSsWGmmlXpPZIlclvIL3aOOMxR s0tSNH7enRmElEjPevyv4/bLnPvO2QWgNQ8domQBbkelfvDma3qkGiWUzWnojgJjeH RAx1HYi9WE9Yw== From: Jeff Layton To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Namjae Jeon , linux-ntfs-dev@lists.sourceforge.net Subject: [PATCH v2 54/89] ntfs: convert to new timestamp accessors Date: Wed, 4 Oct 2023 14:52:39 -0400 Message-ID: <20231004185347.80880-52-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 (howler.vger.email [0.0.0.0]); Wed, 04 Oct 2023 12:23:42 -0700 (PDT) Convert to using the new inode timestamp accessor functions. Signed-off-by: Jeff Layton --- fs/ntfs/inode.c | 25 +++++++++++++------------ fs/ntfs/mft.c | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 99ac6ea277c4..aba1e22db4e9 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c @@ -648,7 +648,7 @@ static int ntfs_read_locked_inode(struct inode *vi) * mtime is the last change of the data within the file. Not changed * when only metadata is changed, e.g. a rename doesn't affect mtime. */ - vi->i_mtime = ntfs2utc(si->last_data_change_time); + inode_set_mtime_to_ts(vi, ntfs2utc(si->last_data_change_time)); /* * ctime is the last change of the metadata of the file. This obviously * always changes, when mtime is changed. ctime can be changed on its @@ -659,7 +659,7 @@ static int ntfs_read_locked_inode(struct inode *vi) * Last access to the data within the file. Not changed during a rename * for example but changed whenever the file is written to. */ - vi->i_atime = ntfs2utc(si->last_access_time); + inode_set_atime_to_ts(vi, ntfs2utc(si->last_access_time)); /* Find the attribute list attribute if present. */ ntfs_attr_reinit_search_ctx(ctx); @@ -1217,9 +1217,9 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi) vi->i_uid = base_vi->i_uid; vi->i_gid = base_vi->i_gid; set_nlink(vi, base_vi->i_nlink); - vi->i_mtime = base_vi->i_mtime; + inode_set_mtime_to_ts(vi, inode_get_mtime(base_vi)); inode_set_ctime_to_ts(vi, inode_get_ctime(base_vi)); - vi->i_atime = base_vi->i_atime; + inode_set_atime_to_ts(vi, inode_get_atime(base_vi)); vi->i_generation = ni->seq_no = base_ni->seq_no; /* Set inode type to zero but preserve permissions. */ @@ -1483,9 +1483,9 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi) vi->i_uid = base_vi->i_uid; vi->i_gid = base_vi->i_gid; set_nlink(vi, base_vi->i_nlink); - vi->i_mtime = base_vi->i_mtime; + inode_set_mtime_to_ts(vi, inode_get_mtime(base_vi)); inode_set_ctime_to_ts(vi, inode_get_ctime(base_vi)); - vi->i_atime = base_vi->i_atime; + inode_set_atime_to_ts(vi, inode_get_atime(base_vi)); vi->i_generation = ni->seq_no = base_ni->seq_no; /* Set inode type to zero but preserve permissions. */ vi->i_mode = base_vi->i_mode & ~S_IFMT; @@ -2805,13 +2805,14 @@ int ntfs_truncate(struct inode *vi) if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) { struct timespec64 now = current_time(VFS_I(base_ni)); struct timespec64 ctime = inode_get_ctime(VFS_I(base_ni)); + struct timespec64 mtime = inode_get_mtime(VFS_I(base_ni)); int sync_it = 0; - if (!timespec64_equal(&VFS_I(base_ni)->i_mtime, &now) || + if (!timespec64_equal(&mtime, &now) || !timespec64_equal(&ctime, &now)) sync_it = 1; inode_set_ctime_to_ts(VFS_I(base_ni), now); - VFS_I(base_ni)->i_mtime = now; + inode_set_mtime_to_ts(VFS_I(base_ni), now); if (sync_it) mark_inode_dirty_sync(VFS_I(base_ni)); @@ -2925,9 +2926,9 @@ int ntfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry, } } if (ia_valid & ATTR_ATIME) - vi->i_atime = attr->ia_atime; + inode_set_atime_to_ts(vi, attr->ia_atime); if (ia_valid & ATTR_MTIME) - vi->i_mtime = attr->ia_mtime; + inode_set_mtime_to_ts(vi, attr->ia_mtime); if (ia_valid & ATTR_CTIME) inode_set_ctime_to_ts(vi, attr->ia_ctime); mark_inode_dirty(vi); @@ -2996,7 +2997,7 @@ int __ntfs_write_inode(struct inode *vi, int sync) si = (STANDARD_INFORMATION*)((u8*)ctx->attr + le16_to_cpu(ctx->attr->data.resident.value_offset)); /* Update the access times if they have changed. */ - nt = utc2ntfs(vi->i_mtime); + nt = utc2ntfs(inode_get_mtime(vi)); if (si->last_data_change_time != nt) { ntfs_debug("Updating mtime for inode 0x%lx: old = 0x%llx, " "new = 0x%llx", vi->i_ino, (long long) @@ -3014,7 +3015,7 @@ int __ntfs_write_inode(struct inode *vi, int sync) si->last_mft_change_time = nt; modified = true; } - nt = utc2ntfs(vi->i_atime); + nt = utc2ntfs(inode_get_atime(vi)); if (si->last_access_time != nt) { ntfs_debug("Updating atime for inode 0x%lx: old = 0x%llx, " "new = 0x%llx", vi->i_ino, diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index ad1a8f72da22..6fd1dc4b08c8 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c @@ -2682,7 +2682,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, const int mode, vi->i_mode &= ~S_IWUGO; /* Set the inode times to the current time. */ - vi->i_atime = vi->i_mtime = inode_set_ctime_current(vi); + simple_inode_init_ts(vi); /* * Set the file size to 0, the ntfs inode sizes are set to 0 by * the call to ntfs_init_big_inode() below. -- 2.41.0