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: 158981 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp661058vqb; Fri, 27 Oct 2023 07:52:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3M+IhwsVITGMO8A/6cU2ZYMAY3GrPQ8inR2iQCTq6mvbHC0ZxxkWq0h6lrjAMO3hZishR X-Received: by 2002:a05:6358:2809:b0:168:ebd0:d4a5 with SMTP id k9-20020a056358280900b00168ebd0d4a5mr3540197rwb.24.1698418331052; Fri, 27 Oct 2023 07:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698418331; cv=none; d=google.com; s=arc-20160816; b=RILM0D9zMsNMl2FfFywPyfgFqRBVdtpXzjrD2JnzHb1IFZd2iWGhvYE5awlH8p9pwX SxGMJ5w2raVroSTuSLwBsj6VPkGCNhbVRQA9U5g3IfJeefisor/ARo89OcPXwlgIGXc6 T4MWcrQmEFpzET32C9joIHugonn1XJqNcmp3hl6WA6MEnqs8JLym73Haem+c9XtylG4g tVN8u2AhAjIhX47NkhtOvzVNntVKrapjd796YEcl1PP//TE08I9GGnF5+wHtLXt5lTfT COjJxB5sDHzjCtB+tTRF8s6n63YM0TbOwxHKXI6HQl17AQiPzGrOCfNrnJlzoZPKZkwY R5eQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Hem40OGyBgXM3If9diVX3pLcSRGckKGB6+V5Xkr+edw=; fh=qDZ+YnS9HJbCVOaeWFr2FnYZt7eE+vt5IJIDIlhBdxU=; b=Ug23dpv2fmWPYZHQLjJ0ixOR+CvYd4bpOEPc7lDUcUI/8AFAK853H+HK5NgbvZjmOt soFbjAqh/qhtB92eHygqlZrG+rqxR1eIyJEMQMpdbJ4rG21gXu7MLWj3qKoDWpSle5sT chMG0hp33nSDM5psxD/HLHUtziLATYjYwhudSNrdwZ6xuYZW43NKiQNt0+wj7F5xdeEr QJX3xiuIn8K3xiiprqY60UKLEDRp5R9s6bs9fXG2/y1IaBjb/OexqjdMn1rMNmZpsV1n TKmg6xaiS991MViq0l77wTD+6Y+hRXAkuHGDulTBMIu0a/Sw6jKGw2l8QFbi3M5cUZQv wD/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OxMKHBk9; 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id m7-20020a817107000000b005772709637esi2520787ywc.179.2023.10.27.07.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 07:52:11 -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=OxMKHBk9; 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 9A53E82ECB31; Fri, 27 Oct 2023 07:51:50 -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 S1345833AbjJ0Ovn (ORCPT + 25 others); Fri, 27 Oct 2023 10:51:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345974AbjJ0Ovl (ORCPT ); Fri, 27 Oct 2023 10:51:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED570E3 for ; Fri, 27 Oct 2023 07:51:37 -0700 (PDT) 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 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 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]); Fri, 27 Oct 2023 07:51:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780920699967261356 X-GMAIL-MSGID: 1780920699967261356 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;