From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
To: Andreas Dilger <adilger@sun.com>,
Chris Mason <chris.mason@oracle.com>,
Jiri Olsa <jolsa@redhat.com>, John Stultz <johnstul@us.ibm.com>,
"Ted Ts'o" <tytso@mit.edu>, Thomas Gleixner <
Subject: [RFC][PATCH] make file's timestamp more accurate
Date: Tue, 31 Aug 2010 17:42:50 +0900 [thread overview]
Message-ID: <4C7CC08A.9010302@jp.fujitsu.com> (raw)
Hi,
linux has supported nanosecond order file's timestamp since 2.5.48.
However current file timestamp is got by current_fs_time() and
is only updated once a tick. It can't say true nanosecond accuracy.
In addition, gettimeofday() before a file operation updating
{a,c,m}time would outstrip file's timestamp because of the difference
about time source between gettimeofday() and file's timestamp.
A certain kind of application would corrupted by this problem.
I attached a most simple patch fixing this problem here. However
it has several problems and I don't say it can be applied as is.
The most big two problems is the following:
- It would cause performance regression, especially in
not TSC capable system.
- Is gettimeofday()'s monotonicity reliable on all systems?
The relative discussion:
http://lkml.org/lkml/2010/7/13/443
Does anybody have good idea? Should it be tunable, for example?
Thanks,
Satoru
Index: linux-2.6.36-rc3/kernel/time.c
===================================================================
--- linux-2.6.36-rc3.orig/kernel/time.c 2010-08-31 16:07:43.000000000 +0900
+++ linux-2.6.36-rc3/kernel/time.c 2010-08-31 16:08:11.000000000 +0900
@@ -227,7 +227,8 @@ SYSCALL_DEFINE1(adjtimex, struct timex _
*/
struct timespec current_fs_time(struct super_block *sb)
{
- struct timespec now = current_kernel_time();
+ struct timespec now;
+ getnstimeofday(&now);
return timespec_trunc(now, sb->s_time_gran);
}
EXPORT_SYMBOL(current_fs_time);
WARNING: multiple messages have this Message-ID (diff)
From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
To: Andreas Dilger <adilger@sun.com>,
Chris Mason <chris.mason@oracle.com>,
Jiri Olsa <jolsa@redhat.com>, John Stultz <johnstul@us.ibm.com>,
"Ted Ts'o" <tytso@mit.edu>, Thomas Gleixner <tglx@linutronix.de>,
Oleg Nesterov <oleg@redhat.com>,
linux-btrfs <linux-btrfs@vger.kernel.org>,
linux-ext4 <linux-ext4@vger.kernel.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: [RFC][PATCH] make file's timestamp more accurate
Date: Tue, 31 Aug 2010 17:42:50 +0900 [thread overview]
Message-ID: <4C7CC08A.9010302@jp.fujitsu.com> (raw)
Hi,
linux has supported nanosecond order file's timestamp since 2.5.48.
However current file timestamp is got by current_fs_time() and
is only updated once a tick. It can't say true nanosecond accuracy.
In addition, gettimeofday() before a file operation updating
{a,c,m}time would outstrip file's timestamp because of the difference
about time source between gettimeofday() and file's timestamp.
A certain kind of application would corrupted by this problem.
I attached a most simple patch fixing this problem here. However
it has several problems and I don't say it can be applied as is.
The most big two problems is the following:
- It would cause performance regression, especially in
not TSC capable system.
- Is gettimeofday()'s monotonicity reliable on all systems?
The relative discussion:
http://lkml.org/lkml/2010/7/13/443
Does anybody have good idea? Should it be tunable, for example?
Thanks,
Satoru
Index: linux-2.6.36-rc3/kernel/time.c
===================================================================
--- linux-2.6.36-rc3.orig/kernel/time.c 2010-08-31 16:07:43.000000000 +0900
+++ linux-2.6.36-rc3/kernel/time.c 2010-08-31 16:08:11.000000000 +0900
@@ -227,7 +227,8 @@ SYSCALL_DEFINE1(adjtimex, struct timex _
*/
struct timespec current_fs_time(struct super_block *sb)
{
- struct timespec now = current_kernel_time();
+ struct timespec now;
+ getnstimeofday(&now);
return timespec_trunc(now, sb->s_time_gran);
}
EXPORT_SYMBOL(current_fs_time);
next reply other threads:[~2010-08-31 8:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-31 8:42 Satoru Takeuchi [this message]
2010-08-31 8:42 ` [RFC][PATCH] make file's timestamp more accurate Satoru Takeuchi
2010-09-09 16:23 ` john stultz
2010-09-10 5:54 ` Satoru Takeuchi
-- strict thread matches above, loose matches on Subject: below --
2010-08-31 8:42 Satoru Takeuchi
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=4C7CC08A.9010302@jp.fujitsu.com \
--to=takeuchi_satoru@jp.fujitsu.com \
--cc=adilger@sun.com \
--cc=chris.mason@oracle.com \
--cc=johnstul@us.ibm.com \
--cc=jolsa@redhat.com \
--cc=tytso@mit.edu \
/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.