From patchwork Sat Mar 25 08:22:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Kitt X-Patchwork-Id: 74878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp338512vqo; Sat, 25 Mar 2023 04:11:43 -0700 (PDT) X-Google-Smtp-Source: AKy350YhnzFbTuI6thYHMpXwKXWrRxx47jSSGWUM3X/KbtqCY+oQbAmneS/K5EH5WgGGDEHLWN3I X-Received: by 2002:aa7:dcd9:0:b0:501:ea9b:ef53 with SMTP id w25-20020aa7dcd9000000b00501ea9bef53mr6604297edu.28.1679742703345; Sat, 25 Mar 2023 04:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679742703; cv=none; d=google.com; s=arc-20160816; b=tt2NaGU19GGDV9i2ujhk5NOMBI+YAz0gGMMX/aGFmNLrvcHPU3gxLiclxHhaKFwp+R fa/YOaYN54Ibai2GufZMnH1ksXL5CCbjkLRpJriq7Vs4ZhXLX4bai26HtCMe6HKuua0L IsyxAM0V+rlMKk8htD9+hV/QKvwY8ypfsD5pk8AcZwE7ldyjEe5RHstX11MpirchH7gz zqVi2Jc/PCLUGGPSPF3lpiztRIWmPXceltTTzJtqMGv+L6Jb0yrP3wZfWErc6FKq9G+j 8X2gliyY4LifcRZCKA/ot/RSeBrPSQ8GPKVriO15uDugYM+nD1nDLVfIOnD7gbzNXGWJ zPjQ== 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; bh=mMP0we3Dw+OJzUj1dPTGBuF/qzaFGlBGYbx2Y4awqxk=; b=oQY5l6RvsBghx+bJLPiDgtBdz5Iup6S3wxvz2HDSm2Pzrr7H+WJIXlMwN85+jEJ0p4 2KWfBfYGzVRHa2NVyo32x4+b7Ub1WeSPi9PDshreHDs3i7omDZLfTXIul2vQspT8NwcJ 9W873r4lUHaBuxahFgAVFcdBjibupT9JHh6Ox34Fdd26XnfkJ9W9E+qcxVuqVOhowh61 5BDts4Gk61irPHyIrRuTmd/TiYKfnlAliNkPXUeWSZql4Df+WPcKybj64eVqXxnoF65F NOZQq1mcjixL003/SMgL8S0RY2tjfgLYYth9ABgQ6RA/fMGtpM32cAGI18aYdwNDwutu Qjnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a05640214ca00b0050224191caesi3954501edx.277.2023.03.25.04.11.20; Sat, 25 Mar 2023 04:11:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230062AbjCYJA1 (ORCPT + 99 others); Sat, 25 Mar 2023 05:00:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjCYJAY (ORCPT ); Sat, 25 Mar 2023 05:00:24 -0400 Received: from 13.mo582.mail-out.ovh.net (13.mo582.mail-out.ovh.net [188.165.56.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09FC5EC4C for ; Sat, 25 Mar 2023 02:00:22 -0700 (PDT) Received: from director6.ghost.mail-out.ovh.net (unknown [10.108.16.43]) by mo582.mail-out.ovh.net (Postfix) with ESMTP id 8848E24899 for ; Sat, 25 Mar 2023 08:22:58 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-b5mzw (unknown [10.110.115.83]) by director6.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 399FD1FDB8; Sat, 25 Mar 2023 08:22:58 +0000 (UTC) Received: from sk2.org ([37.59.142.95]) by ghost-submission-6684bf9d7b-b5mzw with ESMTPSA id Hx90CGKvHmROLgAAPonFnQ (envelope-from ); Sat, 25 Mar 2023 08:22:58 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-95G001979e6abd-a82b-49ba-b0fa-720b54dd7305, 745B6840FAD6CF9A1C2D0979EF8FEE52BEA9C661) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Alexander Viro , Christian Brauner Cc: Stephen Kitt , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Update relatime comments to include equality Date: Sat, 25 Mar 2023 09:22:32 +0100 Message-Id: <20230325082232.2017437-1-steve@sk2.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Ovh-Tracer-Id: 12637663506040260315 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegjedguddvtdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeduveevffdvgfelvdfgkeevfeevvdehueeuvdegjedugfeguefhgfdvtdeivedvieenucffohhmrghinhepshhtrggtkhgvgigthhgrnhhgvgdrtghomhenucfkphepuddvjedrtddrtddruddpfeejrdehledrudegvddrleehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeoshhtvghvvgesshhkvddrohhrgheqpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehkedvpdhmohguvgepshhmthhpohhuth X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761337884743856144?= X-GMAIL-MSGID: =?utf-8?q?1761337884743856144?= relatime also updates atime if the previous atime is equal to one or both of the ctime and mtime; a non-strict interpretation of "earlier than" and "younger than" in the comments allows this, but for clarity, this makes it explicit. Pointed out by "epiii2" and "ctrl-alt-delor" in https://unix.stackexchange.com/q/740862/86440. Signed-off-by: Stephen Kitt --- fs/inode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) base-commit: 65aca32efdcb0965502d3db2f1fa33838c070952 diff --git a/fs/inode.c b/fs/inode.c index 4558dc2f1355..3ec5a8f7b644 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1804,8 +1804,8 @@ EXPORT_SYMBOL(bmap); /* * With relative atime, only update atime if the previous atime is - * earlier than either the ctime or mtime or if at least a day has - * passed since the last atime update. + * earlier than or equal to either the ctime or mtime, + * or if at least a day has passed since the last atime update. */ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, struct timespec64 now) @@ -1814,12 +1814,12 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, if (!(mnt->mnt_flags & MNT_RELATIME)) return 1; /* - * Is mtime younger than atime? If yes, update atime: + * Is mtime younger than or equal to atime? If yes, update atime: */ if (timespec64_compare(&inode->i_mtime, &inode->i_atime) >= 0) return 1; /* - * Is ctime younger than atime? If yes, update atime: + * Is ctime younger than or equal to atime? If yes, update atime: */ if (timespec64_compare(&inode->i_ctime, &inode->i_atime) >= 0) return 1;