Commit 95912368 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] libfs mtime/ctime updates

From: Anton Blanchard <anton@samba.org>

Update ctime/mtime in libfs where appropriate.
parent 076cf989
...@@ -227,6 +227,7 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den ...@@ -227,6 +227,7 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den
{ {
struct inode *inode = old_dentry->d_inode; struct inode *inode = old_dentry->d_inode;
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
inode->i_nlink++; inode->i_nlink++;
atomic_inc(&inode->i_count); atomic_inc(&inode->i_count);
dget(dentry); dget(dentry);
...@@ -258,6 +259,7 @@ int simple_unlink(struct inode *dir, struct dentry *dentry) ...@@ -258,6 +259,7 @@ int simple_unlink(struct inode *dir, struct dentry *dentry)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
inode->i_nlink--; inode->i_nlink--;
dput(dentry); dput(dentry);
return 0; return 0;
...@@ -277,6 +279,7 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -277,6 +279,7 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
int simple_rename(struct inode *old_dir, struct dentry *old_dentry, int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry) struct inode *new_dir, struct dentry *new_dentry)
{ {
struct inode *inode = old_dentry->d_inode;
int they_are_dirs = S_ISDIR(old_dentry->d_inode->i_mode); int they_are_dirs = S_ISDIR(old_dentry->d_inode->i_mode);
if (!simple_empty(new_dentry)) if (!simple_empty(new_dentry))
...@@ -290,6 +293,10 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -290,6 +293,10 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
old_dir->i_nlink--; old_dir->i_nlink--;
new_dir->i_nlink++; new_dir->i_nlink++;
} }
old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
new_dir->i_mtime = inode->i_ctime = CURRENT_TIME;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment