The combination of file_remove_privs() and file_update_mtime() is quite common in filesystem ->write_iter() methods. Modelled after the helper file_accessed(), introduce file_modified() and use it from generic_remap_file_range_prep(). Note that the order of calling file_remove_privs() before file_update_mtime() in the helper was matched to the more common order by filesystems and not the current order in generic_remap_file_range_prep().
Showing the changes to include/linux (1 of 3 files). Show all
Unified · Split
| @@ -2177,6 +2177,8 @@ static inline void file_accessed(struct file *file) · 2176 unmodified lines | |||
| 2177 | touch_atime(&file->f_path); | 2177 | touch_atime(&file->f_path); |
| 2178 | } | 2178 | } |
| 2179 | 2179 | ||
| 2180 | extern int file_modified(struct file *file); | ||
| 2181 | |||
| 2180 | int sync_inode(struct inode *inode, struct writeback_control *wbc); | 2182 | int sync_inode(struct inode *inode, struct writeback_control *wbc); |
| 2181 | int sync_inode_metadata(struct inode *inode, int wait); | 2183 | int sync_inode_metadata(struct inode *inode, int wait); |
| 2182 | 2184 | ||