add some notes on file_update_time
PATCH 1/1 add some notes on file_update_time
add some notes on why this function should only be used in the write methods, and what NOCTIME is about.
fs/inode.c +6 -1
@@ -1211,7 +1211,12 @@* @file: file accessed * * Update the mtime and ctime members of an inode and mark the inode -* for writeback. +* for writeback. Note that this function is meant exclusively for +* usage in the file write path of filesystems, and filesystems may +* chose to explicitly ignore update via this function with the +* S_NOCTIME inode flag, e.g. for network filesystem where these +* timestamps are handled by the server. All explicit ctime/mtime +* updates must be done via notify_change(). */ void file_update_time (struct file *file)
Quoted 14 lines · Christoph Hellwig
add some notes on why this function should only be used in the write methods, and what NOCTIME is about.
Signed-off-by Christoph Hellwig <[email protected]>Index:
linux-2.6/fs/inode.c
===================================================================fs/inode.c +0
-0@@ -1211,7 +1211,12 @@* @file: file accessed * * Update the mtime and ctime members of an inode and mark the inode
fs/inode.c line 1222
Quoted 10 lines
fs/inode.c +6
-1-* for writeback. +* for writeback. Note that this function is meant exclusively for +* usage in the file write path of filesystems, and filesystems may +* chose to explicitly ignore update via this function with the +* S_NOCTIME inode flag, e.g. for network filesystem where these +* timestamps are handled by the server. All explicit ctime/mtime +* updates must be done via notify_change(). */ void file_update_time (struct file *file)
Nice explanation except for the last sentence. Surely you do not expect filesystem drivers to call notify_change()? I thought you told me that I should be setting the c/mtime directly, rather than using a function, so now you are going back on that? Or am I simply misunderstanding the sentence completely? I apologize if that is the case...
Best regards,
Anton
Signature · 4 lines
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
Quoted 5 lines
Nice explanation except for the last sentence. Surely you do not expect filesystem drivers to call
notify_change()? I thought you told me that I should be setting the c/mtime directly, rather than using a function, so now you are going back on that? Or am I simply misunderstanding the sentence completely? I apologize if that is the case...
this was meant for non-fs callers. but to be there's no reason why non-fs callers should look at this function in the first time.
The updated patch below just drop the sentence. we might want to write up rules on c/mtime updates somewhere, but that's really not related to file_update_time.
fs/inode.c +5 -1
@@ -1208,7 +1208,11 @@* @file: file accessed * * Update the mtime and ctime members of an inode and mark the inode -* for writeback. +* for writeback. Note that this function is meant exclusively for +* usage in the file write path of filesystems, and filesystems may +* chose to explicitly ignore update via this function with the +* S_NOCTIME inode flag, e.g. for network filesystem where these +* timestamps are handled by the server. */ void file_update_time (struct file *file)
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines
Nice explanation except for the last sentence. Surely you do not expect filesystem drivers to call
notify_change()? I thought you told me that I should be setting the c/mtime directly, rather than using a function, so now you are going back on that? Or am I simply misunderstanding the sentence completely? I apologize if that is the case...
Quoted 6 lines
this was meant for non-fs callers. but to be there's no reason why non-fs callers should look at this function in the first time.
The updated patch below just drop the sentence. we might want to write up rules on c/mtime updates somewhere, but that's really not related to
file_update_time.
And here's another update, as Nathan Scott found a small typo:
fs/inode.c +5 -1
@@ -1208,7 +1208,11 @@* @file: file accessed * * Update the mtime and ctime members of an inode and mark the inode -* for writeback. +* for writeback. Note that this function is meant exclusively for +* usage in the file write path of filesystems, and filesystems may +* choose to explicitly ignore update via this function with the +* S_NOCTIME inode flag, e.g. for network filesystem where these +* timestamps are handled by the server. */ void file_update_time (struct file *file)