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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: J. Bruce Fields
Date: Wednesday, August 18, 2010 - 10:32 am

On Wed, Aug 18, 2010 at 03:53:59PM +1000, Neil Brown wrote:

We can also skip the update whenever current_nfsd_time is greater than
the inode's mtime--that's enough to ensure that the next
file_update_time() call will get a time different from the inode's
current mtime.

And that means that a sequence like

	file_update_time()
	N nfsd_getattr()'s

doesn't make N updates to current_nfsd_time, when only 1 was necessary.


... which would only happen on hardware that could process a getattr and
a data update per nanosecond continuously for a jiffy.


OK, got it, I think: so this is the same as a global version of Alan's
clock, except that the extra ticks only happen when they need to.

The properties it satisfies:

	- It's still a single global clock, so it's consistent between
	  files.
	- It degenerates to jiffies in the absence of getattr's from
	  nfsd.
	- It need only invalidate the other cpus' cached value of the
	  clock on the first getattr of a file that follows less than a
	  jiffy after an update of the file's data.
	- Absent utime(), time going backwards, or futuristic hardware,
	  it guarantees that two nfsd reads of an inode's mtime will
	  return different values iff the inode's data was modified in
	  between the two.

Shortcomings:

	- The clock advances in units only of either 1 jiffy or 1 ns.
	  This will look odd.  But when the alternative is units of 1
	  jiffy or 0 ns, it seems an improvement....
	- A slowdown due to inodes being file_update_time() marking inodes
	  dirty more frequently?
	- Doesn't help with ext3.  Oh well.

Would the extra expense rule out treating sys_stat() the same as nfsd?
It would be nice to be able to solve the same problem for userspace
nfsd's (or any other application that might be using mtime to save
rereading data).

--b.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Proposal: Use hi-res clock for file timestamps, Patrick J. LoPresti, (Fri Aug 13, 11:25 am)
Re: Proposal: Use hi-res clock for file timestamps, john stultz, (Fri Aug 13, 11:45 am)
Re: Proposal: Use hi-res clock for file timestamps, Patrick J. LoPresti, (Fri Aug 13, 11:57 am)
Re: Proposal: Use hi-res clock for file timestamps, john stultz, (Fri Aug 13, 12:09 pm)
Re: Proposal: Use hi-res clock for file timestamps, Patrick J. LoPresti, (Fri Aug 13, 1:53 pm)
Re: Proposal: Use hi-res clock for file timestamps, Bret Towe, (Sat Aug 14, 6:50 pm)
Re: Proposal: Use hi-res clock for file timestamps, Andi Kleen, (Tue Aug 17, 7:54 am)
Re: Proposal: Use hi-res clock for file timestamps, J. Bruce Fields, (Tue Aug 17, 10:41 am)
Re: Proposal: Use hi-res clock for file timestamps, Andi Kleen, (Tue Aug 17, 11:29 am)
Re: Proposal: Use hi-res clock for file timestamps, Patrick J. LoPresti, (Tue Aug 17, 11:50 am)
Re: Proposal: Use hi-res clock for file timestamps, J. Bruce Fields, (Tue Aug 17, 12:04 pm)
Re: Proposal: Use hi-res clock for file timestamps, Patrick J. LoPresti, (Tue Aug 17, 12:18 pm)
Re: Proposal: Use hi-res clock for file timestamps, J. Bruce Fields, (Tue Aug 17, 12:29 pm)
Re: Proposal: Use hi-res clock for file timestamps, Patrick J. LoPresti, (Tue Aug 17, 12:34 pm)
Re: Proposal: Use hi-res clock for file timestamps, Alan Cox, (Tue Aug 17, 12:39 pm)
Re: Proposal: Use hi-res clock for file timestamps, Patrick J. LoPresti, (Tue Aug 17, 12:43 pm)
Re: Proposal: Use hi-res clock for file timestamps, J. Bruce Fields, (Tue Aug 17, 12:45 pm)
Re: Proposal: Use hi-res clock for file timestamps, Alan Cox, (Tue Aug 17, 12:52 pm)
Re: Proposal: Use hi-res clock for file timestamps, Alan Cox, (Tue Aug 17, 12:54 pm)
Re: Proposal: Use hi-res clock for file timestamps, Neil Brown, (Tue Aug 17, 10:53 pm)
Re: Proposal: Use hi-res clock for file timestamps, Patrick J. LoPresti, (Wed Aug 18, 7:46 am)
Re: Proposal: Use hi-res clock for file timestamps, J. Bruce Fields, (Wed Aug 18, 10:32 am)
Re: Proposal: Use hi-res clock for file timestamps, Chuck Lever, (Wed Aug 18, 11:15 am)
Re: Proposal: Use hi-res clock for file timestamps, David Woodhouse, (Wed Aug 18, 11:20 am)
Re: Proposal: Use hi-res clock for file timestamps, Patrick J. LoPresti, (Wed Aug 18, 11:32 am)
Re: Proposal: Use hi-res clock for file timestamps, Andi Kleen, (Wed Aug 18, 11:53 am)
Re: Proposal: Use hi-res clock for file timestamps, J. Bruce Fields, (Wed Aug 18, 11:54 am)
Re: Proposal: Use hi-res clock for file timestamps, Andi Kleen, (Wed Aug 18, 12:25 pm)
Re: Proposal: Use hi-res clock for file timestamps, J. Bruce Fields, (Wed Aug 18, 12:30 pm)
Re: Proposal: Use hi-res clock for file timestamps, Neil Brown, (Wed Aug 18, 4:41 pm)
Re: Proposal: Use hi-res clock for file timestamps, Neil Brown, (Wed Aug 18, 4:47 pm)
Re: Proposal: Use hi-res clock for file timestamps, Neil Brown, (Wed Aug 18, 5:52 pm)
Re: Proposal: Use hi-res clock for file timestamps, john stultz, (Wed Aug 18, 6:41 pm)
Re: Proposal: Use hi-res clock for file timestamps, J. Bruce Fields, (Wed Aug 18, 7:08 pm)
Re: Proposal: Use hi-res clock for file timestamps, J. Bruce Fields, (Wed Aug 18, 7:31 pm)
Re: Proposal: Use hi-res clock for file timestamps, Neil Brown, (Wed Aug 18, 7:44 pm)
Re: Proposal: Use hi-res clock for file timestamps, john stultz, (Wed Aug 18, 8:17 pm)
Re: Proposal: Use hi-res clock for file timestamps, J. Bruce Fields, (Thu Aug 19, 3:46 pm)