@@ -63,10 +63,16 @@ struct inode *simplefs_iget(struct super_block *sb, unsigned long ino)
6363 inode -> i_ctime .tv_nsec = 0 ;
6464#endif
6565
66+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
67+ inode_set_atime (inode , (time64_t ) le32_to_cpu (cinode -> i_atime ), 0 );
68+ inode_set_mtime (inode , (time64_t ) le32_to_cpu (cinode -> i_mtime ), 0 );
69+ #else
6670 inode -> i_atime .tv_sec = (time64_t ) le32_to_cpu (cinode -> i_atime );
6771 inode -> i_atime .tv_nsec = 0 ;
6872 inode -> i_mtime .tv_sec = (time64_t ) le32_to_cpu (cinode -> i_mtime );
6973 inode -> i_mtime .tv_nsec = 0 ;
74+ #endif
75+
7076 inode -> i_blocks = le32_to_cpu (cinode -> i_blocks );
7177 set_nlink (inode , le32_to_cpu (cinode -> i_nlink ));
7278
@@ -161,7 +167,12 @@ static struct dentry *simplefs_lookup(struct inode *dir,
161167 brelse (bh );
162168
163169 /* Update directory access time */
170+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
171+ inode_set_atime_to_ts (dir , current_time (dir ));
172+ #else
164173 dir -> i_atime = current_time (dir );
174+ #endif
175+
165176 mark_inode_dirty (dir );
166177
167178 /* Fill the dentry with the inode */
@@ -219,7 +230,9 @@ static struct inode *simplefs_new_inode(struct inode *dir, mode_t mode)
219230#endif
220231 set_nlink (inode , 1 );
221232
222- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
233+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
234+ simple_inode_init_ts (inode );
235+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
223236 cur_time = current_time (inode );
224237 inode -> i_atime = inode -> i_mtime = cur_time ;
225238 inode_set_ctime_to_ts (inode , cur_time );
@@ -261,7 +274,9 @@ static struct inode *simplefs_new_inode(struct inode *dir, mode_t mode)
261274 set_nlink (inode , 1 );
262275 }
263276
264- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
277+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
278+ simple_inode_init_ts (inode );
279+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
265280 cur_time = current_time (inode );
266281 inode -> i_atime = inode -> i_mtime = cur_time ;
267282 inode_set_ctime_to_ts (inode , cur_time );
@@ -395,7 +410,9 @@ static int simplefs_create(struct inode *dir,
395410 /* Update stats and mark dir and new inode dirty */
396411 mark_inode_dirty (inode );
397412
398- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
413+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
414+ simple_inode_init_ts (dir );
415+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
399416 cur_time = current_time (dir );
400417 dir -> i_mtime = dir -> i_atime = cur_time ;
401418 inode_set_ctime_to_ts (dir , cur_time );
@@ -537,7 +554,9 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
537554 goto clean_inode ;
538555
539556 /* Update inode stats */
540- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
557+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
558+ simple_inode_init_ts (dir );
559+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
541560 cur_time = current_time (dir );
542561 dir -> i_mtime = dir -> i_atime = cur_time ;
543562 inode_set_ctime_to_ts (dir , cur_time );
@@ -606,7 +625,11 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
606625 i_gid_write (inode , 0 );
607626 inode -> i_mode = 0 ;
608627
609- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
628+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
629+ inode_set_mtime (inode , 0 , 0 );
630+ inode_set_atime (inode , 0 , 0 );
631+ inode_set_ctime (inode , 0 , 0 );
632+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
610633 inode -> i_mtime .tv_sec = inode -> i_atime .tv_sec = 0 ;
611634 inode_set_ctime (inode , 0 , 0 );
612635#else
@@ -750,7 +773,9 @@ static int simplefs_rename(struct inode *old_dir,
750773 brelse (bh2 );
751774
752775 /* Update new parent inode metadata */
753- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
776+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
777+ simple_inode_init_ts (new_dir );
778+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
754779 cur_time = current_time (new_dir );
755780 new_dir -> i_atime = new_dir -> i_mtime = cur_time ;
756781 inode_set_ctime_to_ts (new_dir , cur_time );
@@ -769,7 +794,9 @@ static int simplefs_rename(struct inode *old_dir,
769794 goto release_new ;
770795
771796 /* Update old parent inode metadata */
772- #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
797+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 7 , 0 )
798+ simple_inode_init_ts (old_dir );
799+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 6 , 0 )
773800 cur_time = current_time (old_dir );
774801 old_dir -> i_atime = old_dir -> i_mtime = cur_time ;
775802 inode_set_ctime_to_ts (old_dir , cur_time );
0 commit comments