Re: Proposal: Use hi-res clock for file timestamps

From: J. Bruce Fields
Date: Wed Aug 18 2010 - 14:14:57 EST


On Tue, Aug 17, 2010 at 12:34:58PM -0700, Patrick J. LoPresti wrote:
> On Tue, Aug 17, 2010 at 12:39 PM, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote:
>
> > Â Â Â Âif (time_now == time_last)
> > Â Â Â Â Â Â Â Âreturn { time_last , ++ct };
> > Â Â Â Âelse {
> > Â Â Â Â Â Â Â Âct = 0;
> > Â Â Â Â Â Â Â Âtime_last = time_now
> > Â Â Â Â Â Â Â Âreturn { time_last , 0 };
> > Â Â Â Â}
> >
> > providing it is done with the same 'ct' across the fs and you can't do
> > enough ops/second to wrap the nanosecs - which should be fine for now,
> > your ordering is still safe is it not ?
>
> Yes, that would work. Assuming you use atomic counters, else there
> is a risk of the visible time ticking backwards. It seems like a lot
> of effort just to avoid having accurate timestamps on your files,
> though.
>
> I am having trouble seeing why this is a better idea than a simple
> mount option to obtain decent resolution timestamps. (Not that we
> can't have both...) Is there any objection to the mount option I am
> proposing?

I'm completely ignorant about higher-resolution time sources. Any
recommended reading? What resolution do they actually provide, what's
the expense of reading them, how reliable are they, and how do the
answers to those questions vary across different hardware and kernel
versions? A quick look at drivers/clocksource/ doesn't suggest
simple answers.

-b.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/