All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Ulrich Weigand <weigand@i1.informatik.uni-erlangen.de>
Cc: gcc@gcc.gnu.org, linux-kernel@vger.kernel.org, schwidefsky@de.ibm.com
Subject: Re: Linux 2.6 nanosecond time stamp weirdness breaks GCC build
Date: Thu, 1 Apr 2004 22:09:57 +0200	[thread overview]
Message-ID: <20040401220957.5f4f9ad2.ak@suse.de> (raw)
In-Reply-To: <200404011928.VAA23657@faui1d.informatik.uni-erlangen.de>

On Thu, 1 Apr 2004 21:28:20 +0200 (CEST)
Ulrich Weigand <weigand@i1.informatik.uni-erlangen.de> wrote:

> However, I'd say that this should probably be fixed in the kernel,
> e.g. by not reporting high-precision time stamps in the first
> place if the file system cannot store them ...

Interesting. We discussed the case as a theoretical possibility when
the patch was merged, but it seemed to unlikely to make it worth
complicating the first version.

The solution from back then I actually liked best was to just round
up to the next second instead of rounding down when going from 1s 
resolution to ns.

-Andi

e.g. like this for ext3 (untested). Does that fix your problem?

diff -u linux-2.6.5rc3-work/fs/ext3/inode.c-o linux-2.6.5rc3-work/fs/ext3/inode.c
--- linux-2.6.5rc3-work/fs/ext3/inode.c-o	2004-04-01 22:07:43.000000000 +0200
+++ linux-2.6.5rc3-work/fs/ext3/inode.c	2004-04-01 22:08:49.000000000 +0200
@@ -2624,9 +2624,11 @@
 	}
 	raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
 	raw_inode->i_size = cpu_to_le32(ei->i_disksize);
-	raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
-	raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
-	raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
+	/* round up because we cannot store nanoseconds. This avoids
+	   the time jumping back when the inode is loaded again. */
+	raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec + 1);
+	raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec + 1);
+	raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec + 1);
 	raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
 	raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
 	raw_inode->i_flags = cpu_to_le32(ei->i_flags);



  reply	other threads:[~2004-04-01 20:09 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-01 19:28 Linux 2.6 nanosecond time stamp weirdness breaks GCC build Ulrich Weigand
2004-04-01 20:09 ` Andi Kleen [this message]
2004-04-01 20:39   ` Daniel Jacobowitz
2004-04-01 20:46     ` Andi Kleen
2004-04-01 21:01       ` Ulrich Weigand
2004-04-01 21:44         ` Andi Kleen
2004-04-01 22:39     ` Joe Buck
2004-04-01 22:44       ` Paul Jarc
2004-04-01 22:48       ` Ulrich Weigand
2004-04-01 23:58         ` Joe Buck
2004-04-02  0:13           ` Daniel Jacobowitz
2004-04-02  0:02   ` Jamie Lokier
2004-04-02  0:35   ` Paul Eggert
2004-04-02  1:14     ` Jamie Lokier
2004-04-02  7:57       ` James H. Cloos Jr.
2004-04-02  9:22       ` Paul Eggert
2004-04-02 16:23         ` Jamie Lokier
2004-04-02 20:45           ` Paul Eggert
2004-04-02 21:07             ` Jamie Lokier
2004-04-02 21:56               ` Paul Eggert
2004-04-03  4:59       ` Andrew Pimlott
2004-04-02  0:37   ` Andrew Morton
2004-06-07 16:03     ` Jörn Engel
2004-04-01 21:13 ` Janis Johnson
2004-04-01 21:41   ` Ulrich Weigand
2004-04-02  0:30   ` Alan Modra
2004-04-02  9:05 ` P
2004-04-02 17:27 ` Alexandre Oliva
  -- strict thread matches above, loose matches on Subject: below --
2004-04-01 20:51 Michael Elizabeth Chastain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040401220957.5f4f9ad2.ak@suse.de \
    --to=ak@suse.de \
    --cc=gcc@gcc.gnu.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=weigand@i1.informatik.uni-erlangen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.