]> git.hungrycats.org Git - linux/commitdiff
[PATCH] libfs mtime/ctime updates
authorAndrew Morton <akpm@osdl.org>
Wed, 4 Feb 2004 02:42:08 +0000 (18:42 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 4 Feb 2004 02:42:08 +0000 (18:42 -0800)
From: Anton Blanchard <anton@samba.org>

Update ctime/mtime in libfs where appropriate.

fs/libfs.c

index 475871c787f31a85308af1ad4d43191ba8a0d39a..a0e9c087b054c76a4e5f5fa573bf0a3469498ab9 100644 (file)
@@ -227,6 +227,7 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den
 {
        struct inode *inode = old_dentry->d_inode;
 
+       inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
        inode->i_nlink++;
        atomic_inc(&inode->i_count);
        dget(dentry);
@@ -258,6 +259,7 @@ int simple_unlink(struct inode *dir, struct dentry *dentry)
 {
        struct inode *inode = dentry->d_inode;
 
+       inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
        inode->i_nlink--;
        dput(dentry);
        return 0;
@@ -277,6 +279,7 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
 int simple_rename(struct inode *old_dir, struct dentry *old_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);
 
        if (!simple_empty(new_dentry))
@@ -290,6 +293,10 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
                old_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;
 }