Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs: refactor ->update_time handling

Pass the type of update (atime vs c/mtime plus version) as an enum
instead of a set of flags that caused all kinds of confusion.
Because inode_update_timestamps now can't return a modified version
of those flags, return the I_DIRTY_* flags needed to persist the
update, which is what the main caller in generic_update_time wants
anyway, and which is suitable for the other callers that only want
to know if an update happened.

The whole update_time path keeps the flags argument, which will be used
to support non-blocking updates soon even if it is unused, and (the
slightly renamed) inode_update_time also gains the possibility to return
a negative errno to support this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260108141934.2052404-6-hch@lst.de
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Christoph Hellwig and committed by
Christian Brauner
76147526 1cbc8228

+161 -158
+2 -1
Documentation/filesystems/locking.rst
··· 80 80 int (*getattr) (struct mnt_idmap *, const struct path *, struct kstat *, u32, unsigned int); 81 81 ssize_t (*listxattr) (struct dentry *, char *, size_t); 82 82 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len); 83 - void (*update_time)(struct inode *, struct timespec *, int); 83 + void (*update_time)(struct inode *inode, enum fs_update_time type, 84 + int flags); 84 85 int (*atomic_open)(struct inode *, struct dentry *, 85 86 struct file *, unsigned open_flag, 86 87 umode_t create_mode);
+2 -1
Documentation/filesystems/vfs.rst
··· 485 485 int (*setattr) (struct mnt_idmap *, struct dentry *, struct iattr *); 486 486 int (*getattr) (struct mnt_idmap *, const struct path *, struct kstat *, u32, unsigned int); 487 487 ssize_t (*listxattr) (struct dentry *, char *, size_t); 488 - void (*update_time)(struct inode *, struct timespec *, int); 488 + void (*update_time)(struct inode *inode, enum fs_update_time type, 489 + int flags); 489 490 int (*atomic_open)(struct inode *, struct dentry *, struct file *, 490 491 unsigned open_flag, umode_t create_mode); 491 492 int (*tmpfile) (struct mnt_idmap *, struct inode *, struct file *, umode_t);
+2 -1
fs/bad_inode.c
··· 133 133 return -EIO; 134 134 } 135 135 136 - static int bad_inode_update_time(struct inode *inode, int flags) 136 + static int bad_inode_update_time(struct inode *inode, enum fs_update_time type, 137 + unsigned int flags) 137 138 { 138 139 return -EIO; 139 140 }
+7 -4
fs/btrfs/inode.c
··· 6345 6345 * We need our own ->update_time so that we can return error on ENOSPC for 6346 6346 * updating the inode in the case of file write and mmap writes. 6347 6347 */ 6348 - static int btrfs_update_time(struct inode *inode, int flags) 6348 + static int btrfs_update_time(struct inode *inode, enum fs_update_time type, 6349 + unsigned int flags) 6349 6350 { 6350 6351 struct btrfs_root *root = BTRFS_I(inode)->root; 6351 - bool dirty; 6352 + int dirty; 6352 6353 6353 6354 if (btrfs_root_readonly(root)) 6354 6355 return -EROFS; 6355 6356 6356 - dirty = inode_update_timestamps(inode, flags); 6357 - return dirty ? btrfs_dirty_inode(BTRFS_I(inode)) : 0; 6357 + dirty = inode_update_time(inode, type, flags); 6358 + if (dirty <= 0) 6359 + return dirty; 6360 + return btrfs_dirty_inode(BTRFS_I(inode)); 6358 6361 } 6359 6362 6360 6363 /*
+2 -1
fs/fat/fat.h
··· 472 472 #define FAT_UPDATE_CMTIME (1u << 1) 473 473 void fat_truncate_time(struct inode *inode, struct timespec64 *now, 474 474 unsigned int flags); 475 - extern int fat_update_time(struct inode *inode, int flags); 475 + int fat_update_time(struct inode *inode, enum fs_update_time type, 476 + unsigned int flags); 476 477 extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); 477 478 478 479 int fat_cache_init(void);
+6 -20
fs/fat/misc.c
··· 332 332 } 333 333 EXPORT_SYMBOL_GPL(fat_truncate_time); 334 334 335 - int fat_update_time(struct inode *inode, int flags) 335 + int fat_update_time(struct inode *inode, enum fs_update_time type, 336 + unsigned int flags) 336 337 { 337 - unsigned int fat_flags = 0; 338 - int dirty_flags = 0; 339 - 340 - if (inode->i_ino == MSDOS_ROOT_INO) 341 - return 0; 342 - 343 - if (flags & S_ATIME) 344 - fat_flags |= FAT_UPDATE_ATIME; 345 - if (flags & (S_CTIME | S_MTIME)) 346 - fat_flags |= FAT_UPDATE_CMTIME; 347 - 348 - if (fat_flags) { 349 - fat_truncate_time(inode, NULL, flags); 350 - if (inode->i_sb->s_flags & SB_LAZYTIME) 351 - dirty_flags |= I_DIRTY_TIME; 352 - else 353 - dirty_flags |= I_DIRTY_SYNC; 338 + if (inode->i_ino != MSDOS_ROOT_INO) { 339 + fat_truncate_time(inode, NULL, type == FS_UPD_ATIME ? 340 + FAT_UPDATE_ATIME : FAT_UPDATE_CMTIME); 341 + __mark_inode_dirty(inode, inode_time_dirty_flag(inode)); 354 342 } 355 - 356 - __mark_inode_dirty(inode, dirty_flags); 357 343 return 0; 358 344 } 359 345 EXPORT_SYMBOL_GPL(fat_update_time);
+3 -2
fs/gfs2/inode.c
··· 2242 2242 return vfs_setpos(file, ret, inode->i_sb->s_maxbytes); 2243 2243 } 2244 2244 2245 - static int gfs2_update_time(struct inode *inode, int flags) 2245 + static int gfs2_update_time(struct inode *inode, enum fs_update_time type, 2246 + unsigned int flags) 2246 2247 { 2247 2248 struct gfs2_inode *ip = GFS2_I(inode); 2248 2249 struct gfs2_glock *gl = ip->i_gl; ··· 2258 2257 if (error) 2259 2258 return error; 2260 2259 } 2261 - return generic_update_time(inode, flags); 2260 + return generic_update_time(inode, type, flags); 2262 2261 } 2263 2262 2264 2263 static const struct inode_operations gfs2_file_iops = {
+74 -68
fs/inode.c
··· 2081 2081 return false; 2082 2082 } 2083 2083 2084 - /** 2085 - * inode_update_timestamps - update the timestamps on the inode 2086 - * @inode: inode to be updated 2087 - * @flags: S_* flags that needed to be updated 2088 - * 2089 - * The update_time function is called when an inode's timestamps need to be 2090 - * updated for a read or write operation. This function handles updating the 2091 - * actual timestamps. It's up to the caller to ensure that the inode is marked 2092 - * dirty appropriately. 2093 - * 2094 - * In the case where any of S_MTIME, S_CTIME, or S_VERSION need to be updated, 2095 - * attempt to update all three of them. S_ATIME updates can be handled 2096 - * independently of the rest. 2097 - * 2098 - * Returns a set of S_* flags indicating which values changed. 2099 - */ 2100 - int inode_update_timestamps(struct inode *inode, int flags) 2084 + static int inode_update_atime(struct inode *inode) 2101 2085 { 2102 - int updated = 0; 2103 - struct timespec64 now; 2086 + struct timespec64 atime = inode_get_atime(inode); 2087 + struct timespec64 now = current_time(inode); 2104 2088 2105 - if (flags & (S_MTIME|S_CTIME|S_VERSION)) { 2106 - struct timespec64 ctime = inode_get_ctime(inode); 2107 - struct timespec64 mtime = inode_get_mtime(inode); 2089 + if (timespec64_equal(&now, &atime)) 2090 + return 0; 2108 2091 2109 - now = inode_set_ctime_current(inode); 2110 - if (!timespec64_equal(&now, &ctime)) 2111 - updated |= S_CTIME; 2112 - if (!timespec64_equal(&now, &mtime)) { 2113 - inode_set_mtime_to_ts(inode, now); 2114 - updated |= S_MTIME; 2115 - } 2116 - if (IS_I_VERSION(inode) && inode_maybe_inc_iversion(inode, updated)) 2117 - updated |= S_VERSION; 2118 - } else { 2119 - now = current_time(inode); 2120 - } 2121 - 2122 - if (flags & S_ATIME) { 2123 - struct timespec64 atime = inode_get_atime(inode); 2124 - 2125 - if (!timespec64_equal(&now, &atime)) { 2126 - inode_set_atime_to_ts(inode, now); 2127 - updated |= S_ATIME; 2128 - } 2129 - } 2130 - return updated; 2092 + inode_set_atime_to_ts(inode, now); 2093 + return inode_time_dirty_flag(inode); 2131 2094 } 2132 - EXPORT_SYMBOL(inode_update_timestamps); 2095 + 2096 + static int inode_update_cmtime(struct inode *inode) 2097 + { 2098 + struct timespec64 ctime = inode_get_ctime(inode); 2099 + struct timespec64 mtime = inode_get_mtime(inode); 2100 + struct timespec64 now = inode_set_ctime_current(inode); 2101 + unsigned int dirty = 0; 2102 + bool mtime_changed; 2103 + 2104 + mtime_changed = !timespec64_equal(&now, &mtime); 2105 + if (mtime_changed || !timespec64_equal(&now, &ctime)) 2106 + dirty = inode_time_dirty_flag(inode); 2107 + if (mtime_changed) 2108 + inode_set_mtime_to_ts(inode, now); 2109 + 2110 + if (IS_I_VERSION(inode) && inode_maybe_inc_iversion(inode, !!dirty)) 2111 + dirty |= I_DIRTY_SYNC; 2112 + 2113 + return dirty; 2114 + } 2115 + 2116 + /** 2117 + * inode_update_time - update either atime or c/mtime and i_version on the inode 2118 + * @inode: inode to be updated 2119 + * @type: timestamp to be updated 2120 + * @flags: flags for the update 2121 + * 2122 + * Update either atime or c/mtime and version in a inode if needed for a file 2123 + * access or modification. It is up to the caller to mark the inode dirty 2124 + * appropriately. 2125 + * 2126 + * Returns the positive I_DIRTY_* flags for __mark_inode_dirty() if the inode 2127 + * needs to be marked dirty, 0 if it did not, or a negative errno if an error 2128 + * happened. 2129 + */ 2130 + int inode_update_time(struct inode *inode, enum fs_update_time type, 2131 + unsigned int flags) 2132 + { 2133 + switch (type) { 2134 + case FS_UPD_ATIME: 2135 + return inode_update_atime(inode); 2136 + case FS_UPD_CMTIME: 2137 + return inode_update_cmtime(inode); 2138 + default: 2139 + WARN_ON_ONCE(1); 2140 + return -EIO; 2141 + } 2142 + } 2143 + EXPORT_SYMBOL(inode_update_time); 2133 2144 2134 2145 /** 2135 2146 * generic_update_time - update the timestamps on the inode 2136 2147 * @inode: inode to be updated 2137 - * @flags: S_* flags that needed to be updated 2138 - * 2139 - * The update_time function is called when an inode's timestamps need to be 2140 - * updated for a read or write operation. In the case where any of S_MTIME, S_CTIME, 2141 - * or S_VERSION need to be updated we attempt to update all three of them. S_ATIME 2142 - * updates can be handled done independently of the rest. 2148 + * @type: timestamp to be updated 2149 + * @flags: flags for the update 2143 2150 * 2144 2151 * Returns a negative error value on error, else 0. 2145 2152 */ 2146 - int generic_update_time(struct inode *inode, int flags) 2153 + int generic_update_time(struct inode *inode, enum fs_update_time type, 2154 + unsigned int flags) 2147 2155 { 2148 - int updated = inode_update_timestamps(inode, flags); 2149 - int dirty_flags = 0; 2156 + int dirty; 2150 2157 2151 - if (updated & (S_ATIME|S_MTIME|S_CTIME)) 2152 - dirty_flags = inode->i_sb->s_flags & SB_LAZYTIME ? I_DIRTY_TIME : I_DIRTY_SYNC; 2153 - if (updated & S_VERSION) 2154 - dirty_flags |= I_DIRTY_SYNC; 2155 - __mark_inode_dirty(inode, dirty_flags); 2158 + dirty = inode_update_time(inode, type, flags); 2159 + if (dirty <= 0) 2160 + return dirty; 2161 + __mark_inode_dirty(inode, dirty); 2156 2162 return 0; 2157 2163 } 2158 2164 EXPORT_SYMBOL(generic_update_time); ··· 2231 2225 * of the fs read only, e.g. subvolumes in Btrfs. 2232 2226 */ 2233 2227 if (inode->i_op->update_time) 2234 - inode->i_op->update_time(inode, S_ATIME); 2228 + inode->i_op->update_time(inode, FS_UPD_ATIME, 0); 2235 2229 else 2236 - generic_update_time(inode, S_ATIME); 2230 + generic_update_time(inode, FS_UPD_ATIME, 0); 2237 2231 mnt_put_write_access(mnt); 2238 2232 skip_update: 2239 2233 sb_end_write(inode->i_sb); ··· 2360 2354 { 2361 2355 struct inode *inode = file_inode(file); 2362 2356 struct timespec64 now, ts; 2363 - int sync_mode = 0; 2357 + bool need_update = false; 2364 2358 int ret = 0; 2365 2359 2366 2360 /* First try to exhaust all avenues to not sync */ ··· 2373 2367 2374 2368 ts = inode_get_mtime(inode); 2375 2369 if (!timespec64_equal(&ts, &now)) 2376 - sync_mode |= S_MTIME; 2370 + need_update = true; 2377 2371 ts = inode_get_ctime(inode); 2378 2372 if (!timespec64_equal(&ts, &now)) 2379 - sync_mode |= S_CTIME; 2373 + need_update = true; 2380 2374 if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode)) 2381 - sync_mode |= S_VERSION; 2375 + need_update = true; 2382 2376 2383 - if (!sync_mode) 2377 + if (!need_update) 2384 2378 return 0; 2385 2379 2386 2380 if (flags & IOCB_NOWAIT) ··· 2389 2383 if (mnt_get_write_access_file(file)) 2390 2384 return 0; 2391 2385 if (inode->i_op->update_time) 2392 - ret = inode->i_op->update_time(inode, sync_mode); 2386 + ret = inode->i_op->update_time(inode, FS_UPD_CMTIME, 0); 2393 2387 else 2394 - ret = generic_update_time(inode, sync_mode); 2388 + ret = generic_update_time(inode, FS_UPD_CMTIME, 0); 2395 2389 mnt_put_write_access_file(file); 2396 2390 return ret; 2397 2391 }
+5 -5
fs/nfs/inode.c
··· 649 649 struct timespec64 ctime = inode_get_ctime(inode); 650 650 struct timespec64 mtime = inode_get_mtime(inode); 651 651 struct timespec64 now; 652 - int updated = 0; 652 + bool updated = false; 653 653 654 654 now = inode_set_ctime_current(inode); 655 655 if (!timespec64_equal(&now, &ctime)) 656 - updated |= S_CTIME; 656 + updated = true; 657 657 658 658 inode_set_mtime_to_ts(inode, attr->ia_mtime); 659 659 if (!timespec64_equal(&now, &mtime)) 660 - updated |= S_MTIME; 660 + updated = true; 661 661 662 662 inode_maybe_inc_iversion(inode, updated); 663 663 cache_flags |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME; ··· 671 671 672 672 static void nfs_update_atime(struct inode *inode) 673 673 { 674 - inode_update_timestamps(inode, S_ATIME); 674 + inode_update_time(inode, FS_UPD_ATIME, 0); 675 675 NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_ATIME; 676 676 } 677 677 678 678 static void nfs_update_mtime(struct inode *inode) 679 679 { 680 - inode_update_timestamps(inode, S_MTIME | S_CTIME); 680 + inode_update_time(inode, FS_UPD_CMTIME, 0); 681 681 NFS_I(inode)->cache_validity &= 682 682 ~(NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME); 683 683 }
+15 -13
fs/orangefs/inode.c
··· 872 872 return generic_permission(&nop_mnt_idmap, inode, mask); 873 873 } 874 874 875 - int orangefs_update_time(struct inode *inode, int flags) 875 + int orangefs_update_time(struct inode *inode, enum fs_update_time type, 876 + unsigned int flags) 876 877 { 877 - struct iattr iattr; 878 + struct iattr iattr = { }; 879 + int dirty; 878 880 879 - gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_update_time: %pU\n", 880 - get_khandle_from_ino(inode)); 881 + switch (type) { 882 + case FS_UPD_ATIME: 883 + iattr.ia_valid = ATTR_ATIME; 884 + break; 885 + case FS_UPD_CMTIME: 886 + iattr.ia_valid = ATTR_CTIME | ATTR_MTIME; 887 + break; 888 + } 881 889 882 - flags = inode_update_timestamps(inode, flags); 883 - 884 - memset(&iattr, 0, sizeof iattr); 885 - if (flags & S_ATIME) 886 - iattr.ia_valid |= ATTR_ATIME; 887 - if (flags & S_CTIME) 888 - iattr.ia_valid |= ATTR_CTIME; 889 - if (flags & S_MTIME) 890 - iattr.ia_valid |= ATTR_MTIME; 890 + dirty = inode_update_time(inode, type, flags); 891 + if (dirty <= 0) 892 + return dirty; 891 893 return __orangefs_setattr(inode, &iattr); 892 894 } 893 895
+2 -1
fs/orangefs/orangefs-kernel.h
··· 360 360 int orangefs_permission(struct mnt_idmap *idmap, 361 361 struct inode *inode, int mask); 362 362 363 - int orangefs_update_time(struct inode *, int); 363 + int orangefs_update_time(struct inode *inode, enum fs_update_time type, 364 + unsigned int flags); 364 365 365 366 /* 366 367 * defined in xattr.c
+3 -2
fs/overlayfs/inode.c
··· 555 555 } 556 556 #endif 557 557 558 - int ovl_update_time(struct inode *inode, int flags) 558 + int ovl_update_time(struct inode *inode, enum fs_update_time type, 559 + unsigned int flags) 559 560 { 560 - if (flags & S_ATIME) { 561 + if (type == FS_UPD_ATIME) { 561 562 struct ovl_fs *ofs = OVL_FS(inode->i_sb); 562 563 struct path upperpath = { 563 564 .mnt = ovl_upper_mnt(ofs),
+2 -1
fs/overlayfs/overlayfs.h
··· 820 820 } 821 821 #endif 822 822 823 - int ovl_update_time(struct inode *inode, int flags); 823 + int ovl_update_time(struct inode *inode, enum fs_update_time type, 824 + unsigned int flags); 824 825 bool ovl_is_private_xattr(struct super_block *sb, const char *name); 825 826 826 827 struct ovl_inode_params {
+8 -13
fs/ubifs/file.c
··· 1361 1361 return 0; 1362 1362 } 1363 1363 1364 - /** 1365 - * ubifs_update_time - update time of inode. 1366 - * @inode: inode to update 1367 - * @flags: time updating control flag determines updating 1368 - * which time fields of @inode 1369 - * 1370 - * This function updates time of the inode. 1371 - * 1372 - * Returns: %0 for success or a negative error code otherwise. 1373 - */ 1374 - int ubifs_update_time(struct inode *inode, int flags) 1364 + int ubifs_update_time(struct inode *inode, enum fs_update_time type, 1365 + unsigned int flags) 1375 1366 { 1376 1367 struct ubifs_inode *ui = ubifs_inode(inode); 1377 1368 struct ubifs_info *c = inode->i_sb->s_fs_info; ··· 1370 1379 .dirtied_ino_d = ALIGN(ui->data_len, 8) }; 1371 1380 int err, release; 1372 1381 1382 + /* ubifs sets S_NOCMTIME on all inodes, this should not happen. */ 1383 + if (WARN_ON_ONCE(type != FS_UPD_ATIME)) 1384 + return -EIO; 1385 + 1373 1386 if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT)) 1374 - return generic_update_time(inode, flags); 1387 + return generic_update_time(inode, type, flags); 1375 1388 1376 1389 err = ubifs_budget_space(c, &req); 1377 1390 if (err) 1378 1391 return err; 1379 1392 1380 1393 mutex_lock(&ui->ui_mutex); 1381 - inode_update_timestamps(inode, flags); 1394 + inode_update_time(inode, type, flags); 1382 1395 release = ui->dirty; 1383 1396 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1384 1397 mutex_unlock(&ui->ui_mutex);
+2 -1
fs/ubifs/ubifs.h
··· 2018 2018 int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync); 2019 2019 int ubifs_setattr(struct mnt_idmap *idmap, struct dentry *dentry, 2020 2020 struct iattr *attr); 2021 - int ubifs_update_time(struct inode *inode, int flags); 2021 + int ubifs_update_time(struct inode *inode, enum fs_update_time type, 2022 + unsigned int flags); 2022 2023 2023 2024 /* dir.c */ 2024 2025 struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
+8 -14
fs/xfs/xfs_iops.c
··· 1184 1184 STATIC int 1185 1185 xfs_vn_update_time( 1186 1186 struct inode *inode, 1187 - int flags) 1187 + enum fs_update_time type, 1188 + unsigned int flags) 1188 1189 { 1189 1190 struct xfs_inode *ip = XFS_I(inode); 1190 1191 struct xfs_mount *mp = ip->i_mount; 1191 1192 int log_flags = XFS_ILOG_TIMESTAMP; 1192 1193 struct xfs_trans *tp; 1193 1194 int error; 1194 - struct timespec64 now; 1195 1195 1196 1196 trace_xfs_update_time(ip); 1197 1197 1198 1198 if (inode->i_sb->s_flags & SB_LAZYTIME) { 1199 - if (!((flags & S_VERSION) && 1200 - inode_maybe_inc_iversion(inode, false))) 1201 - return generic_update_time(inode, flags); 1199 + if (type == FS_UPD_ATIME || 1200 + !inode_maybe_inc_iversion(inode, false)) 1201 + return generic_update_time(inode, type, flags); 1202 1202 1203 1203 /* Capture the iversion update that just occurred */ 1204 1204 log_flags |= XFS_ILOG_CORE; ··· 1209 1209 return error; 1210 1210 1211 1211 xfs_ilock(ip, XFS_ILOCK_EXCL); 1212 - if (flags & (S_CTIME|S_MTIME)) 1213 - now = inode_set_ctime_current(inode); 1212 + if (type == FS_UPD_ATIME) 1213 + inode_set_atime_to_ts(inode, current_time(inode)); 1214 1214 else 1215 - now = current_time(inode); 1216 - 1217 - if (flags & S_MTIME) 1218 - inode_set_mtime_to_ts(inode, now); 1219 - if (flags & S_ATIME) 1220 - inode_set_atime_to_ts(inode, now); 1221 - 1215 + inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); 1222 1216 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); 1223 1217 xfs_trans_log_inode(tp, ip, log_flags); 1224 1218 return xfs_trans_commit(tp);
+18 -10
include/linux/fs.h
··· 1717 1717 1718 1718 struct timespec64 simple_inode_init_ts(struct inode *inode); 1719 1719 1720 + static inline int inode_time_dirty_flag(struct inode *inode) 1721 + { 1722 + if (inode->i_sb->s_flags & SB_LAZYTIME) 1723 + return I_DIRTY_TIME; 1724 + return I_DIRTY_SYNC; 1725 + } 1726 + 1720 1727 /* 1721 1728 * Snapshotting support. 1722 1729 */ ··· 1990 1983 static int shared_##x(struct file *file , struct dir_context *ctx) \ 1991 1984 { return wrap_directory_iterator(file, ctx, x); } 1992 1985 1986 + enum fs_update_time { 1987 + FS_UPD_ATIME, 1988 + FS_UPD_CMTIME, 1989 + }; 1990 + 1993 1991 struct inode_operations { 1994 1992 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); 1995 1993 const char * (*get_link) (struct dentry *, struct inode *, struct delayed_call *); ··· 2022 2010 ssize_t (*listxattr) (struct dentry *, char *, size_t); 2023 2011 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, 2024 2012 u64 len); 2025 - int (*update_time)(struct inode *, int); 2013 + int (*update_time)(struct inode *inode, enum fs_update_time type, 2014 + unsigned int flags); 2026 2015 int (*atomic_open)(struct inode *, struct dentry *, 2027 2016 struct file *, unsigned open_flag, 2028 2017 umode_t create_mode); ··· 2250 2237 mark_inode_dirty(inode); 2251 2238 } 2252 2239 2253 - enum file_time_flags { 2254 - S_ATIME = 1, 2255 - S_MTIME = 2, 2256 - S_CTIME = 4, 2257 - S_VERSION = 8, 2258 - }; 2259 - 2260 2240 extern bool atime_needs_update(const struct path *, struct inode *); 2261 2241 extern void touch_atime(const struct path *); 2262 2242 ··· 2404 2398 extern void ihold(struct inode * inode); 2405 2399 extern void iput(struct inode *); 2406 2400 void iput_not_last(struct inode *); 2407 - int inode_update_timestamps(struct inode *inode, int flags); 2408 - int generic_update_time(struct inode *inode, int flags); 2401 + int inode_update_time(struct inode *inode, enum fs_update_time type, 2402 + unsigned int flags); 2403 + int generic_update_time(struct inode *inode, enum fs_update_time type, 2404 + unsigned int flags); 2409 2405 2410 2406 /* /sys/fs */ 2411 2407 extern struct kobject *fs_kobj;