From patchwork Fri Oct 27 14:51:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13438615 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0907620307 for ; Fri, 27 Oct 2023 14:51:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OxMKHBk9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BE3AC433C7; Fri, 27 Oct 2023 14:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698418297; bh=blKWZpijBMf809KyFafStEDUjjEYN8wRceKFOG5/Pgg=; h=From:To:Cc:Subject:Date:From; b=OxMKHBk922gShjrR0C24JZVtA7dwF9IZ7tGxCknJ4gItDy1Km+LLxggZwXk4LhxMz Qn5lz6rf8NOhi8OB0MkqX/fPUxXppvEltXOtW4q/7AN4faXbS9lrviXaxwH/o0rBwz /Omdhg5VpDrKIh9gFMNOccVuS4c65iYg5IbtUM88YVqPW5X3o1UXcQX3bJafDrH2gU s5S5V+17jN6FAjHu3fzvDozCygNhvltuwXJY+cnp5Lk0EImaFOsvL8YbHGdlVl2fE2 Okm1xj5E91JUPVQ6C0UszM89ySVBcERhrx7Rw1h1St66H3yLXFZa/H6NV2+JXFjJ46 gS800gk8IhjpQ== From: Christian Brauner To: Linus Torvalds Cc: Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [GIT PULL for v6.7] vfs time updates Date: Fri, 27 Oct 2023 16:51:07 +0200 Message-Id: <20231027-vfs-ctime-6271b23ced64@brauner> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=20511; i=brauner@kernel.org; h=from:subject:message-id; bh=Fs7WU5tqmLwWm02taffXgfp/RJWw0Nb3QlIfcLwcuok=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaRan004eb16S/H0mxrMLCm31zwS23+zvkZ8X5FuzsSm3dfn GUYs6ShlYRDjYpAVU2RxaDcJl1vOU7HZKFMDZg4rE8gQBi5OAZjItzcM/52Xuf9Xtzvw+A3/czb5FW +m3m7xMLC5eMcvb41i8q3PLhcYGY5a9rOyds754a/wOzxvjwHXVcGla11X8mjvP69WO7XHjhkA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Hey Linus, This pull request will have a merge conflict with the vfs-6.7.super pr that will be available under the following link once sent: https://lore.kernel.org/r/20231027-vfs-super-aa4b9ecfd803@brauner /* Summary */ This finishes the conversion of all inode time fields to accessor functions as discussed on list. Changing timestamps manually as we used to do before is error prone. Using accessors function makes this robust. It does not contain the switch of the time fields to discrete 64 bit integers to replace struct timespec and free up space in struct inode. But after this, the switch can be trivially made and the patch should only affect the vfs if we decide to do it. /* Testing */ clang: Debian clang version 16.0.6 (16) gcc: gcc (Debian 13.2.0-5) 13.2.0 All patches are based on v6.6-rc5 and have been sitting in linux-next. No build failures or warnings were observed. xfstests were run for the major filesystems. They pass. /* Conflicts */ ## Merge Conflicts with other trees The following trees will have a merge conflict with this tree. [1] linux-next: manual merge of the vfs-brauner tree with the ntfs3 tree https://lore.kernel.org/r/20231010103744.2e7085a6@canb.auug.org.au [2] linux-next: manual merge of the vfs-brauner tree with the ext3 tree https://lore.kernel.org/r/20231027104356.3fda2bc9@canb.auug.org.au [3] This will have a merge conflict with the btrfs and vfs.super trees. The vfs.super tree does contain the btrfs tree this cycle and the conflict resolution will be provided on the vfs-6.7.super pr as mentioned above. [4] For bcachefs a whole separate patch would be needed: >From 7aaefe3c8d4eda19519235c7a575d964120e31a5 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Sat, 30 Sep 2023 08:41:01 -0400 Subject: [PATCH] bcachefs: convert to new timestamp accessors Convert to using the new inode timestamp accessor functions. Signed-off-by: Jeff Layton --- fs/bcachefs/fs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 09137a20449b..1fbaad27d07b 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -66,9 +66,9 @@ void bch2_inode_update_after_write(struct btree_trans *trans, inode->v.i_mode = bi->bi_mode; if (fields & ATTR_ATIME) - inode->v.i_atime = bch2_time_to_timespec(c, bi->bi_atime); + inode_set_atime_to_ts(&inode->v, bch2_time_to_timespec(c, bi->bi_atime)); if (fields & ATTR_MTIME) - inode->v.i_mtime = bch2_time_to_timespec(c, bi->bi_mtime); + inode_set_mtime_to_ts(&inode->v, bch2_time_to_timespec(c, bi->bi_mtime)); if (fields & ATTR_CTIME) inode_set_ctime_to_ts(&inode->v, bch2_time_to_timespec(c, bi->bi_ctime)); @@ -753,8 +753,8 @@ static int bch2_getattr(struct mnt_idmap *idmap, stat->gid = inode->v.i_gid; stat->rdev = inode->v.i_rdev; stat->size = i_size_read(&inode->v); - stat->atime = inode->v.i_atime; - stat->mtime = inode->v.i_mtime; + stat->atime = inode_get_atime(&inode->v); + stat->mtime = inode_get_mtime(&inode->v); stat->ctime = inode_get_ctime(&inode->v); stat->blksize = block_bytes(c); stat->blocks = inode->v.i_blocks; @@ -1418,8 +1418,8 @@ static int inode_update_times_fn(struct btree_trans *trans, { struct bch_fs *c = inode->v.i_sb->s_fs_info; - bi->bi_atime = timespec_to_bch2_time(c, inode->v.i_atime); - bi->bi_mtime = timespec_to_bch2_time(c, inode->v.i_mtime); + bi->bi_atime = timespec_to_bch2_time(c, inode_get_atime(&inode->v)); + bi->bi_mtime = timespec_to_bch2_time(c, inode_get_mtime(&inode->v)); bi->bi_ctime = timespec_to_bch2_time(c, inode_get_ctime(&inode->v)); return 0;