linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: relatime update - Match comment with behavior
@ 2019-06-11  5:45 Aurelien Thierry
  2019-06-18  1:12 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Aurelien Thierry @ 2019-06-11  5:45 UTC (permalink / raw)
  To: Alexander Viro; +Cc: Aurelien Thierry, linux-fsdevel, trivial

2 comments right before code wrongly state that if (c|m)time is younger
than atime, then atime is updated (behavior is the other way around).

Fix aligns comments with actual behavior, function description and
documentation (man mount).

Signed-off-by: Aurelien Thierry <aurelien.thierry@quoscient.io>
---
 fs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index df6542ec3b88..1e5489288aa9 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1620,12 +1620,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 atime earlier than mtime? 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 atime earlier than ctime? If yes, update atime:
 	 */
 	if (timespec64_compare(&inode->i_ctime, &inode->i_atime) >= 0)
 		return 1;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs: relatime update - Match comment with behavior
  2019-06-11  5:45 [PATCH] fs: relatime update - Match comment with behavior Aurelien Thierry
@ 2019-06-18  1:12 ` Al Viro
  2019-06-18 11:43   ` Aurelien Thierry
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2019-06-18  1:12 UTC (permalink / raw)
  To: Aurelien Thierry; +Cc: linux-fsdevel, trivial

On Tue, Jun 11, 2019 at 07:45:40AM +0200, Aurelien Thierry wrote:
> 2 comments right before code wrongly state that if (c|m)time is younger
> than atime, then atime is updated (behavior is the other way around).
> 
> Fix aligns comments with actual behavior, function description and
> documentation (man mount).

Huh?  "mtime is younger than atime" means that mtime refers to the moment
later than that refered to by atime, i.e that atime refers to the moment
earlier than that refered to by mtime.  What is the problem you are trying
to fix?

Both the original and changed comments mean exact same thing.  And yes,
the changed comment does match the actual behaviour.  Just as the original
one does...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs: relatime update - Match comment with behavior
  2019-06-18  1:12 ` Al Viro
@ 2019-06-18 11:43   ` Aurelien Thierry
  0 siblings, 0 replies; 3+ messages in thread
From: Aurelien Thierry @ 2019-06-18 11:43 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, trivial

You are right.

As atime and mtime are timestamps and not "live" objects, I understood 
their age as being the actual timestamp and thus I understood "mtime is
younger than atime" the other way around.

So this can be a fix for better clarity ("earlier" is used in other
places rather than "younger") but the current comments are not wrong.


On 6/18/19 3:12 AM, Al Viro wrote:
> On Tue, Jun 11, 2019 at 07:45:40AM +0200, Aurelien Thierry wrote:
>> 2 comments right before code wrongly state that if (c|m)time is younger
>> than atime, then atime is updated (behavior is the other way around).
>>
>> Fix aligns comments with actual behavior, function description and
>> documentation (man mount).
> 
> Huh?  "mtime is younger than atime" means that mtime refers to the moment
> later than that refered to by atime, i.e that atime refers to the moment
> earlier than that refered to by mtime.  What is the problem you are trying
> to fix?
> 
> Both the original and changed comments mean exact same thing.  And yes,
> the changed comment does match the actual behaviour.  Just as the original
> one does...
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-18 11:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11  5:45 [PATCH] fs: relatime update - Match comment with behavior Aurelien Thierry
2019-06-18  1:12 ` Al Viro
2019-06-18 11:43   ` Aurelien Thierry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).