77 *
88 * For licensing information, see the file 'LICENCE' in this directory.
99 *
10- * $Id: dir.c,v 1.87 2005/07 /17 11: 13:46 dedekind Exp $
10+ * $Id: dir.c,v 1.88 2005/08 /17 13:46:22 dedekind Exp $
1111 *
1212 */
1313
@@ -232,11 +232,14 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry)
232232 struct jffs2_inode_info * dir_f = JFFS2_INODE_INFO (dir_i );
233233 struct jffs2_inode_info * dead_f = JFFS2_INODE_INFO (dentry -> d_inode );
234234 int ret ;
235+ uint32_t now = get_seconds ();
235236
236237 ret = jffs2_do_unlink (c , dir_f , dentry -> d_name .name ,
237- dentry -> d_name .len , dead_f );
238+ dentry -> d_name .len , dead_f , now );
238239 if (dead_f -> inocache )
239240 dentry -> d_inode -> i_nlink = dead_f -> inocache -> nlink ;
241+ if (!ret )
242+ dir_i -> i_mtime = dir_i -> i_ctime = ITIME (now );
240243 return ret ;
241244}
242245/***********************************************************************/
@@ -249,6 +252,7 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de
249252 struct jffs2_inode_info * dir_f = JFFS2_INODE_INFO (dir_i );
250253 int ret ;
251254 uint8_t type ;
255+ uint32_t now ;
252256
253257 /* Don't let people make hard links to bad inodes. */
254258 if (!f -> inocache )
@@ -261,13 +265,15 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de
261265 type = (old_dentry -> d_inode -> i_mode & S_IFMT ) >> 12 ;
262266 if (!type ) type = DT_REG ;
263267
264- ret = jffs2_do_link (c , dir_f , f -> inocache -> ino , type , dentry -> d_name .name , dentry -> d_name .len );
268+ now = get_seconds ();
269+ ret = jffs2_do_link (c , dir_f , f -> inocache -> ino , type , dentry -> d_name .name , dentry -> d_name .len , now );
265270
266271 if (!ret ) {
267272 down (& f -> sem );
268273 old_dentry -> d_inode -> i_nlink = ++ f -> inocache -> nlink ;
269274 up (& f -> sem );
270275 d_instantiate (dentry , old_dentry -> d_inode );
276+ dir_i -> i_mtime = dir_i -> i_ctime = ITIME (now );
271277 atomic_inc (& old_dentry -> d_inode -> i_count );
272278 }
273279 return ret ;
@@ -716,6 +722,7 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
716722 struct jffs2_sb_info * c = JFFS2_SB_INFO (old_dir_i -> i_sb );
717723 struct jffs2_inode_info * victim_f = NULL ;
718724 uint8_t type ;
725+ uint32_t now ;
719726
720727 /* The VFS will check for us and prevent trying to rename a
721728 * file over a directory and vice versa, but if it's a directory,
@@ -749,9 +756,10 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
749756 type = (old_dentry -> d_inode -> i_mode & S_IFMT ) >> 12 ;
750757 if (!type ) type = DT_REG ;
751758
759+ now = get_seconds ();
752760 ret = jffs2_do_link (c , JFFS2_INODE_INFO (new_dir_i ),
753761 old_dentry -> d_inode -> i_ino , type ,
754- new_dentry -> d_name .name , new_dentry -> d_name .len );
762+ new_dentry -> d_name .name , new_dentry -> d_name .len , now );
755763
756764 if (ret )
757765 return ret ;
@@ -775,7 +783,7 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
775783
776784 /* Unlink the original */
777785 ret = jffs2_do_unlink (c , JFFS2_INODE_INFO (old_dir_i ),
778- old_dentry -> d_name .name , old_dentry -> d_name .len , NULL );
786+ old_dentry -> d_name .name , old_dentry -> d_name .len , NULL , now );
779787
780788 /* We don't touch inode->i_nlink */
781789
@@ -792,12 +800,15 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
792800 /* Might as well let the VFS know */
793801 d_instantiate (new_dentry , old_dentry -> d_inode );
794802 atomic_inc (& old_dentry -> d_inode -> i_count );
803+ new_dir_i -> i_mtime = new_dir_i -> i_ctime = ITIME (now );
795804 return ret ;
796805 }
797806
798807 if (S_ISDIR (old_dentry -> d_inode -> i_mode ))
799808 old_dir_i -> i_nlink -- ;
800809
810+ new_dir_i -> i_mtime = new_dir_i -> i_ctime = old_dir_i -> i_mtime = old_dir_i -> i_ctime = ITIME (now );
811+
801812 return 0 ;
802813}
803814
0 commit comments