]> git.neil.brown.name Git - LaFS.git/commitdiff
Update filesys mtime
authorNeilBrown <neilb@suse.de>
Sun, 19 Sep 2010 12:09:00 +0000 (22:09 +1000)
committerNeilBrown <neilb@suse.de>
Sun, 19 Sep 2010 12:09:00 +0000 (22:09 +1000)
Do this when inode is dirtied.  Maybe this isn't the perfect time,
but it is fairly good for now.

Signed-off-by: NeilBrown <neilb@suse.de>
inode.c

diff --git a/inode.c b/inode.c
index a476873c71c84bbc101148ee07745d0c895dedbc..88312c3620e579c06cc02fc923212ecd0714ab8b 100644 (file)
--- a/inode.c
+++ b/inode.c
@@ -1059,9 +1059,20 @@ void lafs_dirty_inode(struct inode *ino)
         * the datablock from the inode.
         * If an update has to wait for the next phase, lock_dblock
         * (e.g. in setattr) will do that.
+        *
+        * We also use this opportunity to update the filesystem modify time.
         */
+       struct timespec now;
+       struct inode *filesys;
        set_bit(I_Dirty, &LAFSI(ino)->iflags);
        ino->i_sb->s_dirt = 1;
+
+       now = current_fs_time(ino->i_sb);
+       filesys = ino_from_sb(ino->i_sb);
+       if (!timespec_equal(&filesys->i_mtime, &now)) {
+               filesys->i_mtime = now;
+               set_bit(I_Dirty, &LAFSI(filesys)->iflags);
+       }
 }
 
 int lafs_sync_inode(struct inode *ino, int wait)