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

Merge tag 'v6.6-vfs.ctime' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs timestamp updates from Christian Brauner:
"This adds VFS support for multi-grain timestamps and converts tmpfs,
xfs, ext4, and btrfs to use them. This carries acks from all relevant
filesystems.

The VFS always uses coarse-grained timestamps when updating the ctime
and mtime after a change. This has the benefit of allowing filesystems
to optimize away a lot of metadata updates, down to around 1 per
jiffy, even when a file is under heavy writes.

Unfortunately, this has always been an issue when we're exporting via
NFSv3, which relies on timestamps to validate caches. A lot of changes
can happen in a jiffy, so timestamps aren't sufficient to help the
client decide to invalidate the cache.

Even with NFSv4, a lot of exported filesystems don't properly support
a change attribute and are subject to the same problems with timestamp
granularity. Other applications have similar issues with timestamps
(e.g., backup applications).

If we were to always use fine-grained timestamps, that would improve
the situation, but that becomes rather expensive, as the underlying
filesystem would have to log a lot more metadata updates.

This introduces fine-grained timestamps that are used when they are
actively queried.

This uses the 31st bit of the ctime tv_nsec field to indicate that
something has queried the inode for the mtime or ctime. When this flag
is set, on the next mtime or ctime update, the kernel will fetch a
fine-grained timestamp instead of the usual coarse-grained one.

As POSIX generally mandates that when the mtime changes, the ctime
must also change the kernel always stores normalized ctime values, so
only the first 30 bits of the tv_nsec field are ever used.

Filesytems can opt into this behavior by setting the FS_MGTIME flag in
the fstype. Filesystems that don't set this flag will continue to use
coarse-grained timestamps.

Various preparatory changes, fixes and cleanups are included:

- Fixup all relevant places where POSIX requires updating ctime
together with mtime. This is a wide-range of places and all
maintainers provided necessary Acks.

- Add new accessors for inode->i_ctime directly and change all
callers to rely on them. Plain accesses to inode->i_ctime are now
gone and it is accordingly rename to inode->__i_ctime and commented
as requiring accessors.

- Extend generic_fillattr() to pass in a request mask mirroring in a
sense the statx() uapi. This allows callers to pass in a request
mask to only get a subset of attributes filled in.

- Rework timestamp updates so it's possible to drop the @now
parameter the update_time() inode operation and associated helpers.

- Add inode_update_timestamps() and convert all filesystems to it
removing a bunch of open-coding"

* tag 'v6.6-vfs.ctime' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (107 commits)
btrfs: convert to multigrain timestamps
ext4: switch to multigrain timestamps
xfs: switch to multigrain timestamps
tmpfs: add support for multigrain timestamps
fs: add infrastructure for multigrain timestamps
fs: drop the timespec64 argument from update_time
xfs: have xfs_vn_update_time gets its own timestamp
fat: make fat_update_time get its own timestamp
fat: remove i_version handling from fat_update_time
ubifs: have ubifs_update_time use inode_update_timestamps
btrfs: have it use inode_update_timestamps
fs: drop the timespec64 arg from generic_update_time
fs: pass the request_mask to generic_fillattr
fs: remove silly warning from current_time
gfs2: fix timestamp handling on quota inodes
fs: rename i_ctime field to __i_ctime
selinux: convert to ctime accessor functions
security: convert to ctime accessor functions
apparmor: convert to ctime accessor functions
sunrpc: convert to ctime accessor functions
...

+1268 -1050
+1 -1
arch/powerpc/platforms/cell/spufs/inode.c
··· 86 86 inode->i_mode = mode; 87 87 inode->i_uid = current_fsuid(); 88 88 inode->i_gid = current_fsgid(); 89 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 89 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 90 90 out: 91 91 return inode; 92 92 }
+2 -2
arch/s390/hypfs/inode.c
··· 53 53 struct inode *inode = d_inode(sb_info->update_file); 54 54 55 55 sb_info->last_update = ktime_get_seconds(); 56 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 56 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 57 57 } 58 58 59 59 /* directory tree removal functions */ ··· 101 101 ret->i_mode = mode; 102 102 ret->i_uid = hypfs_info->uid; 103 103 ret->i_gid = hypfs_info->gid; 104 - ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret); 104 + ret->i_atime = ret->i_mtime = inode_set_ctime_current(ret); 105 105 if (S_ISDIR(mode)) 106 106 set_nlink(ret, 2); 107 107 }
+4 -4
drivers/android/binderfs.c
··· 153 153 goto err; 154 154 155 155 inode->i_ino = minor + INODE_OFFSET; 156 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 156 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 157 157 init_special_inode(inode, S_IFCHR | 0600, 158 158 MKDEV(MAJOR(binderfs_dev), minor)); 159 159 inode->i_fop = &binder_fops; ··· 432 432 } 433 433 434 434 inode->i_ino = SECOND_INODE; 435 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 435 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 436 436 init_special_inode(inode, S_IFCHR | 0600, 437 437 MKDEV(MAJOR(binderfs_dev), minor)); 438 438 inode->i_fop = &binder_ctl_fops; ··· 474 474 if (ret) { 475 475 ret->i_ino = iunique(sb, BINDERFS_MAX_MINOR + INODE_OFFSET); 476 476 ret->i_mode = mode; 477 - ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret); 477 + ret->i_atime = ret->i_mtime = inode_set_ctime_current(ret); 478 478 } 479 479 return ret; 480 480 } ··· 703 703 inode->i_ino = FIRST_INODE; 704 704 inode->i_fop = &simple_dir_operations; 705 705 inode->i_mode = S_IFDIR | 0755; 706 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 706 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 707 707 inode->i_op = &binderfs_dir_inode_operations; 708 708 set_nlink(inode, 2); 709 709
+1 -2
drivers/infiniband/hw/qib/qib_fs.c
··· 64 64 inode->i_uid = GLOBAL_ROOT_UID; 65 65 inode->i_gid = GLOBAL_ROOT_GID; 66 66 inode->i_blocks = 0; 67 - inode->i_atime = current_time(inode); 67 + inode->i_atime = inode_set_ctime_current(inode); 68 68 inode->i_mtime = inode->i_atime; 69 - inode->i_ctime = inode->i_atime; 70 69 inode->i_private = data; 71 70 if (S_ISDIR(mode)) { 72 71 inode->i_op = &simple_dir_inode_operations;
+1 -1
drivers/misc/ibmasm/ibmasmfs.c
··· 139 139 if (ret) { 140 140 ret->i_ino = get_next_ino(); 141 141 ret->i_mode = mode; 142 - ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret); 142 + ret->i_atime = ret->i_mtime = inode_set_ctime_current(ret); 143 143 } 144 144 return ret; 145 145 }
+1 -1
drivers/misc/ibmvmc.c
··· 1124 1124 goto out; 1125 1125 1126 1126 inode = file_inode(file); 1127 - inode->i_mtime = current_time(inode); 1127 + inode->i_mtime = inode_set_ctime_current(inode); 1128 1128 mark_inode_dirty(inode); 1129 1129 1130 1130 dev_dbg(adapter->dev, "write: file = 0x%lx, count = 0x%lx\n",
+8 -8
drivers/usb/core/devio.c
··· 2642 2642 snoop(&dev->dev, "%s: CONTROL\n", __func__); 2643 2643 ret = proc_control(ps, p); 2644 2644 if (ret >= 0) 2645 - inode->i_mtime = inode->i_ctime = current_time(inode); 2645 + inode->i_mtime = inode_set_ctime_current(inode); 2646 2646 break; 2647 2647 2648 2648 case USBDEVFS_BULK: 2649 2649 snoop(&dev->dev, "%s: BULK\n", __func__); 2650 2650 ret = proc_bulk(ps, p); 2651 2651 if (ret >= 0) 2652 - inode->i_mtime = inode->i_ctime = current_time(inode); 2652 + inode->i_mtime = inode_set_ctime_current(inode); 2653 2653 break; 2654 2654 2655 2655 case USBDEVFS_RESETEP: 2656 2656 snoop(&dev->dev, "%s: RESETEP\n", __func__); 2657 2657 ret = proc_resetep(ps, p); 2658 2658 if (ret >= 0) 2659 - inode->i_mtime = inode->i_ctime = current_time(inode); 2659 + inode->i_mtime = inode_set_ctime_current(inode); 2660 2660 break; 2661 2661 2662 2662 case USBDEVFS_RESET: ··· 2668 2668 snoop(&dev->dev, "%s: CLEAR_HALT\n", __func__); 2669 2669 ret = proc_clearhalt(ps, p); 2670 2670 if (ret >= 0) 2671 - inode->i_mtime = inode->i_ctime = current_time(inode); 2671 + inode->i_mtime = inode_set_ctime_current(inode); 2672 2672 break; 2673 2673 2674 2674 case USBDEVFS_GETDRIVER: ··· 2695 2695 snoop(&dev->dev, "%s: SUBMITURB\n", __func__); 2696 2696 ret = proc_submiturb(ps, p); 2697 2697 if (ret >= 0) 2698 - inode->i_mtime = inode->i_ctime = current_time(inode); 2698 + inode->i_mtime = inode_set_ctime_current(inode); 2699 2699 break; 2700 2700 2701 2701 #ifdef CONFIG_COMPAT ··· 2703 2703 snoop(&dev->dev, "%s: CONTROL32\n", __func__); 2704 2704 ret = proc_control_compat(ps, p); 2705 2705 if (ret >= 0) 2706 - inode->i_mtime = inode->i_ctime = current_time(inode); 2706 + inode->i_mtime = inode_set_ctime_current(inode); 2707 2707 break; 2708 2708 2709 2709 case USBDEVFS_BULK32: 2710 2710 snoop(&dev->dev, "%s: BULK32\n", __func__); 2711 2711 ret = proc_bulk_compat(ps, p); 2712 2712 if (ret >= 0) 2713 - inode->i_mtime = inode->i_ctime = current_time(inode); 2713 + inode->i_mtime = inode_set_ctime_current(inode); 2714 2714 break; 2715 2715 2716 2716 case USBDEVFS_DISCSIGNAL32: ··· 2722 2722 snoop(&dev->dev, "%s: SUBMITURB32\n", __func__); 2723 2723 ret = proc_submiturb_compat(ps, p); 2724 2724 if (ret >= 0) 2725 - inode->i_mtime = inode->i_ctime = current_time(inode); 2725 + inode->i_mtime = inode_set_ctime_current(inode); 2726 2726 break; 2727 2727 2728 2728 case USBDEVFS_IOCTL32:
+1 -2
drivers/usb/gadget/function/f_fs.c
··· 1377 1377 inode = new_inode(sb); 1378 1378 1379 1379 if (inode) { 1380 - struct timespec64 ts = current_time(inode); 1380 + struct timespec64 ts = inode_set_ctime_current(inode); 1381 1381 1382 1382 inode->i_ino = get_next_ino(); 1383 1383 inode->i_mode = perms->mode; ··· 1385 1385 inode->i_gid = perms->gid; 1386 1386 inode->i_atime = ts; 1387 1387 inode->i_mtime = ts; 1388 - inode->i_ctime = ts; 1389 1388 inode->i_private = data; 1390 1389 if (fops) 1391 1390 inode->i_fop = fops;
+1 -2
drivers/usb/gadget/legacy/inode.c
··· 1969 1969 inode->i_mode = mode; 1970 1970 inode->i_uid = make_kuid(&init_user_ns, default_uid); 1971 1971 inode->i_gid = make_kgid(&init_user_ns, default_gid); 1972 - inode->i_atime = inode->i_mtime = inode->i_ctime 1973 - = current_time(inode); 1972 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 1974 1973 inode->i_private = data; 1975 1974 inode->i_fop = fops; 1976 1975 }
+4 -4
fs/9p/vfs_inode.c
··· 260 260 inode_init_owner(&nop_mnt_idmap, inode, NULL, mode); 261 261 inode->i_blocks = 0; 262 262 inode->i_rdev = rdev; 263 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 263 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 264 264 inode->i_mapping->a_ops = &v9fs_addr_operations; 265 265 inode->i_private = NULL; 266 266 ··· 1011 1011 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); 1012 1012 v9ses = v9fs_dentry2v9ses(dentry); 1013 1013 if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) { 1014 - generic_fillattr(&nop_mnt_idmap, inode, stat); 1014 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 1015 1015 return 0; 1016 1016 } else if (v9ses->cache & CACHE_WRITEBACK) { 1017 1017 if (S_ISREG(inode->i_mode)) { ··· 1032 1032 return PTR_ERR(st); 1033 1033 1034 1034 v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb, 0); 1035 - generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat); 1035 + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat); 1036 1036 1037 1037 p9stat_free(st); 1038 1038 kfree(st); ··· 1152 1152 1153 1153 inode->i_atime.tv_sec = stat->atime; 1154 1154 inode->i_mtime.tv_sec = stat->mtime; 1155 - inode->i_ctime.tv_sec = stat->mtime; 1155 + inode_set_ctime(inode, stat->mtime, 0); 1156 1156 1157 1157 inode->i_uid = v9ses->dfltuid; 1158 1158 inode->i_gid = v9ses->dfltgid;
+6 -6
fs/9p/vfs_inode_dotl.c
··· 450 450 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); 451 451 v9ses = v9fs_dentry2v9ses(dentry); 452 452 if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) { 453 - generic_fillattr(&nop_mnt_idmap, inode, stat); 453 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 454 454 return 0; 455 455 } else if (v9ses->cache) { 456 456 if (S_ISREG(inode->i_mode)) { ··· 475 475 return PTR_ERR(st); 476 476 477 477 v9fs_stat2inode_dotl(st, d_inode(dentry), 0); 478 - generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat); 478 + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat); 479 479 /* Change block size to what the server returned */ 480 480 stat->blksize = st->st_blksize; 481 481 ··· 645 645 inode->i_atime.tv_nsec = stat->st_atime_nsec; 646 646 inode->i_mtime.tv_sec = stat->st_mtime_sec; 647 647 inode->i_mtime.tv_nsec = stat->st_mtime_nsec; 648 - inode->i_ctime.tv_sec = stat->st_ctime_sec; 649 - inode->i_ctime.tv_nsec = stat->st_ctime_nsec; 648 + inode_set_ctime(inode, stat->st_ctime_sec, 649 + stat->st_ctime_nsec); 650 650 inode->i_uid = stat->st_uid; 651 651 inode->i_gid = stat->st_gid; 652 652 set_nlink(inode, stat->st_nlink); ··· 668 668 inode->i_mtime.tv_nsec = stat->st_mtime_nsec; 669 669 } 670 670 if (stat->st_result_mask & P9_STATS_CTIME) { 671 - inode->i_ctime.tv_sec = stat->st_ctime_sec; 672 - inode->i_ctime.tv_nsec = stat->st_ctime_nsec; 671 + inode_set_ctime(inode, stat->st_ctime_sec, 672 + stat->st_ctime_nsec); 673 673 } 674 674 if (stat->st_result_mask & P9_STATS_UID) 675 675 inode->i_uid = stat->st_uid;
+2 -2
fs/adfs/inode.c
··· 270 270 inode->i_mode = adfs_atts2mode(sb, inode); 271 271 adfs_adfs2unix_time(&inode->i_mtime, inode); 272 272 inode->i_atime = inode->i_mtime; 273 - inode->i_ctime = inode->i_mtime; 273 + inode_set_ctime_to_ts(inode, inode->i_mtime); 274 274 275 275 if (S_ISDIR(inode->i_mode)) { 276 276 inode->i_op = &adfs_dir_inode_operations; ··· 331 331 if (ia_valid & ATTR_ATIME) 332 332 inode->i_atime = attr->ia_atime; 333 333 if (ia_valid & ATTR_CTIME) 334 - inode->i_ctime = attr->ia_ctime; 334 + inode_set_ctime_to_ts(inode, attr->ia_ctime); 335 335 if (ia_valid & ATTR_MODE) { 336 336 ADFS_I(inode)->attr = adfs_mode2atts(sb, inode, attr->ia_mode); 337 337 inode->i_mode = adfs_atts2mode(sb, inode);
+3 -3
fs/affs/amigaffs.c
··· 60 60 mark_buffer_dirty_inode(dir_bh, dir); 61 61 affs_brelse(dir_bh); 62 62 63 - dir->i_mtime = dir->i_ctime = current_time(dir); 63 + dir->i_mtime = inode_set_ctime_current(dir); 64 64 inode_inc_iversion(dir); 65 65 mark_inode_dirty(dir); 66 66 ··· 114 114 115 115 affs_brelse(bh); 116 116 117 - dir->i_mtime = dir->i_ctime = current_time(dir); 117 + dir->i_mtime = inode_set_ctime_current(dir); 118 118 inode_inc_iversion(dir); 119 119 mark_inode_dirty(dir); 120 120 ··· 315 315 else 316 316 clear_nlink(inode); 317 317 affs_unlock_link(inode); 318 - inode->i_ctime = current_time(inode); 318 + inode_set_ctime_current(inode); 319 319 mark_inode_dirty(inode); 320 320 321 321 done:
+8 -8
fs/affs/inode.c
··· 149 149 break; 150 150 } 151 151 152 - inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec 153 - = (be32_to_cpu(tail->change.days) * 86400LL + 154 - be32_to_cpu(tail->change.mins) * 60 + 155 - be32_to_cpu(tail->change.ticks) / 50 + 156 - AFFS_EPOCH_DELTA) + 157 - sys_tz.tz_minuteswest * 60; 158 - inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_atime.tv_nsec = 0; 152 + inode->i_mtime.tv_sec = inode->i_atime.tv_sec = 153 + inode_set_ctime(inode, 154 + (be32_to_cpu(tail->change.days) * 86400LL + 155 + be32_to_cpu(tail->change.mins) * 60 + 156 + be32_to_cpu(tail->change.ticks) / 50 + AFFS_EPOCH_DELTA) 157 + + sys_tz.tz_minuteswest * 60, 0).tv_sec; 158 + inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = 0; 159 159 affs_brelse(bh); 160 160 unlock_new_inode(inode); 161 161 return inode; ··· 314 314 inode->i_gid = current_fsgid(); 315 315 inode->i_ino = block; 316 316 set_nlink(inode, 1); 317 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 317 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 318 318 atomic_set(&AFFS_I(inode)->i_opencnt, 0); 319 319 AFFS_I(inode)->i_blkcnt = 0; 320 320 AFFS_I(inode)->i_lc = NULL;
+1 -1
fs/afs/dynroot.c
··· 88 88 set_nlink(inode, 2); 89 89 inode->i_uid = GLOBAL_ROOT_UID; 90 90 inode->i_gid = GLOBAL_ROOT_GID; 91 - inode->i_ctime = inode->i_atime = inode->i_mtime = current_time(inode); 91 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 92 92 inode->i_blocks = 0; 93 93 inode->i_generation = 0; 94 94
+4 -4
fs/afs/inode.c
··· 90 90 vnode->status = *status; 91 91 92 92 t = status->mtime_client; 93 - inode->i_ctime = t; 93 + inode_set_ctime_to_ts(inode, t); 94 94 inode->i_mtime = t; 95 95 inode->i_atime = t; 96 96 inode->i_flags |= S_NOATIME; ··· 206 206 t = status->mtime_client; 207 207 inode->i_mtime = t; 208 208 if (vp->update_ctime) 209 - inode->i_ctime = op->ctime; 209 + inode_set_ctime_to_ts(inode, op->ctime); 210 210 211 211 if (vnode->status.data_version != status->data_version) 212 212 data_changed = true; ··· 252 252 vnode->netfs.remote_i_size = status->size; 253 253 if (change_size) { 254 254 afs_set_i_size(vnode, status->size); 255 - inode->i_ctime = t; 255 + inode_set_ctime_to_ts(inode, t); 256 256 inode->i_atime = t; 257 257 } 258 258 } ··· 773 773 774 774 do { 775 775 read_seqbegin_or_lock(&vnode->cb_lock, &seq); 776 - generic_fillattr(&nop_mnt_idmap, inode, stat); 776 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 777 777 if (test_bit(AFS_VNODE_SILLY_DELETED, &vnode->flags) && 778 778 stat->nlink > 0) 779 779 stat->nlink -= 1;
+1 -1
fs/attr.c
··· 312 312 if (ia_valid & ATTR_MTIME) 313 313 inode->i_mtime = attr->ia_mtime; 314 314 if (ia_valid & ATTR_CTIME) 315 - inode->i_ctime = attr->ia_ctime; 315 + inode_set_ctime_to_ts(inode, attr->ia_ctime); 316 316 if (ia_valid & ATTR_MODE) { 317 317 umode_t mode = attr->ia_mode; 318 318 if (!in_group_or_capable(idmap, inode,
+1 -1
fs/autofs/inode.c
··· 370 370 inode->i_uid = d_inode(sb->s_root)->i_uid; 371 371 inode->i_gid = d_inode(sb->s_root)->i_gid; 372 372 } 373 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 373 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 374 374 inode->i_ino = get_next_ino(); 375 375 376 376 if (S_ISDIR(mode)) {
+3 -3
fs/autofs/root.c
··· 600 600 p_ino = autofs_dentry_ino(dentry->d_parent); 601 601 p_ino->count++; 602 602 603 - dir->i_mtime = dir->i_ctime = current_time(dir); 603 + dir->i_mtime = inode_set_ctime_current(dir); 604 604 605 605 return 0; 606 606 } ··· 633 633 d_inode(dentry)->i_size = 0; 634 634 clear_nlink(d_inode(dentry)); 635 635 636 - dir->i_mtime = dir->i_ctime = current_time(dir); 636 + dir->i_mtime = inode_set_ctime_current(dir); 637 637 638 638 spin_lock(&sbi->lookup_lock); 639 639 __autofs_add_expiring(dentry); ··· 749 749 p_ino = autofs_dentry_ino(dentry->d_parent); 750 750 p_ino->count++; 751 751 inc_nlink(dir); 752 - dir->i_mtime = dir->i_ctime = current_time(dir); 752 + dir->i_mtime = inode_set_ctime_current(dir); 753 753 754 754 return 0; 755 755 }
+2 -4
fs/bad_inode.c
··· 133 133 return -EIO; 134 134 } 135 135 136 - static int bad_inode_update_time(struct inode *inode, struct timespec64 *time, 137 - int flags) 136 + static int bad_inode_update_time(struct inode *inode, int flags) 138 137 { 139 138 return -EIO; 140 139 } ··· 208 209 remove_inode_hash(inode); 209 210 210 211 inode->i_mode = S_IFREG; 211 - inode->i_atime = inode->i_mtime = inode->i_ctime = 212 - current_time(inode); 212 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 213 213 inode->i_op = &bad_inode_ops; 214 214 inode->i_opflags &= ~IOP_XATTR; 215 215 inode->i_fop = &bad_file_ops;
+1 -1
fs/befs/linuxvfs.c
··· 363 363 inode->i_mtime.tv_sec = 364 364 fs64_to_cpu(sb, raw_inode->last_modified_time) >> 16; 365 365 inode->i_mtime.tv_nsec = 0; /* lower 16 bits are not a time */ 366 - inode->i_ctime = inode->i_mtime; 366 + inode_set_ctime_to_ts(inode, inode->i_mtime); 367 367 inode->i_atime = inode->i_mtime; 368 368 369 369 befs_ino->i_inode_num = fsrun_to_cpu(sb, raw_inode->inode_num);
+8 -8
fs/bfs/dir.c
··· 97 97 set_bit(ino, info->si_imap); 98 98 info->si_freei--; 99 99 inode_init_owner(&nop_mnt_idmap, inode, dir, mode); 100 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 100 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 101 101 inode->i_blocks = 0; 102 102 inode->i_op = &bfs_file_inops; 103 103 inode->i_fop = &bfs_file_operations; ··· 158 158 return err; 159 159 } 160 160 inc_nlink(inode); 161 - inode->i_ctime = current_time(inode); 161 + inode_set_ctime_current(inode); 162 162 mark_inode_dirty(inode); 163 163 ihold(inode); 164 164 d_instantiate(new, inode); ··· 187 187 } 188 188 de->ino = 0; 189 189 mark_buffer_dirty_inode(bh, dir); 190 - dir->i_ctime = dir->i_mtime = current_time(dir); 190 + dir->i_mtime = inode_set_ctime_current(dir); 191 191 mark_inode_dirty(dir); 192 - inode->i_ctime = dir->i_ctime; 192 + inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); 193 193 inode_dec_link_count(inode); 194 194 error = 0; 195 195 ··· 240 240 goto end_rename; 241 241 } 242 242 old_de->ino = 0; 243 - old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); 243 + old_dir->i_mtime = inode_set_ctime_current(old_dir); 244 244 mark_inode_dirty(old_dir); 245 245 if (new_inode) { 246 - new_inode->i_ctime = current_time(new_inode); 246 + inode_set_ctime_current(new_inode); 247 247 inode_dec_link_count(new_inode); 248 248 } 249 249 mark_buffer_dirty_inode(old_bh, old_dir); ··· 292 292 pos = (block - sblock) * BFS_BSIZE + off; 293 293 if (pos >= dir->i_size) { 294 294 dir->i_size += BFS_DIRENT_SIZE; 295 - dir->i_ctime = current_time(dir); 295 + inode_set_ctime_current(dir); 296 296 } 297 - dir->i_mtime = current_time(dir); 297 + dir->i_mtime = inode_set_ctime_current(dir); 298 298 mark_inode_dirty(dir); 299 299 de->ino = cpu_to_le16((u16)ino); 300 300 for (i = 0; i < BFS_NAMELEN; i++)
+2 -3
fs/bfs/inode.c
··· 82 82 inode->i_blocks = BFS_FILEBLOCKS(di); 83 83 inode->i_atime.tv_sec = le32_to_cpu(di->i_atime); 84 84 inode->i_mtime.tv_sec = le32_to_cpu(di->i_mtime); 85 - inode->i_ctime.tv_sec = le32_to_cpu(di->i_ctime); 85 + inode_set_ctime(inode, le32_to_cpu(di->i_ctime), 0); 86 86 inode->i_atime.tv_nsec = 0; 87 87 inode->i_mtime.tv_nsec = 0; 88 - inode->i_ctime.tv_nsec = 0; 89 88 90 89 brelse(bh); 91 90 unlock_new_inode(inode); ··· 142 143 di->i_nlink = cpu_to_le32(inode->i_nlink); 143 144 di->i_atime = cpu_to_le32(inode->i_atime.tv_sec); 144 145 di->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec); 145 - di->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec); 146 + di->i_ctime = cpu_to_le32(inode_get_ctime(inode).tv_sec); 146 147 i_sblock = BFS_I(inode)->i_sblock; 147 148 di->i_sblock = cpu_to_le32(i_sblock); 148 149 di->i_eblock = cpu_to_le32(BFS_I(inode)->i_eblock);
+1 -2
fs/binfmt_misc.c
··· 547 547 if (inode) { 548 548 inode->i_ino = get_next_ino(); 549 549 inode->i_mode = mode; 550 - inode->i_atime = inode->i_mtime = inode->i_ctime = 551 - current_time(inode); 550 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 552 551 } 553 552 return inode; 554 553 }
+4 -4
fs/btrfs/delayed-inode.c
··· 1809 1809 inode->i_mtime.tv_nsec); 1810 1810 1811 1811 btrfs_set_stack_timespec_sec(&inode_item->ctime, 1812 - inode->i_ctime.tv_sec); 1812 + inode_get_ctime(inode).tv_sec); 1813 1813 btrfs_set_stack_timespec_nsec(&inode_item->ctime, 1814 - inode->i_ctime.tv_nsec); 1814 + inode_get_ctime(inode).tv_nsec); 1815 1815 1816 1816 btrfs_set_stack_timespec_sec(&inode_item->otime, 1817 1817 BTRFS_I(inode)->i_otime.tv_sec); ··· 1862 1862 inode->i_mtime.tv_sec = btrfs_stack_timespec_sec(&inode_item->mtime); 1863 1863 inode->i_mtime.tv_nsec = btrfs_stack_timespec_nsec(&inode_item->mtime); 1864 1864 1865 - inode->i_ctime.tv_sec = btrfs_stack_timespec_sec(&inode_item->ctime); 1866 - inode->i_ctime.tv_nsec = btrfs_stack_timespec_nsec(&inode_item->ctime); 1865 + inode_set_ctime(inode, btrfs_stack_timespec_sec(&inode_item->ctime), 1866 + btrfs_stack_timespec_nsec(&inode_item->ctime)); 1867 1867 1868 1868 BTRFS_I(inode)->i_otime.tv_sec = 1869 1869 btrfs_stack_timespec_sec(&inode_item->otime);
+9 -28
fs/btrfs/file.c
··· 1106 1106 btrfs_drew_write_unlock(&inode->root->snapshot_lock); 1107 1107 } 1108 1108 1109 - static void update_time_for_write(struct inode *inode) 1110 - { 1111 - struct timespec64 now; 1112 - 1113 - if (IS_NOCMTIME(inode)) 1114 - return; 1115 - 1116 - now = current_time(inode); 1117 - if (!timespec64_equal(&inode->i_mtime, &now)) 1118 - inode->i_mtime = now; 1119 - 1120 - if (!timespec64_equal(&inode->i_ctime, &now)) 1121 - inode->i_ctime = now; 1122 - 1123 - if (IS_I_VERSION(inode)) 1124 - inode_inc_iversion(inode); 1125 - } 1126 - 1127 1109 static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from, 1128 1110 size_t count) 1129 1111 { ··· 1137 1155 * need to start yet another transaction to update the inode as we will 1138 1156 * update the inode when we finish writing whatever data we write. 1139 1157 */ 1140 - update_time_for_write(inode); 1158 + if (!IS_NOCMTIME(inode)) { 1159 + inode->i_mtime = inode_set_ctime_current(inode); 1160 + inode_inc_iversion(inode); 1161 + } 1141 1162 1142 1163 start_pos = round_down(pos, fs_info->sectorsize); 1143 1164 oldsize = i_size_read(inode); ··· 2444 2459 */ 2445 2460 inode_inc_iversion(&inode->vfs_inode); 2446 2461 2447 - if (!extent_info || extent_info->update_times) { 2448 - inode->vfs_inode.i_mtime = current_time(&inode->vfs_inode); 2449 - inode->vfs_inode.i_ctime = inode->vfs_inode.i_mtime; 2450 - } 2462 + if (!extent_info || extent_info->update_times) 2463 + inode->vfs_inode.i_mtime = inode_set_ctime_current(&inode->vfs_inode); 2451 2464 2452 2465 ret = btrfs_update_inode(trans, root, inode); 2453 2466 if (ret) ··· 2686 2703 2687 2704 ASSERT(trans != NULL); 2688 2705 inode_inc_iversion(inode); 2689 - inode->i_mtime = current_time(inode); 2690 - inode->i_ctime = inode->i_mtime; 2706 + inode->i_mtime = inode_set_ctime_current(inode); 2691 2707 ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); 2692 2708 updated_inode = true; 2693 2709 btrfs_end_transaction(trans); ··· 2703 2721 * for detecting, at fsync time, if the inode isn't yet in the 2704 2722 * log tree or it's there but not up to date. 2705 2723 */ 2706 - struct timespec64 now = current_time(inode); 2724 + struct timespec64 now = inode_set_ctime_current(inode); 2707 2725 2708 2726 inode_inc_iversion(inode); 2709 2727 inode->i_mtime = now; 2710 - inode->i_ctime = now; 2711 2728 trans = btrfs_start_transaction(root, 1); 2712 2729 if (IS_ERR(trans)) { 2713 2730 ret = PTR_ERR(trans); ··· 2777 2796 if (IS_ERR(trans)) 2778 2797 return PTR_ERR(trans); 2779 2798 2780 - inode->i_ctime = current_time(inode); 2799 + inode_set_ctime_current(inode); 2781 2800 i_size_write(inode, end); 2782 2801 btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0); 2783 2802 ret = btrfs_update_inode(trans, root, BTRFS_I(inode));
+20 -46
fs/btrfs/inode.c
··· 3917 3917 inode->i_mtime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->mtime); 3918 3918 inode->i_mtime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->mtime); 3919 3919 3920 - inode->i_ctime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->ctime); 3921 - inode->i_ctime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->ctime); 3920 + inode_set_ctime(inode, btrfs_timespec_sec(leaf, &inode_item->ctime), 3921 + btrfs_timespec_nsec(leaf, &inode_item->ctime)); 3922 3922 3923 3923 BTRFS_I(inode)->i_otime.tv_sec = 3924 3924 btrfs_timespec_sec(leaf, &inode_item->otime); ··· 4089 4089 inode->i_mtime.tv_nsec); 4090 4090 4091 4091 btrfs_set_token_timespec_sec(&token, &item->ctime, 4092 - inode->i_ctime.tv_sec); 4092 + inode_get_ctime(inode).tv_sec); 4093 4093 btrfs_set_token_timespec_nsec(&token, &item->ctime, 4094 - inode->i_ctime.tv_nsec); 4094 + inode_get_ctime(inode).tv_nsec); 4095 4095 4096 4096 btrfs_set_token_timespec_sec(&token, &item->otime, 4097 4097 BTRFS_I(inode)->i_otime.tv_sec); ··· 4289 4289 btrfs_i_size_write(dir, dir->vfs_inode.i_size - name->len * 2); 4290 4290 inode_inc_iversion(&inode->vfs_inode); 4291 4291 inode_inc_iversion(&dir->vfs_inode); 4292 - inode->vfs_inode.i_ctime = current_time(&inode->vfs_inode); 4293 - dir->vfs_inode.i_mtime = inode->vfs_inode.i_ctime; 4294 - dir->vfs_inode.i_ctime = inode->vfs_inode.i_ctime; 4292 + inode_set_ctime_current(&inode->vfs_inode); 4293 + dir->vfs_inode.i_mtime = inode_set_ctime_current(&dir->vfs_inode); 4295 4294 ret = btrfs_update_inode(trans, root, dir); 4296 4295 out: 4297 4296 return ret; ··· 4463 4464 4464 4465 btrfs_i_size_write(dir, dir->vfs_inode.i_size - fname.disk_name.len * 2); 4465 4466 inode_inc_iversion(&dir->vfs_inode); 4466 - dir->vfs_inode.i_mtime = current_time(&dir->vfs_inode); 4467 - dir->vfs_inode.i_ctime = dir->vfs_inode.i_mtime; 4467 + dir->vfs_inode.i_mtime = inode_set_ctime_current(&dir->vfs_inode); 4468 4468 ret = btrfs_update_inode_fallback(trans, root, dir); 4469 4469 if (ret) 4470 4470 btrfs_abort_transaction(trans, ret); ··· 5113 5115 if (newsize != oldsize) { 5114 5116 inode_inc_iversion(inode); 5115 5117 if (!(mask & (ATTR_CTIME | ATTR_MTIME))) { 5116 - inode->i_mtime = current_time(inode); 5117 - inode->i_ctime = inode->i_mtime; 5118 + inode->i_mtime = inode_set_ctime_current(inode); 5118 5119 } 5119 5120 } 5120 5121 ··· 5757 5760 inode->i_opflags &= ~IOP_XATTR; 5758 5761 inode->i_fop = &simple_dir_operations; 5759 5762 inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO; 5760 - inode->i_mtime = current_time(inode); 5763 + inode->i_mtime = inode_set_ctime_current(inode); 5761 5764 inode->i_atime = inode->i_mtime; 5762 - inode->i_ctime = inode->i_mtime; 5763 5765 BTRFS_I(inode)->i_otime = inode->i_mtime; 5764 5766 5765 5767 return inode; ··· 6161 6165 * This is a copy of file_update_time. We need this so we can return error on 6162 6166 * ENOSPC for updating the inode in the case of file write and mmap writes. 6163 6167 */ 6164 - static int btrfs_update_time(struct inode *inode, struct timespec64 *now, 6165 - int flags) 6168 + static int btrfs_update_time(struct inode *inode, int flags) 6166 6169 { 6167 6170 struct btrfs_root *root = BTRFS_I(inode)->root; 6168 6171 bool dirty = flags & ~S_VERSION; ··· 6169 6174 if (btrfs_root_readonly(root)) 6170 6175 return -EROFS; 6171 6176 6172 - if (flags & S_VERSION) 6173 - dirty |= inode_maybe_inc_iversion(inode, dirty); 6174 - if (flags & S_CTIME) 6175 - inode->i_ctime = *now; 6176 - if (flags & S_MTIME) 6177 - inode->i_mtime = *now; 6178 - if (flags & S_ATIME) 6179 - inode->i_atime = *now; 6177 + dirty = inode_update_timestamps(inode, flags); 6180 6178 return dirty ? btrfs_dirty_inode(BTRFS_I(inode)) : 0; 6181 6179 } 6182 6180 ··· 6417 6429 goto discard; 6418 6430 } 6419 6431 6420 - inode->i_mtime = current_time(inode); 6432 + inode->i_mtime = inode_set_ctime_current(inode); 6421 6433 inode->i_atime = inode->i_mtime; 6422 - inode->i_ctime = inode->i_mtime; 6423 6434 BTRFS_I(inode)->i_otime = inode->i_mtime; 6424 6435 6425 6436 /* ··· 6583 6596 * log replay procedure is responsible for setting them to their correct 6584 6597 * values (the ones it had when the fsync was done). 6585 6598 */ 6586 - if (!test_bit(BTRFS_FS_LOG_RECOVERING, &root->fs_info->flags)) { 6587 - struct timespec64 now = current_time(&parent_inode->vfs_inode); 6599 + if (!test_bit(BTRFS_FS_LOG_RECOVERING, &root->fs_info->flags)) 6600 + parent_inode->vfs_inode.i_mtime = 6601 + inode_set_ctime_current(&parent_inode->vfs_inode); 6588 6602 6589 - parent_inode->vfs_inode.i_mtime = now; 6590 - parent_inode->vfs_inode.i_ctime = now; 6591 - } 6592 6603 ret = btrfs_update_inode(trans, root, parent_inode); 6593 6604 if (ret) 6594 6605 btrfs_abort_transaction(trans, ret); ··· 6726 6741 BTRFS_I(inode)->dir_index = 0ULL; 6727 6742 inc_nlink(inode); 6728 6743 inode_inc_iversion(inode); 6729 - inode->i_ctime = current_time(inode); 6744 + inode_set_ctime_current(inode); 6730 6745 ihold(inode); 6731 6746 set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags); 6732 6747 ··· 8792 8807 STATX_ATTR_IMMUTABLE | 8793 8808 STATX_ATTR_NODUMP); 8794 8809 8795 - generic_fillattr(idmap, inode, stat); 8810 + generic_fillattr(idmap, request_mask, inode, stat); 8796 8811 stat->dev = BTRFS_I(inode)->root->anon_dev; 8797 8812 8798 8813 spin_lock(&BTRFS_I(inode)->lock); ··· 8816 8831 struct btrfs_root *dest = BTRFS_I(new_dir)->root; 8817 8832 struct inode *new_inode = new_dentry->d_inode; 8818 8833 struct inode *old_inode = old_dentry->d_inode; 8819 - struct timespec64 ctime = current_time(old_inode); 8820 8834 struct btrfs_rename_ctx old_rename_ctx; 8821 8835 struct btrfs_rename_ctx new_rename_ctx; 8822 8836 u64 old_ino = btrfs_ino(BTRFS_I(old_inode)); ··· 8946 8962 inode_inc_iversion(new_dir); 8947 8963 inode_inc_iversion(old_inode); 8948 8964 inode_inc_iversion(new_inode); 8949 - old_dir->i_mtime = ctime; 8950 - old_dir->i_ctime = ctime; 8951 - new_dir->i_mtime = ctime; 8952 - new_dir->i_ctime = ctime; 8953 - old_inode->i_ctime = ctime; 8954 - new_inode->i_ctime = ctime; 8965 + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); 8955 8966 8956 8967 if (old_dentry->d_parent != new_dentry->d_parent) { 8957 8968 btrfs_record_unlink_dir(trans, BTRFS_I(old_dir), ··· 9210 9231 inode_inc_iversion(old_dir); 9211 9232 inode_inc_iversion(new_dir); 9212 9233 inode_inc_iversion(old_inode); 9213 - old_dir->i_mtime = current_time(old_dir); 9214 - old_dir->i_ctime = old_dir->i_mtime; 9215 - new_dir->i_mtime = old_dir->i_mtime; 9216 - new_dir->i_ctime = old_dir->i_mtime; 9217 - old_inode->i_ctime = old_dir->i_mtime; 9234 + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); 9218 9235 9219 9236 if (old_dentry->d_parent != new_dentry->d_parent) 9220 9237 btrfs_record_unlink_dir(trans, BTRFS_I(old_dir), ··· 9232 9257 9233 9258 if (new_inode) { 9234 9259 inode_inc_iversion(new_inode); 9235 - new_inode->i_ctime = current_time(new_inode); 9236 9260 if (unlikely(btrfs_ino(BTRFS_I(new_inode)) == 9237 9261 BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { 9238 9262 ret = btrfs_unlink_subvol(trans, BTRFS_I(new_dir), new_dentry); ··· 9771 9797 *alloc_hint = ins.objectid + ins.offset; 9772 9798 9773 9799 inode_inc_iversion(inode); 9774 - inode->i_ctime = current_time(inode); 9800 + inode_set_ctime_current(inode); 9775 9801 BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; 9776 9802 if (!(mode & FALLOC_FL_KEEP_SIZE) && 9777 9803 (actual_len > inode->i_size) &&
+1 -1
fs/btrfs/ioctl.c
··· 384 384 binode->flags = binode_flags; 385 385 btrfs_sync_inode_flags_to_i_flags(inode); 386 386 inode_inc_iversion(inode); 387 - inode->i_ctime = current_time(inode); 387 + inode_set_ctime_current(inode); 388 388 ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); 389 389 390 390 out_end_trans:
+1 -2
fs/btrfs/reflink.c
··· 30 30 31 31 inode_inc_iversion(inode); 32 32 if (!no_time_update) { 33 - inode->i_mtime = current_time(inode); 34 - inode->i_ctime = inode->i_mtime; 33 + inode->i_mtime = inode_set_ctime_current(inode); 35 34 } 36 35 /* 37 36 * We round up to the block size at eof when determining which
+3 -2
fs/btrfs/super.c
··· 2144 2144 .name = "btrfs", 2145 2145 .mount = btrfs_mount, 2146 2146 .kill_sb = btrfs_kill_super, 2147 - .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA, 2147 + .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_MGTIME, 2148 2148 }; 2149 2149 2150 2150 static struct file_system_type btrfs_root_fs_type = { ··· 2152 2152 .name = "btrfs", 2153 2153 .mount = btrfs_mount_root, 2154 2154 .kill_sb = btrfs_kill_super, 2155 - .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP, 2155 + .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | 2156 + FS_ALLOW_IDMAP | FS_MGTIME, 2156 2157 }; 2157 2158 2158 2159 MODULE_ALIAS_FS("btrfs");
+1 -2
fs/btrfs/transaction.c
··· 1837 1837 1838 1838 btrfs_i_size_write(BTRFS_I(parent_inode), parent_inode->i_size + 1839 1839 fname.disk_name.len * 2); 1840 - parent_inode->i_mtime = current_time(parent_inode); 1841 - parent_inode->i_ctime = parent_inode->i_mtime; 1840 + parent_inode->i_mtime = inode_set_ctime_current(parent_inode); 1842 1841 ret = btrfs_update_inode_fallback(trans, parent_root, BTRFS_I(parent_inode)); 1843 1842 if (ret) { 1844 1843 btrfs_abort_transaction(trans, ret);
+2 -2
fs/btrfs/tree-log.c
··· 4148 4148 inode->i_mtime.tv_nsec); 4149 4149 4150 4150 btrfs_set_token_timespec_sec(&token, &item->ctime, 4151 - inode->i_ctime.tv_sec); 4151 + inode_get_ctime(inode).tv_sec); 4152 4152 btrfs_set_token_timespec_nsec(&token, &item->ctime, 4153 - inode->i_ctime.tv_nsec); 4153 + inode_get_ctime(inode).tv_nsec); 4154 4154 4155 4155 /* 4156 4156 * We do not need to set the nbytes field, in fact during a fast fsync
+1 -3
fs/btrfs/volumes.c
··· 1917 1917 static void update_dev_time(const char *device_path) 1918 1918 { 1919 1919 struct path path; 1920 - struct timespec64 now; 1921 1920 int ret; 1922 1921 1923 1922 ret = kern_path(device_path, LOOKUP_FOLLOW, &path); 1924 1923 if (ret) 1925 1924 return; 1926 1925 1927 - now = current_time(d_inode(path.dentry)); 1928 - inode_update_time(d_inode(path.dentry), &now, S_MTIME | S_CTIME | S_VERSION); 1926 + inode_update_time(d_inode(path.dentry), S_MTIME | S_CTIME | S_VERSION); 1929 1927 path_put(&path); 1930 1928 } 1931 1929
+2 -2
fs/btrfs/xattr.c
··· 264 264 goto out; 265 265 266 266 inode_inc_iversion(inode); 267 - inode->i_ctime = current_time(inode); 267 + inode_set_ctime_current(inode); 268 268 ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); 269 269 if (ret) 270 270 btrfs_abort_transaction(trans, ret); ··· 407 407 ret = btrfs_set_prop(trans, inode, name, value, size, flags); 408 408 if (!ret) { 409 409 inode_inc_iversion(inode); 410 - inode->i_ctime = current_time(inode); 410 + inode_set_ctime_current(inode); 411 411 ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); 412 412 if (ret) 413 413 btrfs_abort_transaction(trans, ret);
+1 -1
fs/ceph/acl.c
··· 93 93 char *value = NULL; 94 94 struct iattr newattrs; 95 95 struct inode *inode = d_inode(dentry); 96 - struct timespec64 old_ctime = inode->i_ctime; 96 + struct timespec64 old_ctime = inode_get_ctime(inode); 97 97 umode_t new_mode = inode->i_mode, old_mode = inode->i_mode; 98 98 99 99 if (ceph_snap(inode) != CEPH_NOSNAP) {
+1 -1
fs/ceph/caps.c
··· 1400 1400 1401 1401 arg->mtime = inode->i_mtime; 1402 1402 arg->atime = inode->i_atime; 1403 - arg->ctime = inode->i_ctime; 1403 + arg->ctime = inode_get_ctime(inode); 1404 1404 arg->btime = ci->i_btime; 1405 1405 arg->change_attr = inode_peek_iversion_raw(inode); 1406 1406
+10 -8
fs/ceph/inode.c
··· 100 100 inode->i_uid = parent->i_uid; 101 101 inode->i_gid = parent->i_gid; 102 102 inode->i_mtime = parent->i_mtime; 103 - inode->i_ctime = parent->i_ctime; 103 + inode_set_ctime_to_ts(inode, inode_get_ctime(parent)); 104 104 inode->i_atime = parent->i_atime; 105 105 ci->i_rbytes = 0; 106 106 ci->i_btime = ceph_inode(parent)->i_btime; ··· 688 688 struct timespec64 *mtime, struct timespec64 *atime) 689 689 { 690 690 struct ceph_inode_info *ci = ceph_inode(inode); 691 + struct timespec64 ictime = inode_get_ctime(inode); 691 692 int warn = 0; 692 693 693 694 if (issued & (CEPH_CAP_FILE_EXCL| ··· 697 696 CEPH_CAP_AUTH_EXCL| 698 697 CEPH_CAP_XATTR_EXCL)) { 699 698 if (ci->i_version == 0 || 700 - timespec64_compare(ctime, &inode->i_ctime) > 0) { 699 + timespec64_compare(ctime, &ictime) > 0) { 701 700 dout("ctime %lld.%09ld -> %lld.%09ld inc w/ cap\n", 702 - inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, 701 + ictime.tv_sec, ictime.tv_nsec, 703 702 ctime->tv_sec, ctime->tv_nsec); 704 - inode->i_ctime = *ctime; 703 + inode_set_ctime_to_ts(inode, *ctime); 705 704 } 706 705 if (ci->i_version == 0 || 707 706 ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) { ··· 739 738 } else { 740 739 /* we have no write|excl caps; whatever the MDS says is true */ 741 740 if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) { 742 - inode->i_ctime = *ctime; 741 + inode_set_ctime_to_ts(inode, *ctime); 743 742 inode->i_mtime = *mtime; 744 743 inode->i_atime = *atime; 745 744 ci->i_time_warp_seq = time_warp_seq; ··· 2167 2166 bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME| 2168 2167 ATTR_MODE|ATTR_UID|ATTR_GID)) == 0; 2169 2168 dout("setattr %p ctime %lld.%ld -> %lld.%ld (%s)\n", inode, 2170 - inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, 2169 + inode_get_ctime(inode).tv_sec, 2170 + inode_get_ctime(inode).tv_nsec, 2171 2171 attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec, 2172 2172 only ? "ctime only" : "ignored"); 2173 2173 if (only) { ··· 2193 2191 if (dirtied) { 2194 2192 inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied, 2195 2193 &prealloc_cf); 2196 - inode->i_ctime = attr->ia_ctime; 2194 + inode_set_ctime_to_ts(inode, attr->ia_ctime); 2197 2195 inode_inc_iversion_raw(inode); 2198 2196 } 2199 2197 ··· 2467 2465 return err; 2468 2466 } 2469 2467 2470 - generic_fillattr(&nop_mnt_idmap, inode, stat); 2468 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 2471 2469 stat->ino = ceph_present_inode(inode); 2472 2470 2473 2471 /*
+1 -1
fs/ceph/snap.c
··· 660 660 capsnap->size = i_size_read(inode); 661 661 capsnap->mtime = inode->i_mtime; 662 662 capsnap->atime = inode->i_atime; 663 - capsnap->ctime = inode->i_ctime; 663 + capsnap->ctime = inode_get_ctime(inode); 664 664 capsnap->btime = ci->i_btime; 665 665 capsnap->change_attr = inode_peek_iversion_raw(inode); 666 666 capsnap->time_warp_seq = ci->i_time_warp_seq;
+1 -1
fs/ceph/xattr.c
··· 1238 1238 dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL, 1239 1239 &prealloc_cf); 1240 1240 ci->i_xattrs.dirty = true; 1241 - inode->i_ctime = current_time(inode); 1241 + inode_set_ctime_current(inode); 1242 1242 } 1243 1243 1244 1244 spin_unlock(&ci->i_ceph_lock);
+2 -1
fs/coda/coda_linux.c
··· 127 127 if (attr->va_mtime.tv_sec != -1) 128 128 inode->i_mtime = coda_to_timespec64(attr->va_mtime); 129 129 if (attr->va_ctime.tv_sec != -1) 130 - inode->i_ctime = coda_to_timespec64(attr->va_ctime); 130 + inode_set_ctime_to_ts(inode, 131 + coda_to_timespec64(attr->va_ctime)); 131 132 } 132 133 133 134
+1 -1
fs/coda/dir.c
··· 111 111 /* optimistically we can also act as if our nose bleeds. The 112 112 * granularity of the mtime is coarse anyways so we might actually be 113 113 * right most of the time. Note: we only do this for directories. */ 114 - dir->i_mtime = dir->i_ctime = current_time(dir); 114 + dir->i_mtime = inode_set_ctime_current(dir); 115 115 #endif 116 116 } 117 117
+1 -1
fs/coda/file.c
··· 84 84 ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos, 0); 85 85 coda_inode->i_size = file_inode(host_file)->i_size; 86 86 coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9; 87 - coda_inode->i_mtime = coda_inode->i_ctime = current_time(coda_inode); 87 + coda_inode->i_mtime = inode_set_ctime_current(coda_inode); 88 88 inode_unlock(coda_inode); 89 89 file_end_write(host_file); 90 90
+3 -2
fs/coda/inode.c
··· 256 256 { 257 257 int err = coda_revalidate_inode(d_inode(path->dentry)); 258 258 if (!err) 259 - generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat); 259 + generic_fillattr(&nop_mnt_idmap, request_mask, 260 + d_inode(path->dentry), stat); 260 261 return err; 261 262 } 262 263 ··· 270 269 271 270 memset(&vattr, 0, sizeof(vattr)); 272 271 273 - inode->i_ctime = current_time(inode); 272 + inode_set_ctime_current(inode); 274 273 coda_iattr_to_vattr(iattr, &vattr); 275 274 vattr.va_type = C_VNON; /* cannot set type */ 276 275
+3 -4
fs/configfs/inode.c
··· 88 88 static inline void set_default_inode_attr(struct inode * inode, umode_t mode) 89 89 { 90 90 inode->i_mode = mode; 91 - inode->i_atime = inode->i_mtime = 92 - inode->i_ctime = current_time(inode); 91 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 93 92 } 94 93 95 94 static inline void set_inode_attr(struct inode * inode, struct iattr * iattr) ··· 98 99 inode->i_gid = iattr->ia_gid; 99 100 inode->i_atime = iattr->ia_atime; 100 101 inode->i_mtime = iattr->ia_mtime; 101 - inode->i_ctime = iattr->ia_ctime; 102 + inode_set_ctime_to_ts(inode, iattr->ia_ctime); 102 103 } 103 104 104 105 struct inode *configfs_new_inode(umode_t mode, struct configfs_dirent *sd, ··· 171 172 return ERR_PTR(-ENOMEM); 172 173 173 174 p_inode = d_inode(dentry->d_parent); 174 - p_inode->i_mtime = p_inode->i_ctime = current_time(p_inode); 175 + p_inode->i_mtime = inode_set_ctime_current(p_inode); 175 176 configfs_set_inode_lock_class(sd, inode); 176 177 return inode; 177 178 }
+2 -1
fs/cramfs/inode.c
··· 133 133 } 134 134 135 135 /* Struct copy intentional */ 136 - inode->i_mtime = inode->i_atime = inode->i_ctime = zerotime; 136 + inode->i_mtime = inode->i_atime = inode_set_ctime_to_ts(inode, 137 + zerotime); 137 138 /* inode->i_nlink is left 1 - arguably wrong for directories, 138 139 but it's the best we can do without reading the directory 139 140 contents. 1 yields the right result in GNU find, even
+1 -2
fs/debugfs/inode.c
··· 72 72 struct inode *inode = new_inode(sb); 73 73 if (inode) { 74 74 inode->i_ino = get_next_ino(); 75 - inode->i_atime = inode->i_mtime = 76 - inode->i_ctime = current_time(inode); 75 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 77 76 } 78 77 return inode; 79 78 }
+3 -3
fs/devpts/inode.c
··· 338 338 } 339 339 340 340 inode->i_ino = 2; 341 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 341 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 342 342 343 343 mode = S_IFCHR|opts->ptmxmode; 344 344 init_special_inode(inode, mode, MKDEV(TTYAUX_MAJOR, 2)); ··· 451 451 if (!inode) 452 452 goto fail; 453 453 inode->i_ino = 1; 454 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 454 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 455 455 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; 456 456 inode->i_op = &simple_dir_inode_operations; 457 457 inode->i_fop = &simple_dir_operations; ··· 560 560 inode->i_ino = index + 3; 561 561 inode->i_uid = opts->setuid ? opts->uid : current_fsuid(); 562 562 inode->i_gid = opts->setgid ? opts->gid : current_fsgid(); 563 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 563 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 564 564 init_special_inode(inode, S_IFCHR|opts->mode, MKDEV(UNIX98_PTY_SLAVE_MAJOR, index)); 565 565 566 566 sprintf(s, "%d", index);
+4 -3
fs/ecryptfs/inode.c
··· 148 148 } 149 149 fsstack_copy_attr_times(dir, lower_dir); 150 150 set_nlink(inode, ecryptfs_inode_to_lower(inode)->i_nlink); 151 - inode->i_ctime = dir->i_ctime; 151 + inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); 152 152 out_unlock: 153 153 dput(lower_dentry); 154 154 inode_unlock(lower_dir); ··· 982 982 983 983 mount_crypt_stat = &ecryptfs_superblock_to_private( 984 984 dentry->d_sb)->mount_crypt_stat; 985 - generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat); 985 + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat); 986 986 if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) { 987 987 char *target; 988 988 size_t targetsiz; ··· 1011 1011 if (!rc) { 1012 1012 fsstack_copy_attr_all(d_inode(dentry), 1013 1013 ecryptfs_inode_to_lower(d_inode(dentry))); 1014 - generic_fillattr(&nop_mnt_idmap, d_inode(dentry), stat); 1014 + generic_fillattr(&nop_mnt_idmap, request_mask, 1015 + d_inode(dentry), stat); 1015 1016 stat->blocks = lower_stat.blocks; 1016 1017 } 1017 1018 return rc;
+1 -1
fs/efivarfs/file.c
··· 51 51 } else { 52 52 inode_lock(inode); 53 53 i_size_write(inode, datasize + sizeof(attributes)); 54 - inode->i_mtime = current_time(inode); 54 + inode->i_mtime = inode_set_ctime_current(inode); 55 55 inode_unlock(inode); 56 56 } 57 57
+1 -1
fs/efivarfs/inode.c
··· 25 25 if (inode) { 26 26 inode->i_ino = get_next_ino(); 27 27 inode->i_mode = mode; 28 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 28 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 29 29 inode->i_flags = is_removable ? 0 : S_IMMUTABLE; 30 30 switch (mode & S_IFMT) { 31 31 case S_IFREG:
+2 -2
fs/efs/inode.c
··· 105 105 inode->i_size = be32_to_cpu(efs_inode->di_size); 106 106 inode->i_atime.tv_sec = be32_to_cpu(efs_inode->di_atime); 107 107 inode->i_mtime.tv_sec = be32_to_cpu(efs_inode->di_mtime); 108 - inode->i_ctime.tv_sec = be32_to_cpu(efs_inode->di_ctime); 109 - inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = 0; 108 + inode_set_ctime(inode, be32_to_cpu(efs_inode->di_ctime), 0); 109 + inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = 0; 110 110 111 111 /* this is the number of blocks in the file */ 112 112 if (inode->i_size == 0) {
+5 -9
fs/erofs/inode.c
··· 105 105 set_nlink(inode, le32_to_cpu(die->i_nlink)); 106 106 107 107 /* extended inode has its own timestamp */ 108 - inode->i_ctime.tv_sec = le64_to_cpu(die->i_mtime); 109 - inode->i_ctime.tv_nsec = le32_to_cpu(die->i_mtime_nsec); 108 + inode_set_ctime(inode, le64_to_cpu(die->i_mtime), 109 + le32_to_cpu(die->i_mtime_nsec)); 110 110 111 111 inode->i_size = le64_to_cpu(die->i_size); 112 112 ··· 148 148 set_nlink(inode, le16_to_cpu(dic->i_nlink)); 149 149 150 150 /* use build time for compact inodes */ 151 - inode->i_ctime.tv_sec = sbi->build_time; 152 - inode->i_ctime.tv_nsec = sbi->build_time_nsec; 151 + inode_set_ctime(inode, sbi->build_time, sbi->build_time_nsec); 153 152 154 153 inode->i_size = le32_to_cpu(dic->i_size); 155 154 if (erofs_inode_is_data_compressed(vi->datalayout)) ··· 175 176 vi->chunkbits = sb->s_blocksize_bits + 176 177 (vi->chunkformat & EROFS_CHUNK_FORMAT_BLKBITS_MASK); 177 178 } 178 - inode->i_mtime.tv_sec = inode->i_ctime.tv_sec; 179 - inode->i_atime.tv_sec = inode->i_ctime.tv_sec; 180 - inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec; 181 - inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec; 179 + inode->i_mtime = inode->i_atime = inode_get_ctime(inode); 182 180 183 181 inode->i_flags &= ~S_DAX; 184 182 if (test_opt(&sbi->opt, DAX_ALWAYS) && S_ISREG(inode->i_mode) && ··· 369 373 stat->attributes_mask |= (STATX_ATTR_COMPRESSED | 370 374 STATX_ATTR_IMMUTABLE); 371 375 372 - generic_fillattr(idmap, inode, stat); 376 + generic_fillattr(idmap, request_mask, inode, stat); 373 377 return 0; 374 378 } 375 379
+3 -3
fs/exfat/file.c
··· 22 22 if (err) 23 23 return err; 24 24 25 - inode->i_ctime = inode->i_mtime = current_time(inode); 25 + inode->i_mtime = inode_set_ctime_current(inode); 26 26 mark_inode_dirty(inode); 27 27 28 28 if (!IS_SYNC(inode)) ··· 232 232 struct inode *inode = d_backing_inode(path->dentry); 233 233 struct exfat_inode_info *ei = EXFAT_I(inode); 234 234 235 - generic_fillattr(&nop_mnt_idmap, inode, stat); 235 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 236 236 exfat_truncate_atime(&stat->atime); 237 237 stat->result_mask |= STATX_BTIME; 238 238 stat->btime.tv_sec = ei->i_crtime.tv_sec; ··· 290 290 } 291 291 292 292 if (attr->ia_valid & ATTR_SIZE) 293 - inode->i_mtime = inode->i_ctime = current_time(inode); 293 + inode->i_mtime = inode_set_ctime_current(inode); 294 294 295 295 setattr_copy(&nop_mnt_idmap, inode, attr); 296 296 exfat_truncate_atime(&inode->i_atime);
+3 -3
fs/exfat/inode.c
··· 355 355 356 356 if (to > i_size_read(inode)) { 357 357 truncate_pagecache(inode, i_size_read(inode)); 358 - inode->i_mtime = inode->i_ctime = current_time(inode); 358 + inode->i_mtime = inode_set_ctime_current(inode); 359 359 exfat_truncate(inode); 360 360 } 361 361 } ··· 398 398 exfat_write_failed(mapping, pos+len); 399 399 400 400 if (!(err < 0) && !(ei->attr & ATTR_ARCHIVE)) { 401 - inode->i_mtime = inode->i_ctime = current_time(inode); 401 + inode->i_mtime = inode_set_ctime_current(inode); 402 402 ei->attr |= ATTR_ARCHIVE; 403 403 mark_inode_dirty(inode); 404 404 } ··· 577 577 578 578 inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9; 579 579 inode->i_mtime = info->mtime; 580 - inode->i_ctime = info->mtime; 580 + inode_set_ctime_to_ts(inode, info->mtime); 581 581 ei->i_crtime = info->crtime; 582 582 inode->i_atime = info->atime; 583 583
+11 -15
fs/exfat/namei.c
··· 569 569 goto unlock; 570 570 571 571 inode_inc_iversion(dir); 572 - dir->i_ctime = dir->i_mtime = current_time(dir); 572 + dir->i_mtime = inode_set_ctime_current(dir); 573 573 if (IS_DIRSYNC(dir)) 574 574 exfat_sync_inode(dir); 575 575 else ··· 582 582 goto unlock; 583 583 584 584 inode_inc_iversion(inode); 585 - inode->i_mtime = inode->i_atime = inode->i_ctime = 586 - EXFAT_I(inode)->i_crtime = current_time(inode); 585 + inode->i_mtime = inode->i_atime = EXFAT_I(inode)->i_crtime = inode_set_ctime_current(inode); 587 586 exfat_truncate_atime(&inode->i_atime); 588 587 /* timestamp is already written, so mark_inode_dirty() is unneeded. */ 589 588 ··· 816 817 ei->dir.dir = DIR_DELETED; 817 818 818 819 inode_inc_iversion(dir); 819 - dir->i_mtime = dir->i_atime = current_time(dir); 820 + dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir); 820 821 exfat_truncate_atime(&dir->i_atime); 821 822 if (IS_DIRSYNC(dir)) 822 823 exfat_sync_inode(dir); ··· 824 825 mark_inode_dirty(dir); 825 826 826 827 clear_nlink(inode); 827 - inode->i_mtime = inode->i_atime = current_time(inode); 828 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 828 829 exfat_truncate_atime(&inode->i_atime); 829 830 exfat_unhash_inode(inode); 830 831 exfat_d_version_set(dentry, inode_query_iversion(dir)); ··· 851 852 goto unlock; 852 853 853 854 inode_inc_iversion(dir); 854 - dir->i_ctime = dir->i_mtime = current_time(dir); 855 + dir->i_mtime = inode_set_ctime_current(dir); 855 856 if (IS_DIRSYNC(dir)) 856 857 exfat_sync_inode(dir); 857 858 else ··· 865 866 goto unlock; 866 867 867 868 inode_inc_iversion(inode); 868 - inode->i_mtime = inode->i_atime = inode->i_ctime = 869 - EXFAT_I(inode)->i_crtime = current_time(inode); 869 + inode->i_mtime = inode->i_atime = EXFAT_I(inode)->i_crtime = inode_set_ctime_current(inode); 870 870 exfat_truncate_atime(&inode->i_atime); 871 871 /* timestamp is already written, so mark_inode_dirty() is unneeded. */ 872 872 ··· 977 979 ei->dir.dir = DIR_DELETED; 978 980 979 981 inode_inc_iversion(dir); 980 - dir->i_mtime = dir->i_atime = current_time(dir); 982 + dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir); 981 983 exfat_truncate_atime(&dir->i_atime); 982 984 if (IS_DIRSYNC(dir)) 983 985 exfat_sync_inode(dir); ··· 986 988 drop_nlink(dir); 987 989 988 990 clear_nlink(inode); 989 - inode->i_mtime = inode->i_atime = current_time(inode); 991 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 990 992 exfat_truncate_atime(&inode->i_atime); 991 993 exfat_unhash_inode(inode); 992 994 exfat_d_version_set(dentry, inode_query_iversion(dir)); ··· 1310 1312 goto unlock; 1311 1313 1312 1314 inode_inc_iversion(new_dir); 1313 - new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime = 1314 - EXFAT_I(new_dir)->i_crtime = current_time(new_dir); 1315 + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); 1316 + EXFAT_I(new_dir)->i_crtime = current_time(new_dir); 1315 1317 exfat_truncate_atime(&new_dir->i_atime); 1316 1318 if (IS_DIRSYNC(new_dir)) 1317 1319 exfat_sync_inode(new_dir); ··· 1334 1336 } 1335 1337 1336 1338 inode_inc_iversion(old_dir); 1337 - old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); 1338 1339 if (IS_DIRSYNC(old_dir)) 1339 1340 exfat_sync_inode(old_dir); 1340 1341 else ··· 1351 1354 exfat_warn(sb, "abnormal access to an inode dropped"); 1352 1355 WARN_ON(new_inode->i_nlink == 0); 1353 1356 } 1354 - new_inode->i_ctime = EXFAT_I(new_inode)->i_crtime = 1355 - current_time(new_inode); 1357 + EXFAT_I(new_inode)->i_crtime = current_time(new_inode); 1356 1358 } 1357 1359 1358 1360 unlock:
+1 -2
fs/exfat/super.c
··· 379 379 ei->i_size_ondisk = i_size_read(inode); 380 380 381 381 exfat_save_attr(inode, ATTR_SUBDIR); 382 - inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime = 383 - current_time(inode); 382 + inode->i_mtime = inode->i_atime = ei->i_crtime = inode_set_ctime_current(inode); 384 383 exfat_truncate_atime(&inode->i_atime); 385 384 return 0; 386 385 }
+1 -1
fs/ext2/acl.c
··· 237 237 error = __ext2_set_acl(inode, acl, type); 238 238 if (!error && update_mode) { 239 239 inode->i_mode = mode; 240 - inode->i_ctime = current_time(inode); 240 + inode_set_ctime_current(inode); 241 241 mark_inode_dirty(inode); 242 242 } 243 243 return error;
+3 -3
fs/ext2/dir.c
··· 468 468 ext2_set_de_type(de, inode); 469 469 ext2_commit_chunk(page, pos, len); 470 470 if (update_times) 471 - dir->i_mtime = dir->i_ctime = current_time(dir); 471 + dir->i_mtime = inode_set_ctime_current(dir); 472 472 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; 473 473 mark_inode_dirty(dir); 474 474 return ext2_handle_dirsync(dir); ··· 555 555 de->inode = cpu_to_le32(inode->i_ino); 556 556 ext2_set_de_type (de, inode); 557 557 ext2_commit_chunk(page, pos, rec_len); 558 - dir->i_mtime = dir->i_ctime = current_time(dir); 558 + dir->i_mtime = inode_set_ctime_current(dir); 559 559 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; 560 560 mark_inode_dirty(dir); 561 561 err = ext2_handle_dirsync(dir); ··· 606 606 pde->rec_len = ext2_rec_len_to_disk(to - from); 607 607 dir->inode = 0; 608 608 ext2_commit_chunk(page, pos, to - from); 609 - inode->i_ctime = inode->i_mtime = current_time(inode); 609 + inode->i_mtime = inode_set_ctime_current(inode); 610 610 EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL; 611 611 mark_inode_dirty(inode); 612 612 return ext2_handle_dirsync(inode);
+1 -1
fs/ext2/ialloc.c
··· 549 549 550 550 inode->i_ino = ino; 551 551 inode->i_blocks = 0; 552 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 552 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 553 553 memset(ei->i_data, 0, sizeof(ei->i_data)); 554 554 ei->i_flags = 555 555 ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED);
+6 -6
fs/ext2/inode.c
··· 595 595 if (where->bh) 596 596 mark_buffer_dirty_inode(where->bh, inode); 597 597 598 - inode->i_ctime = current_time(inode); 598 + inode_set_ctime_current(inode); 599 599 mark_inode_dirty(inode); 600 600 } 601 601 ··· 1287 1287 __ext2_truncate_blocks(inode, newsize); 1288 1288 filemap_invalidate_unlock(inode->i_mapping); 1289 1289 1290 - inode->i_mtime = inode->i_ctime = current_time(inode); 1290 + inode->i_mtime = inode_set_ctime_current(inode); 1291 1291 if (inode_needs_sync(inode)) { 1292 1292 sync_mapping_buffers(inode->i_mapping); 1293 1293 sync_inode_metadata(inode, 1); ··· 1409 1409 set_nlink(inode, le16_to_cpu(raw_inode->i_links_count)); 1410 1410 inode->i_size = le32_to_cpu(raw_inode->i_size); 1411 1411 inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime); 1412 - inode->i_ctime.tv_sec = (signed)le32_to_cpu(raw_inode->i_ctime); 1412 + inode_set_ctime(inode, (signed)le32_to_cpu(raw_inode->i_ctime), 0); 1413 1413 inode->i_mtime.tv_sec = (signed)le32_to_cpu(raw_inode->i_mtime); 1414 - inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = 0; 1414 + inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = 0; 1415 1415 ei->i_dtime = le32_to_cpu(raw_inode->i_dtime); 1416 1416 /* We now have enough fields to check if the inode was active or not. 1417 1417 * This is needed because nfsd might try to access dead inodes ··· 1541 1541 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); 1542 1542 raw_inode->i_size = cpu_to_le32(inode->i_size); 1543 1543 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec); 1544 - raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec); 1544 + raw_inode->i_ctime = cpu_to_le32(inode_get_ctime(inode).tv_sec); 1545 1545 raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec); 1546 1546 1547 1547 raw_inode->i_blocks = cpu_to_le32(inode->i_blocks); ··· 1628 1628 STATX_ATTR_IMMUTABLE | 1629 1629 STATX_ATTR_NODUMP); 1630 1630 1631 - generic_fillattr(&nop_mnt_idmap, inode, stat); 1631 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 1632 1632 return 0; 1633 1633 } 1634 1634
+2 -2
fs/ext2/ioctl.c
··· 44 44 (fa->flags & EXT2_FL_USER_MODIFIABLE); 45 45 46 46 ext2_set_inode_flags(inode); 47 - inode->i_ctime = current_time(inode); 47 + inode_set_ctime_current(inode); 48 48 mark_inode_dirty(inode); 49 49 50 50 return 0; ··· 77 77 } 78 78 79 79 inode_lock(inode); 80 - inode->i_ctime = current_time(inode); 80 + inode_set_ctime_current(inode); 81 81 inode->i_generation = generation; 82 82 inode_unlock(inode); 83 83
+4 -4
fs/ext2/namei.c
··· 211 211 if (err) 212 212 return err; 213 213 214 - inode->i_ctime = current_time(inode); 214 + inode_set_ctime_current(inode); 215 215 inode_inc_link_count(inode); 216 216 ihold(inode); 217 217 ··· 291 291 if (err) 292 292 goto out; 293 293 294 - inode->i_ctime = dir->i_ctime; 294 + inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); 295 295 inode_dec_link_count(inode); 296 296 err = 0; 297 297 out: ··· 367 367 ext2_put_page(new_page, new_de); 368 368 if (err) 369 369 goto out_dir; 370 - new_inode->i_ctime = current_time(new_inode); 370 + inode_set_ctime_current(new_inode); 371 371 if (dir_de) 372 372 drop_nlink(new_inode); 373 373 inode_dec_link_count(new_inode); ··· 383 383 * Like most other Unix systems, set the ctime for inodes on a 384 384 * rename. 385 385 */ 386 - old_inode->i_ctime = current_time(old_inode); 386 + inode_set_ctime_current(old_inode); 387 387 mark_inode_dirty(old_inode); 388 388 389 389 err = ext2_delete_entry(old_de, old_page);
+1 -1
fs/ext2/super.c
··· 1572 1572 if (inode->i_size < off+len-towrite) 1573 1573 i_size_write(inode, off+len-towrite); 1574 1574 inode_inc_iversion(inode); 1575 - inode->i_mtime = inode->i_ctime = current_time(inode); 1575 + inode->i_mtime = inode_set_ctime_current(inode); 1576 1576 mark_inode_dirty(inode); 1577 1577 return len - towrite; 1578 1578 }
+1 -1
fs/ext2/xattr.c
··· 773 773 774 774 /* Update the inode. */ 775 775 EXT2_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0; 776 - inode->i_ctime = current_time(inode); 776 + inode_set_ctime_current(inode); 777 777 if (IS_SYNC(inode)) { 778 778 error = sync_inode_metadata(inode, 1); 779 779 /* In case sync failed due to ENOSPC the inode was actually
+1 -1
fs/ext4/acl.c
··· 259 259 error = __ext4_set_acl(handle, inode, type, acl, 0 /* xattr_flags */); 260 260 if (!error && update_mode) { 261 261 inode->i_mode = mode; 262 - inode->i_ctime = current_time(inode); 262 + inode_set_ctime_current(inode); 263 263 error = ext4_mark_inode_dirty(handle, inode); 264 264 } 265 265 out_stop:
+49 -43
fs/ext4/ext4.h
··· 868 868 * affected filesystem before 2242. 869 869 */ 870 870 871 - static inline __le32 ext4_encode_extra_time(struct timespec64 *time) 871 + static inline __le32 ext4_encode_extra_time(struct timespec64 ts) 872 872 { 873 - u32 extra =((time->tv_sec - (s32)time->tv_sec) >> 32) & EXT4_EPOCH_MASK; 874 - return cpu_to_le32(extra | (time->tv_nsec << EXT4_EPOCH_BITS)); 873 + u32 extra = ((ts.tv_sec - (s32)ts.tv_sec) >> 32) & EXT4_EPOCH_MASK; 874 + return cpu_to_le32(extra | (ts.tv_nsec << EXT4_EPOCH_BITS)); 875 875 } 876 876 877 - static inline void ext4_decode_extra_time(struct timespec64 *time, 878 - __le32 extra) 877 + static inline struct timespec64 ext4_decode_extra_time(__le32 base, 878 + __le32 extra) 879 879 { 880 + struct timespec64 ts = { .tv_sec = (signed)le32_to_cpu(base) }; 881 + 880 882 if (unlikely(extra & cpu_to_le32(EXT4_EPOCH_MASK))) 881 - time->tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32; 882 - time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; 883 + ts.tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32; 884 + ts.tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; 885 + return ts; 883 886 } 887 + 888 + #define EXT4_INODE_SET_XTIME_VAL(xtime, inode, raw_inode, ts) \ 889 + do { \ 890 + if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) { \ 891 + (raw_inode)->xtime = cpu_to_le32((ts).tv_sec); \ 892 + (raw_inode)->xtime ## _extra = ext4_encode_extra_time(ts); \ 893 + } else \ 894 + (raw_inode)->xtime = cpu_to_le32(clamp_t(int32_t, (ts).tv_sec, S32_MIN, S32_MAX)); \ 895 + } while (0) 884 896 885 897 #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ 886 - do { \ 887 - if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) {\ 888 - (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \ 889 - (raw_inode)->xtime ## _extra = \ 890 - ext4_encode_extra_time(&(inode)->xtime); \ 891 - } \ 892 - else \ 893 - (raw_inode)->xtime = cpu_to_le32(clamp_t(int32_t, (inode)->xtime.tv_sec, S32_MIN, S32_MAX)); \ 894 - } while (0) 898 + EXT4_INODE_SET_XTIME_VAL(xtime, inode, raw_inode, (inode)->xtime) 895 899 896 - #define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \ 897 - do { \ 898 - if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \ 899 - (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \ 900 - if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ 901 - (raw_inode)->xtime ## _extra = \ 902 - ext4_encode_extra_time(&(einode)->xtime); \ 903 - } while (0) 900 + #define EXT4_INODE_SET_CTIME(inode, raw_inode) \ 901 + EXT4_INODE_SET_XTIME_VAL(i_ctime, inode, raw_inode, inode_get_ctime(inode)) 902 + 903 + #define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \ 904 + if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \ 905 + EXT4_INODE_SET_XTIME_VAL(xtime, &((einode)->vfs_inode), \ 906 + raw_inode, (einode)->xtime) 907 + 908 + #define EXT4_INODE_GET_XTIME_VAL(xtime, inode, raw_inode) \ 909 + (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra) ? \ 910 + ext4_decode_extra_time((raw_inode)->xtime, \ 911 + (raw_inode)->xtime ## _extra) : \ 912 + (struct timespec64) { \ 913 + .tv_sec = (signed)le32_to_cpu((raw_inode)->xtime) \ 914 + }) 904 915 905 916 #define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode) \ 906 917 do { \ 907 - (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \ 908 - if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) { \ 909 - ext4_decode_extra_time(&(inode)->xtime, \ 910 - raw_inode->xtime ## _extra); \ 911 - } \ 912 - else \ 913 - (inode)->xtime.tv_nsec = 0; \ 918 + (inode)->xtime = EXT4_INODE_GET_XTIME_VAL(xtime, inode, raw_inode); \ 914 919 } while (0) 915 920 921 + #define EXT4_INODE_GET_CTIME(inode, raw_inode) \ 922 + do { \ 923 + inode_set_ctime_to_ts(inode, \ 924 + EXT4_INODE_GET_XTIME_VAL(i_ctime, inode, raw_inode)); \ 925 + } while (0) 916 926 917 - #define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \ 918 - do { \ 919 - if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \ 920 - (einode)->xtime.tv_sec = \ 921 - (signed)le32_to_cpu((raw_inode)->xtime); \ 922 - else \ 923 - (einode)->xtime.tv_sec = 0; \ 924 - if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ 925 - ext4_decode_extra_time(&(einode)->xtime, \ 926 - raw_inode->xtime ## _extra); \ 927 - else \ 928 - (einode)->xtime.tv_nsec = 0; \ 927 + #define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \ 928 + do { \ 929 + if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \ 930 + (einode)->xtime = \ 931 + EXT4_INODE_GET_XTIME_VAL(xtime, &(einode->vfs_inode), \ 932 + raw_inode); \ 933 + else \ 934 + (einode)->xtime = (struct timespec64){0, 0}; \ 929 935 } while (0) 930 936 931 937 #define i_disk_version osd1.linux1.l_i_version
+6 -6
fs/ext4/extents.c
··· 4476 4476 map.m_lblk += ret; 4477 4477 map.m_len = len = len - ret; 4478 4478 epos = (loff_t)map.m_lblk << inode->i_blkbits; 4479 - inode->i_ctime = current_time(inode); 4479 + inode_set_ctime_current(inode); 4480 4480 if (new_size) { 4481 4481 if (epos > new_size) 4482 4482 epos = new_size; 4483 4483 if (ext4_update_inode_size(inode, epos) & 0x1) 4484 - inode->i_mtime = inode->i_ctime; 4484 + inode->i_mtime = inode_get_ctime(inode); 4485 4485 } 4486 4486 ret2 = ext4_mark_inode_dirty(handle, inode); 4487 4487 ext4_update_inode_fsync_trans(handle, inode, 1); ··· 4617 4617 4618 4618 /* Now release the pages and zero block aligned part of pages */ 4619 4619 truncate_pagecache_range(inode, start, end - 1); 4620 - inode->i_mtime = inode->i_ctime = current_time(inode); 4620 + inode->i_mtime = inode_set_ctime_current(inode); 4621 4621 4622 4622 ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size, 4623 4623 flags); ··· 4642 4642 goto out_mutex; 4643 4643 } 4644 4644 4645 - inode->i_mtime = inode->i_ctime = current_time(inode); 4645 + inode->i_mtime = inode_set_ctime_current(inode); 4646 4646 if (new_size) 4647 4647 ext4_update_inode_size(inode, new_size); 4648 4648 ret = ext4_mark_inode_dirty(handle, inode); ··· 5378 5378 up_write(&EXT4_I(inode)->i_data_sem); 5379 5379 if (IS_SYNC(inode)) 5380 5380 ext4_handle_sync(handle); 5381 - inode->i_mtime = inode->i_ctime = current_time(inode); 5381 + inode->i_mtime = inode_set_ctime_current(inode); 5382 5382 ret = ext4_mark_inode_dirty(handle, inode); 5383 5383 ext4_update_inode_fsync_trans(handle, inode, 1); 5384 5384 ··· 5488 5488 /* Expand file to avoid data loss if there is error while shifting */ 5489 5489 inode->i_size += len; 5490 5490 EXT4_I(inode)->i_disksize += len; 5491 - inode->i_mtime = inode->i_ctime = current_time(inode); 5491 + inode->i_mtime = inode_set_ctime_current(inode); 5492 5492 ret = ext4_mark_inode_dirty(handle, inode); 5493 5493 if (ret) 5494 5494 goto out_stop;
+1 -1
fs/ext4/ialloc.c
··· 1250 1250 inode->i_ino = ino + group * EXT4_INODES_PER_GROUP(sb); 1251 1251 /* This is the optimal IO size (for stat), not the fs block size */ 1252 1252 inode->i_blocks = 0; 1253 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 1253 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 1254 1254 ei->i_crtime = inode->i_mtime; 1255 1255 1256 1256 memset(ei->i_data, 0, sizeof(ei->i_data));
+2 -2
fs/ext4/inline.c
··· 1037 1037 * happen is that the times are slightly out of date 1038 1038 * and/or different from the directory change time. 1039 1039 */ 1040 - dir->i_mtime = dir->i_ctime = current_time(dir); 1040 + dir->i_mtime = inode_set_ctime_current(dir); 1041 1041 ext4_update_dx_flag(dir); 1042 1042 inode_inc_iversion(dir); 1043 1043 return 1; ··· 1991 1991 ext4_orphan_del(handle, inode); 1992 1992 1993 1993 if (err == 0) { 1994 - inode->i_mtime = inode->i_ctime = current_time(inode); 1994 + inode->i_mtime = inode_set_ctime_current(inode); 1995 1995 err = ext4_mark_inode_dirty(handle, inode); 1996 1996 if (IS_SYNC(inode)) 1997 1997 ext4_handle_sync(handle);
+3 -3
fs/ext4/inode-test.c
··· 245 245 struct timestamp_expectation *test_param = 246 246 (struct timestamp_expectation *)(test->param_value); 247 247 248 - timestamp.tv_sec = get_32bit_time(test_param); 249 - ext4_decode_extra_time(&timestamp, 250 - cpu_to_le32(test_param->extra_bits)); 248 + timestamp = ext4_decode_extra_time( 249 + cpu_to_le32(get_32bit_time(test_param)), 250 + cpu_to_le32(test_param->extra_bits)); 251 251 252 252 KUNIT_EXPECT_EQ_MSG(test, 253 253 test_param->expected.tv_sec,
+8 -10
fs/ext4/inode.c
··· 3986 3986 if (IS_SYNC(inode)) 3987 3987 ext4_handle_sync(handle); 3988 3988 3989 - inode->i_mtime = inode->i_ctime = current_time(inode); 3989 + inode->i_mtime = inode_set_ctime_current(inode); 3990 3990 ret2 = ext4_mark_inode_dirty(handle, inode); 3991 3991 if (unlikely(ret2)) 3992 3992 ret = ret2; ··· 4146 4146 if (inode->i_nlink) 4147 4147 ext4_orphan_del(handle, inode); 4148 4148 4149 - inode->i_mtime = inode->i_ctime = current_time(inode); 4149 + inode->i_mtime = inode_set_ctime_current(inode); 4150 4150 err2 = ext4_mark_inode_dirty(handle, inode); 4151 4151 if (unlikely(err2 && !err)) 4152 4152 err = err2; ··· 4249 4249 } 4250 4250 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); 4251 4251 4252 - EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode); 4252 + EXT4_INODE_SET_CTIME(inode, raw_inode); 4253 4253 EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode); 4254 4254 EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode); 4255 4255 EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode); ··· 4858 4858 } 4859 4859 } 4860 4860 4861 - EXT4_INODE_GET_XTIME(i_ctime, inode, raw_inode); 4861 + EXT4_INODE_GET_CTIME(inode, raw_inode); 4862 4862 EXT4_INODE_GET_XTIME(i_mtime, inode, raw_inode); 4863 4863 EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode); 4864 4864 EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode); ··· 4981 4981 spin_unlock(&inode->i_lock); 4982 4982 4983 4983 spin_lock(&ei->i_raw_lock); 4984 - EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode); 4984 + EXT4_INODE_SET_CTIME(inode, raw_inode); 4985 4985 EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode); 4986 4986 EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode); 4987 4987 ext4_inode_csum_set(inode, raw_inode, ei); ··· 5376 5376 * Update c/mtime on truncate up, ext4_truncate() will 5377 5377 * update c/mtime in shrink case below 5378 5378 */ 5379 - if (!shrink) { 5380 - inode->i_mtime = current_time(inode); 5381 - inode->i_ctime = inode->i_mtime; 5382 - } 5379 + if (!shrink) 5380 + inode->i_mtime = inode_set_ctime_current(inode); 5383 5381 5384 5382 if (shrink) 5385 5383 ext4_fc_track_range(handle, inode, ··· 5535 5537 STATX_ATTR_NODUMP | 5536 5538 STATX_ATTR_VERITY); 5537 5539 5538 - generic_fillattr(idmap, inode, stat); 5540 + generic_fillattr(idmap, request_mask, inode, stat); 5539 5541 return 0; 5540 5542 } 5541 5543
+5 -4
fs/ext4/ioctl.c
··· 449 449 diff = size - size_bl; 450 450 swap_inode_data(inode, inode_bl); 451 451 452 - inode->i_ctime = inode_bl->i_ctime = current_time(inode); 452 + inode_set_ctime_current(inode); 453 + inode_set_ctime_current(inode_bl); 453 454 inode_inc_iversion(inode); 454 455 455 456 inode->i_generation = get_random_u32(); ··· 664 663 665 664 ext4_set_inode_flags(inode, false); 666 665 667 - inode->i_ctime = current_time(inode); 666 + inode_set_ctime_current(inode); 668 667 inode_inc_iversion(inode); 669 668 670 669 err = ext4_mark_iloc_dirty(handle, inode, &iloc); ··· 775 774 } 776 775 777 776 EXT4_I(inode)->i_projid = kprojid; 778 - inode->i_ctime = current_time(inode); 777 + inode_set_ctime_current(inode); 779 778 inode_inc_iversion(inode); 780 779 out_dirty: 781 780 rc = ext4_mark_iloc_dirty(handle, inode, &iloc); ··· 1267 1266 } 1268 1267 err = ext4_reserve_inode_write(handle, inode, &iloc); 1269 1268 if (err == 0) { 1270 - inode->i_ctime = current_time(inode); 1269 + inode_set_ctime_current(inode); 1271 1270 inode_inc_iversion(inode); 1272 1271 inode->i_generation = generation; 1273 1272 err = ext4_mark_iloc_dirty(handle, inode, &iloc);
+12 -14
fs/ext4/namei.c
··· 2203 2203 * happen is that the times are slightly out of date 2204 2204 * and/or different from the directory change time. 2205 2205 */ 2206 - dir->i_mtime = dir->i_ctime = current_time(dir); 2206 + dir->i_mtime = inode_set_ctime_current(dir); 2207 2207 ext4_update_dx_flag(dir); 2208 2208 inode_inc_iversion(dir); 2209 2209 err2 = ext4_mark_inode_dirty(handle, dir); ··· 3197 3197 * recovery. */ 3198 3198 inode->i_size = 0; 3199 3199 ext4_orphan_add(handle, inode); 3200 - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); 3200 + dir->i_mtime = inode_set_ctime_current(dir); 3201 + inode_set_ctime_current(inode); 3201 3202 retval = ext4_mark_inode_dirty(handle, inode); 3202 3203 if (retval) 3203 3204 goto end_rmdir; ··· 3272 3271 retval = ext4_delete_entry(handle, dir, de, bh); 3273 3272 if (retval) 3274 3273 goto out_handle; 3275 - dir->i_ctime = dir->i_mtime = current_time(dir); 3274 + dir->i_mtime = inode_set_ctime_current(dir); 3276 3275 ext4_update_dx_flag(dir); 3277 3276 retval = ext4_mark_inode_dirty(handle, dir); 3278 3277 if (retval) ··· 3287 3286 drop_nlink(inode); 3288 3287 if (!inode->i_nlink) 3289 3288 ext4_orphan_add(handle, inode); 3290 - inode->i_ctime = current_time(inode); 3289 + inode_set_ctime_current(inode); 3291 3290 retval = ext4_mark_inode_dirty(handle, inode); 3292 3291 if (dentry && !retval) 3293 3292 ext4_fc_track_unlink(handle, dentry); ··· 3464 3463 if (IS_DIRSYNC(dir)) 3465 3464 ext4_handle_sync(handle); 3466 3465 3467 - inode->i_ctime = current_time(inode); 3466 + inode_set_ctime_current(inode); 3468 3467 ext4_inc_count(inode); 3469 3468 ihold(inode); 3470 3469 ··· 3642 3641 if (ext4_has_feature_filetype(ent->dir->i_sb)) 3643 3642 ent->de->file_type = file_type; 3644 3643 inode_inc_iversion(ent->dir); 3645 - ent->dir->i_ctime = ent->dir->i_mtime = 3646 - current_time(ent->dir); 3644 + ent->dir->i_mtime = inode_set_ctime_current(ent->dir); 3647 3645 retval = ext4_mark_inode_dirty(handle, ent->dir); 3648 3646 BUFFER_TRACE(ent->bh, "call ext4_handle_dirty_metadata"); 3649 3647 if (!ent->inlined) { ··· 3941 3941 * Like most other Unix systems, set the ctime for inodes on a 3942 3942 * rename. 3943 3943 */ 3944 - old.inode->i_ctime = current_time(old.inode); 3944 + inode_set_ctime_current(old.inode); 3945 3945 retval = ext4_mark_inode_dirty(handle, old.inode); 3946 3946 if (unlikely(retval)) 3947 3947 goto end_rename; ··· 3955 3955 3956 3956 if (new.inode) { 3957 3957 ext4_dec_count(new.inode); 3958 - new.inode->i_ctime = current_time(new.inode); 3958 + inode_set_ctime_current(new.inode); 3959 3959 } 3960 - old.dir->i_ctime = old.dir->i_mtime = current_time(old.dir); 3960 + old.dir->i_mtime = inode_set_ctime_current(old.dir); 3961 3961 ext4_update_dx_flag(old.dir); 3962 3962 if (old.dir_bh) { 3963 3963 retval = ext4_rename_dir_finish(handle, &old, new.dir->i_ino); ··· 4053 4053 }; 4054 4054 u8 new_file_type; 4055 4055 int retval; 4056 - struct timespec64 ctime; 4057 4056 4058 4057 if ((ext4_test_inode_flag(new_dir, EXT4_INODE_PROJINHERIT) && 4059 4058 !projid_eq(EXT4_I(new_dir)->i_projid, ··· 4146 4147 * Like most other Unix systems, set the ctime for inodes on a 4147 4148 * rename. 4148 4149 */ 4149 - ctime = current_time(old.inode); 4150 - old.inode->i_ctime = ctime; 4151 - new.inode->i_ctime = ctime; 4150 + inode_set_ctime_current(old.inode); 4151 + inode_set_ctime_current(new.inode); 4152 4152 retval = ext4_mark_inode_dirty(handle, old.inode); 4153 4153 if (unlikely(retval)) 4154 4154 goto end_rename;
+2 -2
fs/ext4/super.c
··· 7103 7103 } 7104 7104 EXT4_I(inode)->i_flags &= ~(EXT4_NOATIME_FL | EXT4_IMMUTABLE_FL); 7105 7105 inode_set_flags(inode, 0, S_NOATIME | S_IMMUTABLE); 7106 - inode->i_mtime = inode->i_ctime = current_time(inode); 7106 + inode->i_mtime = inode_set_ctime_current(inode); 7107 7107 err = ext4_mark_inode_dirty(handle, inode); 7108 7108 ext4_journal_stop(handle); 7109 7109 out_unlock: ··· 7279 7279 .init_fs_context = ext4_init_fs_context, 7280 7280 .parameters = ext4_param_specs, 7281 7281 .kill_sb = kill_block_super, 7282 - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, 7282 + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME, 7283 7283 }; 7284 7284 MODULE_ALIAS_FS("ext4"); 7285 7285
+3 -3
fs/ext4/xattr.c
··· 356 356 357 357 static u64 ext4_xattr_inode_get_ref(struct inode *ea_inode) 358 358 { 359 - return ((u64)ea_inode->i_ctime.tv_sec << 32) | 359 + return ((u64) inode_get_ctime(ea_inode).tv_sec << 32) | 360 360 (u32) inode_peek_iversion_raw(ea_inode); 361 361 } 362 362 363 363 static void ext4_xattr_inode_set_ref(struct inode *ea_inode, u64 ref_count) 364 364 { 365 - ea_inode->i_ctime.tv_sec = (u32)(ref_count >> 32); 365 + inode_set_ctime(ea_inode, (u32)(ref_count >> 32), 0); 366 366 inode_set_iversion_raw(ea_inode, ref_count & 0xffffffff); 367 367 } 368 368 ··· 2473 2473 } 2474 2474 if (!error) { 2475 2475 ext4_xattr_update_super_block(handle, inode->i_sb); 2476 - inode->i_ctime = current_time(inode); 2476 + inode_set_ctime_current(inode); 2477 2477 inode_inc_iversion(inode); 2478 2478 if (!value) 2479 2479 no_expand = 0;
+4 -4
fs/f2fs/dir.c
··· 455 455 de->file_type = fs_umode_to_ftype(inode->i_mode); 456 456 set_page_dirty(page); 457 457 458 - dir->i_mtime = dir->i_ctime = current_time(dir); 458 + dir->i_mtime = inode_set_ctime_current(dir); 459 459 f2fs_mark_inode_dirty_sync(dir, false); 460 460 f2fs_put_page(page, 1); 461 461 } ··· 609 609 f2fs_i_links_write(dir, true); 610 610 clear_inode_flag(inode, FI_NEW_INODE); 611 611 } 612 - dir->i_mtime = dir->i_ctime = current_time(dir); 612 + dir->i_mtime = inode_set_ctime_current(dir); 613 613 f2fs_mark_inode_dirty_sync(dir, false); 614 614 615 615 if (F2FS_I(dir)->i_current_depth != current_depth) ··· 858 858 859 859 if (S_ISDIR(inode->i_mode)) 860 860 f2fs_i_links_write(dir, false); 861 - inode->i_ctime = current_time(inode); 861 + inode_set_ctime_current(inode); 862 862 863 863 f2fs_i_links_write(inode, false); 864 864 if (S_ISDIR(inode->i_mode)) { ··· 919 919 } 920 920 f2fs_put_page(page, 1); 921 921 922 - dir->i_ctime = dir->i_mtime = current_time(dir); 922 + dir->i_mtime = inode_set_ctime_current(dir); 923 923 f2fs_mark_inode_dirty_sync(dir, false); 924 924 925 925 if (inode)
+3 -1
fs/f2fs/f2fs.h
··· 3303 3303 3304 3304 static inline bool f2fs_is_time_consistent(struct inode *inode) 3305 3305 { 3306 + struct timespec64 ctime = inode_get_ctime(inode); 3307 + 3306 3308 if (!timespec64_equal(F2FS_I(inode)->i_disk_time, &inode->i_atime)) 3307 3309 return false; 3308 - if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 1, &inode->i_ctime)) 3310 + if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 1, &ctime)) 3309 3311 return false; 3310 3312 if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 2, &inode->i_mtime)) 3311 3313 return false;
+11 -11
fs/f2fs/file.c
··· 794 794 if (err) 795 795 return err; 796 796 797 - inode->i_mtime = inode->i_ctime = current_time(inode); 797 + inode->i_mtime = inode_set_ctime_current(inode); 798 798 f2fs_mark_inode_dirty_sync(inode, false); 799 799 return 0; 800 800 } ··· 882 882 STATX_ATTR_NODUMP | 883 883 STATX_ATTR_VERITY); 884 884 885 - generic_fillattr(idmap, inode, stat); 885 + generic_fillattr(idmap, request_mask, inode, stat); 886 886 887 887 /* we need to show initial sectors used for inline_data/dentries */ 888 888 if ((S_ISREG(inode->i_mode) && f2fs_has_inline_data(inode)) || ··· 905 905 if (ia_valid & ATTR_MTIME) 906 906 inode->i_mtime = attr->ia_mtime; 907 907 if (ia_valid & ATTR_CTIME) 908 - inode->i_ctime = attr->ia_ctime; 908 + inode_set_ctime_to_ts(inode, attr->ia_ctime); 909 909 if (ia_valid & ATTR_MODE) { 910 910 umode_t mode = attr->ia_mode; 911 911 vfsgid_t vfsgid = i_gid_into_vfsgid(idmap, inode); ··· 1008 1008 return err; 1009 1009 1010 1010 spin_lock(&F2FS_I(inode)->i_size_lock); 1011 - inode->i_mtime = inode->i_ctime = current_time(inode); 1011 + inode->i_mtime = inode_set_ctime_current(inode); 1012 1012 F2FS_I(inode)->last_disk_size = i_size_read(inode); 1013 1013 spin_unlock(&F2FS_I(inode)->i_size_lock); 1014 1014 } ··· 1835 1835 } 1836 1836 1837 1837 if (!ret) { 1838 - inode->i_mtime = inode->i_ctime = current_time(inode); 1838 + inode->i_mtime = inode_set_ctime_current(inode); 1839 1839 f2fs_mark_inode_dirty_sync(inode, false); 1840 1840 f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); 1841 1841 } ··· 1937 1937 else 1938 1938 clear_inode_flag(inode, FI_PROJ_INHERIT); 1939 1939 1940 - inode->i_ctime = current_time(inode); 1940 + inode_set_ctime_current(inode); 1941 1941 f2fs_set_inode_flags(inode); 1942 1942 f2fs_mark_inode_dirty_sync(inode, true); 1943 1943 return 0; ··· 2874 2874 if (ret) 2875 2875 goto out_unlock; 2876 2876 2877 - src->i_mtime = src->i_ctime = current_time(src); 2877 + src->i_mtime = inode_set_ctime_current(src); 2878 2878 f2fs_mark_inode_dirty_sync(src, false); 2879 2879 if (src != dst) { 2880 - dst->i_mtime = dst->i_ctime = current_time(dst); 2880 + dst->i_mtime = inode_set_ctime_current(dst); 2881 2881 f2fs_mark_inode_dirty_sync(dst, false); 2882 2882 } 2883 2883 f2fs_update_time(sbi, REQ_TIME); ··· 3073 3073 goto out_unlock; 3074 3074 3075 3075 fi->i_projid = kprojid; 3076 - inode->i_ctime = current_time(inode); 3076 + inode_set_ctime_current(inode); 3077 3077 f2fs_mark_inode_dirty_sync(inode, true); 3078 3078 out_unlock: 3079 3079 f2fs_unlock_op(sbi); ··· 3511 3511 } 3512 3512 3513 3513 set_inode_flag(inode, FI_COMPRESS_RELEASED); 3514 - inode->i_ctime = current_time(inode); 3514 + inode_set_ctime_current(inode); 3515 3515 f2fs_mark_inode_dirty_sync(inode, true); 3516 3516 3517 3517 f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); ··· 3710 3710 3711 3711 if (ret >= 0) { 3712 3712 clear_inode_flag(inode, FI_COMPRESS_RELEASED); 3713 - inode->i_ctime = current_time(inode); 3713 + inode_set_ctime_current(inode); 3714 3714 f2fs_mark_inode_dirty_sync(inode, true); 3715 3715 } 3716 3716 unlock_inode:
+1 -1
fs/f2fs/inline.c
··· 698 698 set_page_dirty(page); 699 699 f2fs_put_page(page, 1); 700 700 701 - dir->i_ctime = dir->i_mtime = current_time(dir); 701 + dir->i_mtime = inode_set_ctime_current(dir); 702 702 f2fs_mark_inode_dirty_sync(dir, false); 703 703 704 704 if (inode)
+5 -5
fs/f2fs/inode.c
··· 403 403 struct f2fs_inode_info *fi = F2FS_I(inode); 404 404 405 405 fi->i_disk_time[0] = inode->i_atime; 406 - fi->i_disk_time[1] = inode->i_ctime; 406 + fi->i_disk_time[1] = inode_get_ctime(inode); 407 407 fi->i_disk_time[2] = inode->i_mtime; 408 408 } 409 409 ··· 434 434 inode->i_blocks = SECTOR_FROM_BLOCK(le64_to_cpu(ri->i_blocks) - 1); 435 435 436 436 inode->i_atime.tv_sec = le64_to_cpu(ri->i_atime); 437 - inode->i_ctime.tv_sec = le64_to_cpu(ri->i_ctime); 437 + inode_set_ctime(inode, le64_to_cpu(ri->i_ctime), 438 + le32_to_cpu(ri->i_ctime_nsec)); 438 439 inode->i_mtime.tv_sec = le64_to_cpu(ri->i_mtime); 439 440 inode->i_atime.tv_nsec = le32_to_cpu(ri->i_atime_nsec); 440 - inode->i_ctime.tv_nsec = le32_to_cpu(ri->i_ctime_nsec); 441 441 inode->i_mtime.tv_nsec = le32_to_cpu(ri->i_mtime_nsec); 442 442 inode->i_generation = le32_to_cpu(ri->i_generation); 443 443 if (S_ISDIR(inode->i_mode)) ··· 714 714 set_raw_inline(inode, ri); 715 715 716 716 ri->i_atime = cpu_to_le64(inode->i_atime.tv_sec); 717 - ri->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 717 + ri->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec); 718 718 ri->i_mtime = cpu_to_le64(inode->i_mtime.tv_sec); 719 719 ri->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); 720 - ri->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 720 + ri->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 721 721 ri->i_mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); 722 722 if (S_ISDIR(inode->i_mode)) 723 723 ri->i_current_depth =
+6 -6
fs/f2fs/namei.c
··· 243 243 244 244 inode->i_ino = ino; 245 245 inode->i_blocks = 0; 246 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 246 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 247 247 F2FS_I(inode)->i_crtime = inode->i_mtime; 248 248 inode->i_generation = get_random_u32(); 249 249 ··· 420 420 421 421 f2fs_balance_fs(sbi, true); 422 422 423 - inode->i_ctime = current_time(inode); 423 + inode_set_ctime_current(inode); 424 424 ihold(inode); 425 425 426 426 set_inode_flag(inode, FI_INC_LINK); ··· 1052 1052 f2fs_set_link(new_dir, new_entry, new_page, old_inode); 1053 1053 new_page = NULL; 1054 1054 1055 - new_inode->i_ctime = current_time(new_inode); 1055 + inode_set_ctime_current(new_inode); 1056 1056 f2fs_down_write(&F2FS_I(new_inode)->i_sem); 1057 1057 if (old_dir_entry) 1058 1058 f2fs_i_links_write(new_inode, false); ··· 1086 1086 f2fs_i_pino_write(old_inode, new_dir->i_ino); 1087 1087 f2fs_up_write(&F2FS_I(old_inode)->i_sem); 1088 1088 1089 - old_inode->i_ctime = current_time(old_inode); 1089 + inode_set_ctime_current(old_inode); 1090 1090 f2fs_mark_inode_dirty_sync(old_inode, false); 1091 1091 1092 1092 f2fs_delete_entry(old_entry, old_page, old_dir, NULL); ··· 1251 1251 f2fs_i_pino_write(old_inode, new_dir->i_ino); 1252 1252 f2fs_up_write(&F2FS_I(old_inode)->i_sem); 1253 1253 1254 - old_dir->i_ctime = current_time(old_dir); 1254 + inode_set_ctime_current(old_dir); 1255 1255 if (old_nlink) { 1256 1256 f2fs_down_write(&F2FS_I(old_dir)->i_sem); 1257 1257 f2fs_i_links_write(old_dir, old_nlink > 0); ··· 1270 1270 f2fs_i_pino_write(new_inode, old_dir->i_ino); 1271 1271 f2fs_up_write(&F2FS_I(new_inode)->i_sem); 1272 1272 1273 - new_dir->i_ctime = current_time(new_dir); 1273 + inode_set_ctime_current(new_dir); 1274 1274 if (new_nlink) { 1275 1275 f2fs_down_write(&F2FS_I(new_dir)->i_sem); 1276 1276 f2fs_i_links_write(new_dir, new_nlink > 0);
+2 -2
fs/f2fs/recovery.c
··· 321 321 322 322 f2fs_i_size_write(inode, le64_to_cpu(raw->i_size)); 323 323 inode->i_atime.tv_sec = le64_to_cpu(raw->i_atime); 324 - inode->i_ctime.tv_sec = le64_to_cpu(raw->i_ctime); 324 + inode_set_ctime(inode, le64_to_cpu(raw->i_ctime), 325 + le32_to_cpu(raw->i_ctime_nsec)); 325 326 inode->i_mtime.tv_sec = le64_to_cpu(raw->i_mtime); 326 327 inode->i_atime.tv_nsec = le32_to_cpu(raw->i_atime_nsec); 327 - inode->i_ctime.tv_nsec = le32_to_cpu(raw->i_ctime_nsec); 328 328 inode->i_mtime.tv_nsec = le32_to_cpu(raw->i_mtime_nsec); 329 329 330 330 F2FS_I(inode)->i_advise = raw->i_advise;
+1 -1
fs/f2fs/super.c
··· 2703 2703 2704 2704 if (len == towrite) 2705 2705 return err; 2706 - inode->i_mtime = inode->i_ctime = current_time(inode); 2706 + inode->i_mtime = inode_set_ctime_current(inode); 2707 2707 f2fs_mark_inode_dirty_sync(inode, false); 2708 2708 return len - towrite; 2709 2709 }
+1 -1
fs/f2fs/xattr.c
··· 764 764 same: 765 765 if (is_inode_flag_set(inode, FI_ACL_MODE)) { 766 766 inode->i_mode = F2FS_I(inode)->i_acl_mode; 767 - inode->i_ctime = current_time(inode); 767 + inode_set_ctime_current(inode); 768 768 clear_inode_flag(inode, FI_ACL_MODE); 769 769 } 770 770
+1 -2
fs/fat/fat.h
··· 460 460 const struct timespec64 *ts); 461 461 extern int fat_truncate_time(struct inode *inode, struct timespec64 *now, 462 462 int flags); 463 - extern int fat_update_time(struct inode *inode, struct timespec64 *now, 464 - int flags); 463 + extern int fat_update_time(struct inode *inode, int flags); 465 464 extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); 466 465 467 466 int fat_cache_init(void);
+1 -1
fs/fat/file.c
··· 401 401 struct inode *inode = d_inode(path->dentry); 402 402 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); 403 403 404 - generic_fillattr(idmap, inode, stat); 404 + generic_fillattr(idmap, request_mask, inode, stat); 405 405 stat->blksize = sbi->cluster_size; 406 406 407 407 if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) {
+2 -3
fs/fat/inode.c
··· 562 562 & ~((loff_t)sbi->cluster_size - 1)) >> 9; 563 563 564 564 fat_time_fat2unix(sbi, &inode->i_mtime, de->time, de->date, 0); 565 - inode->i_ctime = inode->i_mtime; 565 + inode_set_ctime_to_ts(inode, inode->i_mtime); 566 566 if (sbi->options.isvfat) { 567 567 fat_time_fat2unix(sbi, &inode->i_atime, 0, de->adate, 0); 568 568 fat_time_fat2unix(sbi, &MSDOS_I(inode)->i_crtime, de->ctime, ··· 1407 1407 MSDOS_I(inode)->mmu_private = inode->i_size; 1408 1408 1409 1409 fat_save_attrs(inode, ATTR_DIR); 1410 - inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec = 0; 1411 - inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = 0; 1410 + inode->i_mtime = inode->i_atime = inode_set_ctime(inode, 0, 0); 1412 1411 set_nlink(inode, fat_subdirs(inode)+2); 1413 1412 1414 1413 return 0;
+4 -6
fs/fat/misc.c
··· 332 332 * but ctime updates are ignored. 333 333 */ 334 334 if (flags & S_MTIME) 335 - inode->i_mtime = inode->i_ctime = fat_truncate_mtime(sbi, now); 335 + inode->i_mtime = inode_set_ctime_to_ts(inode, 336 + fat_truncate_mtime(sbi, now)); 336 337 337 338 return 0; 338 339 } 339 340 EXPORT_SYMBOL_GPL(fat_truncate_time); 340 341 341 - int fat_update_time(struct inode *inode, struct timespec64 *now, int flags) 342 + int fat_update_time(struct inode *inode, int flags) 342 343 { 343 344 int dirty_flags = 0; 344 345 ··· 347 346 return 0; 348 347 349 348 if (flags & (S_ATIME | S_CTIME | S_MTIME)) { 350 - fat_truncate_time(inode, now, flags); 349 + fat_truncate_time(inode, NULL, flags); 351 350 if (inode->i_sb->s_flags & SB_LAZYTIME) 352 351 dirty_flags |= I_DIRTY_TIME; 353 352 else 354 353 dirty_flags |= I_DIRTY_SYNC; 355 354 } 356 - 357 - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false)) 358 - dirty_flags |= I_DIRTY_SYNC; 359 355 360 356 __mark_inode_dirty(inode, dirty_flags); 361 357 return 0;
+1 -2
fs/freevxfs/vxfs_inode.c
··· 110 110 inode->i_size = vip->vii_size; 111 111 112 112 inode->i_atime.tv_sec = vip->vii_atime; 113 - inode->i_ctime.tv_sec = vip->vii_ctime; 113 + inode_set_ctime(inode, vip->vii_ctime, 0); 114 114 inode->i_mtime.tv_sec = vip->vii_mtime; 115 115 inode->i_atime.tv_nsec = 0; 116 - inode->i_ctime.tv_nsec = 0; 117 116 inode->i_mtime.tv_nsec = 0; 118 117 119 118 inode->i_blocks = vip->vii_blocks;
+1 -1
fs/fuse/control.c
··· 235 235 inode->i_mode = mode; 236 236 inode->i_uid = fc->user_id; 237 237 inode->i_gid = fc->group_id; 238 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 238 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 239 239 /* setting ->i_op to NULL is not allowed */ 240 240 if (iop) 241 241 inode->i_op = iop;
+5 -5
fs/fuse/dir.c
··· 933 933 static void fuse_update_ctime_in_cache(struct inode *inode) 934 934 { 935 935 if (!IS_NOCMTIME(inode)) { 936 - inode->i_ctime = current_time(inode); 936 + inode_set_ctime_current(inode); 937 937 mark_inode_dirty_sync(inode); 938 938 fuse_flush_time_update(inode); 939 939 } ··· 1222 1222 forget_all_cached_acls(inode); 1223 1223 err = fuse_do_getattr(inode, stat, file); 1224 1224 } else if (stat) { 1225 - generic_fillattr(&nop_mnt_idmap, inode, stat); 1225 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 1226 1226 stat->mode = fi->orig_i_mode; 1227 1227 stat->ino = fi->orig_ino; 1228 1228 } ··· 1715 1715 inarg.mtimensec = inode->i_mtime.tv_nsec; 1716 1716 if (fm->fc->minor >= 23) { 1717 1717 inarg.valid |= FATTR_CTIME; 1718 - inarg.ctime = inode->i_ctime.tv_sec; 1719 - inarg.ctimensec = inode->i_ctime.tv_nsec; 1718 + inarg.ctime = inode_get_ctime(inode).tv_sec; 1719 + inarg.ctimensec = inode_get_ctime(inode).tv_nsec; 1720 1720 } 1721 1721 if (ff) { 1722 1722 inarg.valid |= FATTR_FH; ··· 1857 1857 if (attr->ia_valid & ATTR_MTIME) 1858 1858 inode->i_mtime = attr->ia_mtime; 1859 1859 if (attr->ia_valid & ATTR_CTIME) 1860 - inode->i_ctime = attr->ia_ctime; 1860 + inode_set_ctime_to_ts(inode, attr->ia_ctime); 1861 1861 /* FIXME: clear I_DIRTY_SYNC? */ 1862 1862 } 1863 1863
+8 -8
fs/fuse/inode.c
··· 194 194 inode->i_mtime.tv_nsec = attr->mtimensec; 195 195 } 196 196 if (!(cache_mask & STATX_CTIME)) { 197 - inode->i_ctime.tv_sec = attr->ctime; 198 - inode->i_ctime.tv_nsec = attr->ctimensec; 197 + inode_set_ctime(inode, attr->ctime, attr->ctimensec); 199 198 } 200 199 201 200 if (attr->blksize != 0) ··· 258 259 attr->mtimensec = inode->i_mtime.tv_nsec; 259 260 } 260 261 if (cache_mask & STATX_CTIME) { 261 - attr->ctime = inode->i_ctime.tv_sec; 262 - attr->ctimensec = inode->i_ctime.tv_nsec; 262 + attr->ctime = inode_get_ctime(inode).tv_sec; 263 + attr->ctimensec = inode_get_ctime(inode).tv_nsec; 263 264 } 264 265 265 266 if ((attr_version != 0 && fi->attr_version > attr_version) || ··· 317 318 inode->i_size = attr->size; 318 319 inode->i_mtime.tv_sec = attr->mtime; 319 320 inode->i_mtime.tv_nsec = attr->mtimensec; 320 - inode->i_ctime.tv_sec = attr->ctime; 321 - inode->i_ctime.tv_nsec = attr->ctimensec; 321 + inode_set_ctime(inode, attr->ctime, attr->ctimensec); 322 322 if (S_ISREG(inode->i_mode)) { 323 323 fuse_init_common(inode); 324 324 fuse_init_file_inode(inode, attr->flags); ··· 1399 1401 static void fuse_fill_attr_from_inode(struct fuse_attr *attr, 1400 1402 const struct fuse_inode *fi) 1401 1403 { 1404 + struct timespec64 ctime = inode_get_ctime(&fi->inode); 1405 + 1402 1406 *attr = (struct fuse_attr){ 1403 1407 .ino = fi->inode.i_ino, 1404 1408 .size = fi->inode.i_size, 1405 1409 .blocks = fi->inode.i_blocks, 1406 1410 .atime = fi->inode.i_atime.tv_sec, 1407 1411 .mtime = fi->inode.i_mtime.tv_sec, 1408 - .ctime = fi->inode.i_ctime.tv_sec, 1412 + .ctime = ctime.tv_sec, 1409 1413 .atimensec = fi->inode.i_atime.tv_nsec, 1410 1414 .mtimensec = fi->inode.i_mtime.tv_nsec, 1411 - .ctimensec = fi->inode.i_ctime.tv_nsec, 1415 + .ctimensec = ctime.tv_nsec, 1412 1416 .mode = fi->inode.i_mode, 1413 1417 .nlink = fi->inode.i_nlink, 1414 1418 .uid = fi->inode.i_uid.val,
+1 -1
fs/gfs2/acl.c
··· 142 142 143 143 ret = __gfs2_set_acl(inode, acl, type); 144 144 if (!ret && mode != inode->i_mode) { 145 - inode->i_ctime = current_time(inode); 145 + inode_set_ctime_current(inode); 146 146 inode->i_mode = mode; 147 147 mark_inode_dirty(inode); 148 148 }
+5 -6
fs/gfs2/bmap.c
··· 1386 1386 ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG; 1387 1387 1388 1388 i_size_write(inode, newsize); 1389 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 1389 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 1390 1390 gfs2_dinode_out(ip, dibh->b_data); 1391 1391 1392 1392 if (journaled) ··· 1583 1583 1584 1584 /* Every transaction boundary, we rewrite the dinode 1585 1585 to keep its di_blocks current in case of failure. */ 1586 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = 1587 - current_time(&ip->i_inode); 1586 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 1588 1587 gfs2_trans_add_meta(ip->i_gl, dibh); 1589 1588 gfs2_dinode_out(ip, dibh->b_data); 1590 1589 brelse(dibh); ··· 1949 1950 gfs2_statfs_change(sdp, 0, +btotal, 0); 1950 1951 gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid, 1951 1952 ip->i_inode.i_gid); 1952 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 1953 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 1953 1954 gfs2_trans_add_meta(ip->i_gl, dibh); 1954 1955 gfs2_dinode_out(ip, dibh->b_data); 1955 1956 up_write(&ip->i_rw_mutex); ··· 1992 1993 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 1993 1994 gfs2_ordered_del_inode(ip); 1994 1995 } 1995 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 1996 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 1996 1997 ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG; 1997 1998 1998 1999 gfs2_trans_add_meta(ip->i_gl, dibh); ··· 2093 2094 goto do_end_trans; 2094 2095 2095 2096 truncate_setsize(inode, size); 2096 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 2097 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 2097 2098 gfs2_trans_add_meta(ip->i_gl, dibh); 2098 2099 gfs2_dinode_out(ip, dibh->b_data); 2099 2100 brelse(dibh);
+8 -7
fs/gfs2/dir.c
··· 130 130 memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size); 131 131 if (ip->i_inode.i_size < offset + size) 132 132 i_size_write(&ip->i_inode, offset + size); 133 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 133 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 134 134 gfs2_dinode_out(ip, dibh->b_data); 135 135 136 136 brelse(dibh); ··· 227 227 228 228 if (ip->i_inode.i_size < offset + copied) 229 229 i_size_write(&ip->i_inode, offset + copied); 230 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 230 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 231 231 232 232 gfs2_trans_add_meta(ip->i_gl, dibh); 233 233 gfs2_dinode_out(ip, dibh->b_data); ··· 1814 1814 gfs2_inum_out(nip, dent); 1815 1815 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode)); 1816 1816 dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip)); 1817 - tv = current_time(&ip->i_inode); 1817 + tv = inode_set_ctime_current(&ip->i_inode); 1818 1818 if (ip->i_diskflags & GFS2_DIF_EXHASH) { 1819 1819 leaf = (struct gfs2_leaf *)bh->b_data; 1820 1820 be16_add_cpu(&leaf->lf_entries, 1); ··· 1825 1825 da->bh = NULL; 1826 1826 brelse(bh); 1827 1827 ip->i_entries++; 1828 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = tv; 1828 + ip->i_inode.i_mtime = tv; 1829 1829 if (S_ISDIR(nip->i_inode.i_mode)) 1830 1830 inc_nlink(&ip->i_inode); 1831 1831 mark_inode_dirty(inode); ··· 1876 1876 const struct qstr *name = &dentry->d_name; 1877 1877 struct gfs2_dirent *dent, *prev = NULL; 1878 1878 struct buffer_head *bh; 1879 - struct timespec64 tv = current_time(&dip->i_inode); 1879 + struct timespec64 tv; 1880 1880 1881 1881 /* Returns _either_ the entry (if its first in block) or the 1882 1882 previous entry otherwise */ ··· 1896 1896 } 1897 1897 1898 1898 dirent_del(dip, bh, prev, dent); 1899 + tv = inode_set_ctime_current(&dip->i_inode); 1899 1900 if (dip->i_diskflags & GFS2_DIF_EXHASH) { 1900 1901 struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data; 1901 1902 u16 entries = be16_to_cpu(leaf->lf_entries); ··· 1911 1910 if (!dip->i_entries) 1912 1911 gfs2_consist_inode(dip); 1913 1912 dip->i_entries--; 1914 - dip->i_inode.i_mtime = dip->i_inode.i_ctime = tv; 1913 + dip->i_inode.i_mtime = tv; 1915 1914 if (d_is_dir(dentry)) 1916 1915 drop_nlink(&dip->i_inode); 1917 1916 mark_inode_dirty(&dip->i_inode); ··· 1952 1951 dent->de_type = cpu_to_be16(new_type); 1953 1952 brelse(bh); 1954 1953 1955 - dip->i_inode.i_mtime = dip->i_inode.i_ctime = current_time(&dip->i_inode); 1954 + dip->i_inode.i_mtime = inode_set_ctime_current(&dip->i_inode); 1956 1955 mark_inode_dirty_sync(&dip->i_inode); 1957 1956 return 0; 1958 1957 }
+1 -1
fs/gfs2/file.c
··· 260 260 error = gfs2_meta_inode_buffer(ip, &bh); 261 261 if (error) 262 262 goto out_trans_end; 263 - inode->i_ctime = current_time(inode); 263 + inode_set_ctime_current(inode); 264 264 gfs2_trans_add_meta(ip->i_gl, bh); 265 265 ip->i_diskflags = new_flags; 266 266 gfs2_dinode_out(ip, bh->b_data);
+2 -2
fs/gfs2/glops.c
··· 437 437 inode->i_atime = atime; 438 438 inode->i_mtime.tv_sec = be64_to_cpu(str->di_mtime); 439 439 inode->i_mtime.tv_nsec = be32_to_cpu(str->di_mtime_nsec); 440 - inode->i_ctime.tv_sec = be64_to_cpu(str->di_ctime); 441 - inode->i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec); 440 + inode_set_ctime(inode, be64_to_cpu(str->di_ctime), 441 + be32_to_cpu(str->di_ctime_nsec)); 442 442 443 443 ip->i_goal = be64_to_cpu(str->di_goal_meta); 444 444 ip->i_generation = be64_to_cpu(str->di_generation);
+8 -8
fs/gfs2/inode.c
··· 690 690 set_nlink(inode, S_ISDIR(mode) ? 2 : 1); 691 691 inode->i_rdev = dev; 692 692 inode->i_size = size; 693 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 693 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 694 694 munge_mode_uid_gid(dip, inode); 695 695 check_and_update_goal(dip); 696 696 ip->i_goal = dip->i_goal; ··· 1029 1029 1030 1030 gfs2_trans_add_meta(ip->i_gl, dibh); 1031 1031 inc_nlink(&ip->i_inode); 1032 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 1032 + inode_set_ctime_current(&ip->i_inode); 1033 1033 ihold(inode); 1034 1034 d_instantiate(dentry, inode); 1035 1035 mark_inode_dirty(inode); ··· 1114 1114 return error; 1115 1115 1116 1116 ip->i_entries = 0; 1117 - inode->i_ctime = current_time(inode); 1117 + inode_set_ctime_current(inode); 1118 1118 if (S_ISDIR(inode->i_mode)) 1119 1119 clear_nlink(inode); 1120 1120 else ··· 1371 1371 if (dir_rename) 1372 1372 return gfs2_dir_mvino(ip, &gfs2_qdotdot, ndip, DT_DIR); 1373 1373 1374 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 1374 + inode_set_ctime_current(&ip->i_inode); 1375 1375 mark_inode_dirty_sync(&ip->i_inode); 1376 1376 return 0; 1377 1377 } ··· 2071 2071 STATX_ATTR_IMMUTABLE | 2072 2072 STATX_ATTR_NODUMP); 2073 2073 2074 - generic_fillattr(&nop_mnt_idmap, inode, stat); 2074 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 2075 2075 2076 2076 if (gfs2_holder_initialized(&gh)) 2077 2077 gfs2_glock_dq_uninit(&gh); ··· 2139 2139 return vfs_setpos(file, ret, inode->i_sb->s_maxbytes); 2140 2140 } 2141 2141 2142 - static int gfs2_update_time(struct inode *inode, struct timespec64 *time, 2143 - int flags) 2142 + static int gfs2_update_time(struct inode *inode, int flags) 2144 2143 { 2145 2144 struct gfs2_inode *ip = GFS2_I(inode); 2146 2145 struct gfs2_glock *gl = ip->i_gl; ··· 2154 2155 if (error) 2155 2156 return error; 2156 2157 } 2157 - return generic_update_time(inode, time, flags); 2158 + generic_update_time(inode, flags); 2159 + return 0; 2158 2160 } 2159 2161 2160 2162 static const struct inode_operations gfs2_file_iops = {
+1 -1
fs/gfs2/quota.c
··· 871 871 size = loc + sizeof(struct gfs2_quota); 872 872 if (size > inode->i_size) 873 873 i_size_write(inode, size); 874 - inode->i_mtime = inode->i_atime = current_time(inode); 874 + inode->i_mtime = inode_set_ctime_current(inode); 875 875 mark_inode_dirty(inode); 876 876 set_bit(QDF_REFRESH, &qd->qd_flags); 877 877 }
+2 -2
fs/gfs2/super.c
··· 412 412 str->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(inode)); 413 413 str->di_atime = cpu_to_be64(inode->i_atime.tv_sec); 414 414 str->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec); 415 - str->di_ctime = cpu_to_be64(inode->i_ctime.tv_sec); 415 + str->di_ctime = cpu_to_be64(inode_get_ctime(inode).tv_sec); 416 416 417 417 str->di_goal_meta = cpu_to_be64(ip->i_goal); 418 418 str->di_goal_data = cpu_to_be64(ip->i_goal); ··· 429 429 str->di_eattr = cpu_to_be64(ip->i_eattr); 430 430 str->di_atime_nsec = cpu_to_be32(inode->i_atime.tv_nsec); 431 431 str->di_mtime_nsec = cpu_to_be32(inode->i_mtime.tv_nsec); 432 - str->di_ctime_nsec = cpu_to_be32(inode->i_ctime.tv_nsec); 432 + str->di_ctime_nsec = cpu_to_be32(inode_get_ctime(inode).tv_nsec); 433 433 } 434 434 435 435 /**
+4 -4
fs/gfs2/xattr.c
··· 311 311 ea->ea_num_ptrs = 0; 312 312 } 313 313 314 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 314 + inode_set_ctime_current(&ip->i_inode); 315 315 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC); 316 316 317 317 gfs2_trans_end(sdp); ··· 763 763 if (error) 764 764 goto out_end_trans; 765 765 766 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 766 + inode_set_ctime_current(&ip->i_inode); 767 767 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC); 768 768 769 769 out_end_trans: ··· 888 888 if (es->es_el) 889 889 ea_set_remove_stuffed(ip, es->es_el); 890 890 891 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 891 + inode_set_ctime_current(&ip->i_inode); 892 892 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC); 893 893 894 894 gfs2_trans_end(GFS2_SB(&ip->i_inode)); ··· 1106 1106 ea->ea_type = GFS2_EATYPE_UNUSED; 1107 1107 } 1108 1108 1109 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 1109 + inode_set_ctime_current(&ip->i_inode); 1110 1110 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC); 1111 1111 1112 1112 gfs2_trans_end(GFS2_SB(&ip->i_inode));
+4 -4
fs/hfs/catalog.c
··· 133 133 goto err1; 134 134 135 135 dir->i_size++; 136 - dir->i_mtime = dir->i_ctime = current_time(dir); 136 + dir->i_mtime = inode_set_ctime_current(dir); 137 137 mark_inode_dirty(dir); 138 138 hfs_find_exit(&fd); 139 139 return 0; ··· 269 269 } 270 270 271 271 dir->i_size--; 272 - dir->i_mtime = dir->i_ctime = current_time(dir); 272 + dir->i_mtime = inode_set_ctime_current(dir); 273 273 mark_inode_dirty(dir); 274 274 res = 0; 275 275 out: ··· 337 337 if (err) 338 338 goto out; 339 339 dst_dir->i_size++; 340 - dst_dir->i_mtime = dst_dir->i_ctime = current_time(dst_dir); 340 + dst_dir->i_mtime = inode_set_ctime_current(dst_dir); 341 341 mark_inode_dirty(dst_dir); 342 342 343 343 /* finally remove the old entry */ ··· 349 349 if (err) 350 350 goto out; 351 351 src_dir->i_size--; 352 - src_dir->i_mtime = src_dir->i_ctime = current_time(src_dir); 352 + src_dir->i_mtime = inode_set_ctime_current(src_dir); 353 353 mark_inode_dirty(src_dir); 354 354 355 355 type = entry.type;
+1 -1
fs/hfs/dir.c
··· 263 263 if (res) 264 264 return res; 265 265 clear_nlink(inode); 266 - inode->i_ctime = current_time(inode); 266 + inode_set_ctime_current(inode); 267 267 hfs_delete_inode(inode); 268 268 mark_inode_dirty(inode); 269 269 return 0;
+6 -7
fs/hfs/inode.c
··· 200 200 inode->i_uid = current_fsuid(); 201 201 inode->i_gid = current_fsgid(); 202 202 set_nlink(inode, 1); 203 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 203 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 204 204 HFS_I(inode)->flags = 0; 205 205 HFS_I(inode)->rsrc_inode = NULL; 206 206 HFS_I(inode)->fs_blocks = 0; ··· 355 355 inode->i_mode |= S_IWUGO; 356 356 inode->i_mode &= ~hsb->s_file_umask; 357 357 inode->i_mode |= S_IFREG; 358 - inode->i_ctime = inode->i_atime = inode->i_mtime = 359 - hfs_m_to_utime(rec->file.MdDat); 358 + inode->i_atime = inode->i_mtime = inode_set_ctime_to_ts(inode, 359 + hfs_m_to_utime(rec->file.MdDat)); 360 360 inode->i_op = &hfs_file_inode_operations; 361 361 inode->i_fop = &hfs_file_operations; 362 362 inode->i_mapping->a_ops = &hfs_aops; ··· 366 366 inode->i_size = be16_to_cpu(rec->dir.Val) + 2; 367 367 HFS_I(inode)->fs_blocks = 0; 368 368 inode->i_mode = S_IFDIR | (S_IRWXUGO & ~hsb->s_dir_umask); 369 - inode->i_ctime = inode->i_atime = inode->i_mtime = 370 - hfs_m_to_utime(rec->dir.MdDat); 369 + inode->i_atime = inode->i_mtime = inode_set_ctime_to_ts(inode, 370 + hfs_m_to_utime(rec->dir.MdDat)); 371 371 inode->i_op = &hfs_dir_inode_operations; 372 372 inode->i_fop = &hfs_dir_operations; 373 373 break; ··· 654 654 655 655 truncate_setsize(inode, attr->ia_size); 656 656 hfs_file_truncate(inode); 657 - inode->i_atime = inode->i_mtime = inode->i_ctime = 658 - current_time(inode); 657 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 659 658 } 660 659 661 660 setattr_copy(&nop_mnt_idmap, inode, attr);
+3 -1
fs/hfs/sysdep.c
··· 28 28 /* fix up inode on a timezone change */ 29 29 diff = sys_tz.tz_minuteswest * 60 - HFS_I(inode)->tz_secondswest; 30 30 if (diff) { 31 - inode->i_ctime.tv_sec += diff; 31 + struct timespec64 ctime = inode_get_ctime(inode); 32 + 33 + inode_set_ctime(inode, ctime.tv_sec + diff, ctime.tv_nsec); 32 34 inode->i_atime.tv_sec += diff; 33 35 inode->i_mtime.tv_sec += diff; 34 36 HFS_I(inode)->tz_secondswest += diff;
+4 -4
fs/hfsplus/catalog.c
··· 312 312 dir->i_size++; 313 313 if (S_ISDIR(inode->i_mode)) 314 314 hfsplus_subfolders_inc(dir); 315 - dir->i_mtime = dir->i_ctime = current_time(dir); 315 + dir->i_mtime = inode_set_ctime_current(dir); 316 316 hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); 317 317 318 318 hfs_find_exit(&fd); ··· 417 417 dir->i_size--; 418 418 if (type == HFSPLUS_FOLDER) 419 419 hfsplus_subfolders_dec(dir); 420 - dir->i_mtime = dir->i_ctime = current_time(dir); 420 + dir->i_mtime = inode_set_ctime_current(dir); 421 421 hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); 422 422 423 423 if (type == HFSPLUS_FILE || type == HFSPLUS_FOLDER) { ··· 494 494 dst_dir->i_size++; 495 495 if (type == HFSPLUS_FOLDER) 496 496 hfsplus_subfolders_inc(dst_dir); 497 - dst_dir->i_mtime = dst_dir->i_ctime = current_time(dst_dir); 497 + dst_dir->i_mtime = inode_set_ctime_current(dst_dir); 498 498 499 499 /* finally remove the old entry */ 500 500 err = hfsplus_cat_build_key(sb, src_fd.search_key, ··· 511 511 src_dir->i_size--; 512 512 if (type == HFSPLUS_FOLDER) 513 513 hfsplus_subfolders_dec(src_dir); 514 - src_dir->i_mtime = src_dir->i_ctime = current_time(src_dir); 514 + src_dir->i_mtime = inode_set_ctime_current(src_dir); 515 515 516 516 /* remove old thread entry */ 517 517 hfsplus_cat_build_key_with_cnid(sb, src_fd.search_key, cnid);
+3 -3
fs/hfsplus/dir.c
··· 346 346 inc_nlink(inode); 347 347 hfsplus_instantiate(dst_dentry, inode, cnid); 348 348 ihold(inode); 349 - inode->i_ctime = current_time(inode); 349 + inode_set_ctime_current(inode); 350 350 mark_inode_dirty(inode); 351 351 sbi->file_count++; 352 352 hfsplus_mark_mdb_dirty(dst_dir->i_sb); ··· 405 405 hfsplus_delete_inode(inode); 406 406 } else 407 407 sbi->file_count--; 408 - inode->i_ctime = current_time(inode); 408 + inode_set_ctime_current(inode); 409 409 mark_inode_dirty(inode); 410 410 out: 411 411 mutex_unlock(&sbi->vh_mutex); ··· 426 426 if (res) 427 427 goto out; 428 428 clear_nlink(inode); 429 - inode->i_ctime = current_time(inode); 429 + inode_set_ctime_current(inode); 430 430 hfsplus_delete_inode(inode); 431 431 mark_inode_dirty(inode); 432 432 out:
+10 -8
fs/hfsplus/inode.c
··· 267 267 } 268 268 truncate_setsize(inode, attr->ia_size); 269 269 hfsplus_file_truncate(inode); 270 - inode->i_mtime = inode->i_ctime = current_time(inode); 270 + inode->i_mtime = inode_set_ctime_current(inode); 271 271 } 272 272 273 273 setattr_copy(&nop_mnt_idmap, inode, attr); ··· 298 298 stat->attributes_mask |= STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE | 299 299 STATX_ATTR_NODUMP; 300 300 301 - generic_fillattr(&nop_mnt_idmap, inode, stat); 301 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 302 302 return 0; 303 303 } 304 304 ··· 392 392 inode->i_ino = sbi->next_cnid++; 393 393 inode_init_owner(&nop_mnt_idmap, inode, dir, mode); 394 394 set_nlink(inode, 1); 395 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 395 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 396 396 397 397 hip = HFSPLUS_I(inode); 398 398 INIT_LIST_HEAD(&hip->open_dir_list); ··· 523 523 inode->i_size = 2 + be32_to_cpu(folder->valence); 524 524 inode->i_atime = hfsp_mt2ut(folder->access_date); 525 525 inode->i_mtime = hfsp_mt2ut(folder->content_mod_date); 526 - inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date); 526 + inode_set_ctime_to_ts(inode, 527 + hfsp_mt2ut(folder->attribute_mod_date)); 527 528 HFSPLUS_I(inode)->create_date = folder->create_date; 528 529 HFSPLUS_I(inode)->fs_blocks = 0; 529 530 if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) { ··· 565 564 } 566 565 inode->i_atime = hfsp_mt2ut(file->access_date); 567 566 inode->i_mtime = hfsp_mt2ut(file->content_mod_date); 568 - inode->i_ctime = hfsp_mt2ut(file->attribute_mod_date); 567 + inode_set_ctime_to_ts(inode, 568 + hfsp_mt2ut(file->attribute_mod_date)); 569 569 HFSPLUS_I(inode)->create_date = file->create_date; 570 570 } else { 571 571 pr_err("bad catalog entry used to create inode\n"); ··· 611 609 hfsplus_cat_set_perms(inode, &folder->permissions); 612 610 folder->access_date = hfsp_ut2mt(inode->i_atime); 613 611 folder->content_mod_date = hfsp_ut2mt(inode->i_mtime); 614 - folder->attribute_mod_date = hfsp_ut2mt(inode->i_ctime); 612 + folder->attribute_mod_date = hfsp_ut2mt(inode_get_ctime(inode)); 615 613 folder->valence = cpu_to_be32(inode->i_size - 2); 616 614 if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) { 617 615 folder->subfolders = ··· 646 644 file->flags &= cpu_to_be16(~HFSPLUS_FILE_LOCKED); 647 645 file->access_date = hfsp_ut2mt(inode->i_atime); 648 646 file->content_mod_date = hfsp_ut2mt(inode->i_mtime); 649 - file->attribute_mod_date = hfsp_ut2mt(inode->i_ctime); 647 + file->attribute_mod_date = hfsp_ut2mt(inode_get_ctime(inode)); 650 648 hfs_bnode_write(fd.bnode, &entry, fd.entryoffset, 651 649 sizeof(struct hfsplus_cat_file)); 652 650 } ··· 702 700 else 703 701 hip->userflags &= ~HFSPLUS_FLG_NODUMP; 704 702 705 - inode->i_ctime = current_time(inode); 703 + inode_set_ctime_current(inode); 706 704 mark_inode_dirty(inode); 707 705 708 706 return 0;
+1 -2
fs/hostfs/hostfs_kern.c
··· 517 517 (struct timespec64){ st->atime.tv_sec, st->atime.tv_nsec }; 518 518 ino->i_mtime = 519 519 (struct timespec64){ st->mtime.tv_sec, st->mtime.tv_nsec }; 520 - ino->i_ctime = 521 - (struct timespec64){ st->ctime.tv_sec, st->ctime.tv_nsec }; 520 + inode_set_ctime(ino, st->ctime.tv_sec, st->ctime.tv_nsec); 522 521 ino->i_size = st->size; 523 522 ino->i_blocks = st->blocks; 524 523 return 0;
+4 -4
fs/hpfs/dir.c
··· 277 277 * inode. 278 278 */ 279 279 280 - if (!result->i_ctime.tv_sec) { 281 - if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date)))) 282 - result->i_ctime.tv_sec = 1; 283 - result->i_ctime.tv_nsec = 0; 280 + if (!inode_get_ctime(result).tv_sec) { 281 + time64_t csec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date)); 282 + 283 + inode_set_ctime(result, csec ? csec : 1, 0); 284 284 result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->write_date)); 285 285 result->i_mtime.tv_nsec = 0; 286 286 result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date));
+3 -3
fs/hpfs/inode.c
··· 36 36 hpfs_inode->i_rddir_off = NULL; 37 37 hpfs_inode->i_dirty = 0; 38 38 39 - i->i_ctime.tv_sec = i->i_ctime.tv_nsec = 0; 39 + inode_set_ctime(i, 0, 0); 40 40 i->i_mtime.tv_sec = i->i_mtime.tv_nsec = 0; 41 41 i->i_atime.tv_sec = i->i_atime.tv_nsec = 0; 42 42 } ··· 232 232 if (de) { 233 233 de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec)); 234 234 de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec)); 235 - de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec)); 235 + de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_ctime(i).tv_sec)); 236 236 de->read_only = !(i->i_mode & 0222); 237 237 de->ea_size = cpu_to_le32(hpfs_inode->i_ea_size); 238 238 hpfs_mark_4buffers_dirty(&qbh); ··· 242 242 if ((de = map_dirent(i, hpfs_inode->i_dno, "\001\001", 2, NULL, &qbh))) { 243 243 de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec)); 244 244 de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec)); 245 - de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec)); 245 + de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_ctime(i).tv_sec)); 246 246 de->read_only = !(i->i_mode & 0222); 247 247 de->ea_size = cpu_to_le32(/*hpfs_inode->i_ea_size*/0); 248 248 de->file_size = cpu_to_le32(0);
+10 -19
fs/hpfs/namei.c
··· 13 13 { 14 14 time64_t t = local_to_gmt(dir->i_sb, local_get_seconds(dir->i_sb)); 15 15 if (t == dir->i_mtime.tv_sec && 16 - t == dir->i_ctime.tv_sec) 16 + t == inode_get_ctime(dir).tv_sec) 17 17 return; 18 - dir->i_mtime.tv_sec = dir->i_ctime.tv_sec = t; 19 - dir->i_mtime.tv_nsec = dir->i_ctime.tv_nsec = 0; 18 + dir->i_mtime = inode_set_ctime(dir, t, 0); 20 19 hpfs_write_inode_nolock(dir); 21 20 } 22 21 ··· 58 59 result->i_ino = fno; 59 60 hpfs_i(result)->i_parent_dir = dir->i_ino; 60 61 hpfs_i(result)->i_dno = dno; 61 - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)); 62 - result->i_ctime.tv_nsec = 0; 63 - result->i_mtime.tv_nsec = 0; 64 - result->i_atime.tv_nsec = 0; 62 + result->i_mtime = result->i_atime = 63 + inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0); 65 64 hpfs_i(result)->i_ea_size = 0; 66 65 result->i_mode |= S_IFDIR; 67 66 result->i_op = &hpfs_dir_iops; ··· 164 167 result->i_fop = &hpfs_file_ops; 165 168 set_nlink(result, 1); 166 169 hpfs_i(result)->i_parent_dir = dir->i_ino; 167 - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)); 168 - result->i_ctime.tv_nsec = 0; 169 - result->i_mtime.tv_nsec = 0; 170 - result->i_atime.tv_nsec = 0; 170 + result->i_mtime = result->i_atime = 171 + inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0); 171 172 hpfs_i(result)->i_ea_size = 0; 172 173 if (dee.read_only) 173 174 result->i_mode &= ~0222; ··· 245 250 hpfs_init_inode(result); 246 251 result->i_ino = fno; 247 252 hpfs_i(result)->i_parent_dir = dir->i_ino; 248 - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)); 249 - result->i_ctime.tv_nsec = 0; 250 - result->i_mtime.tv_nsec = 0; 251 - result->i_atime.tv_nsec = 0; 253 + result->i_mtime = result->i_atime = 254 + inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0); 252 255 hpfs_i(result)->i_ea_size = 0; 253 256 result->i_uid = current_fsuid(); 254 257 result->i_gid = current_fsgid(); ··· 319 326 result->i_ino = fno; 320 327 hpfs_init_inode(result); 321 328 hpfs_i(result)->i_parent_dir = dir->i_ino; 322 - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)); 323 - result->i_ctime.tv_nsec = 0; 324 - result->i_mtime.tv_nsec = 0; 325 - result->i_atime.tv_nsec = 0; 329 + result->i_mtime = result->i_atime = 330 + inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0); 326 331 hpfs_i(result)->i_ea_size = 0; 327 332 result->i_mode = S_IFLNK | 0777; 328 333 result->i_uid = current_fsuid();
+3 -2
fs/hpfs/super.c
··· 729 729 root->i_atime.tv_nsec = 0; 730 730 root->i_mtime.tv_sec = local_to_gmt(s, le32_to_cpu(de->write_date)); 731 731 root->i_mtime.tv_nsec = 0; 732 - root->i_ctime.tv_sec = local_to_gmt(s, le32_to_cpu(de->creation_date)); 733 - root->i_ctime.tv_nsec = 0; 732 + inode_set_ctime(root, 733 + local_to_gmt(s, le32_to_cpu(de->creation_date)), 734 + 0); 734 735 hpfs_i(root)->i_ea_size = le32_to_cpu(de->ea_size); 735 736 hpfs_i(root)->i_parent_dir = root->i_ino; 736 737 if (root->i_size == -1)
+6 -6
fs/hugetlbfs/inode.c
··· 887 887 888 888 if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) 889 889 i_size_write(inode, offset + len); 890 - inode->i_ctime = current_time(inode); 890 + inode_set_ctime_current(inode); 891 891 out: 892 892 inode_unlock(inode); 893 893 return error; ··· 935 935 inode->i_mode = S_IFDIR | ctx->mode; 936 936 inode->i_uid = ctx->uid; 937 937 inode->i_gid = ctx->gid; 938 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 938 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 939 939 inode->i_op = &hugetlbfs_dir_inode_operations; 940 940 inode->i_fop = &simple_dir_operations; 941 941 /* directory inodes start off with i_nlink == 2 (for "." entry) */ ··· 979 979 lockdep_set_class(&inode->i_mapping->i_mmap_rwsem, 980 980 &hugetlbfs_i_mmap_rwsem_key); 981 981 inode->i_mapping->a_ops = &hugetlbfs_aops; 982 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 982 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 983 983 inode->i_mapping->private_data = resv_map; 984 984 info->seals = F_SEAL_SEAL; 985 985 switch (mode & S_IFMT) { ··· 1022 1022 inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev); 1023 1023 if (!inode) 1024 1024 return -ENOSPC; 1025 - dir->i_ctime = dir->i_mtime = current_time(dir); 1025 + dir->i_mtime = inode_set_ctime_current(dir); 1026 1026 d_instantiate(dentry, inode); 1027 1027 dget(dentry);/* Extra count - pin the dentry in core */ 1028 1028 return 0; ··· 1054 1054 inode = hugetlbfs_get_inode(dir->i_sb, dir, mode | S_IFREG, 0); 1055 1055 if (!inode) 1056 1056 return -ENOSPC; 1057 - dir->i_ctime = dir->i_mtime = current_time(dir); 1057 + dir->i_mtime = inode_set_ctime_current(dir); 1058 1058 d_tmpfile(file, inode); 1059 1059 return finish_open_simple(file, 0); 1060 1060 } ··· 1076 1076 } else 1077 1077 iput(inode); 1078 1078 } 1079 - dir->i_ctime = dir->i_mtime = current_time(dir); 1079 + dir->i_mtime = inode_set_ctime_current(dir); 1080 1080 1081 1081 return error; 1082 1082 }
+175 -41
fs/inode.c
··· 1850 1850 static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, 1851 1851 struct timespec64 now) 1852 1852 { 1853 + struct timespec64 ctime; 1853 1854 1854 1855 if (!(mnt->mnt_flags & MNT_RELATIME)) 1855 1856 return 1; ··· 1862 1861 /* 1863 1862 * Is ctime younger than or equal to atime? If yes, update atime: 1864 1863 */ 1865 - if (timespec64_compare(&inode->i_ctime, &inode->i_atime) >= 0) 1864 + ctime = inode_get_ctime(inode); 1865 + if (timespec64_compare(&ctime, &inode->i_atime) >= 0) 1866 1866 return 1; 1867 1867 1868 1868 /* ··· 1878 1876 return 0; 1879 1877 } 1880 1878 1881 - int generic_update_time(struct inode *inode, struct timespec64 *time, int flags) 1879 + /** 1880 + * inode_update_timestamps - update the timestamps on the inode 1881 + * @inode: inode to be updated 1882 + * @flags: S_* flags that needed to be updated 1883 + * 1884 + * The update_time function is called when an inode's timestamps need to be 1885 + * updated for a read or write operation. This function handles updating the 1886 + * actual timestamps. It's up to the caller to ensure that the inode is marked 1887 + * dirty appropriately. 1888 + * 1889 + * In the case where any of S_MTIME, S_CTIME, or S_VERSION need to be updated, 1890 + * attempt to update all three of them. S_ATIME updates can be handled 1891 + * independently of the rest. 1892 + * 1893 + * Returns a set of S_* flags indicating which values changed. 1894 + */ 1895 + int inode_update_timestamps(struct inode *inode, int flags) 1882 1896 { 1883 - int dirty_flags = 0; 1897 + int updated = 0; 1898 + struct timespec64 now; 1884 1899 1885 - if (flags & (S_ATIME | S_CTIME | S_MTIME)) { 1886 - if (flags & S_ATIME) 1887 - inode->i_atime = *time; 1888 - if (flags & S_CTIME) 1889 - inode->i_ctime = *time; 1890 - if (flags & S_MTIME) 1891 - inode->i_mtime = *time; 1900 + if (flags & (S_MTIME|S_CTIME|S_VERSION)) { 1901 + struct timespec64 ctime = inode_get_ctime(inode); 1892 1902 1893 - if (inode->i_sb->s_flags & SB_LAZYTIME) 1894 - dirty_flags |= I_DIRTY_TIME; 1895 - else 1896 - dirty_flags |= I_DIRTY_SYNC; 1903 + now = inode_set_ctime_current(inode); 1904 + if (!timespec64_equal(&now, &ctime)) 1905 + updated |= S_CTIME; 1906 + if (!timespec64_equal(&now, &inode->i_mtime)) { 1907 + inode->i_mtime = now; 1908 + updated |= S_MTIME; 1909 + } 1910 + if (IS_I_VERSION(inode) && inode_maybe_inc_iversion(inode, updated)) 1911 + updated |= S_VERSION; 1912 + } else { 1913 + now = current_time(inode); 1897 1914 } 1898 1915 1899 - if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false)) 1900 - dirty_flags |= I_DIRTY_SYNC; 1916 + if (flags & S_ATIME) { 1917 + if (!timespec64_equal(&now, &inode->i_atime)) { 1918 + inode->i_atime = now; 1919 + updated |= S_ATIME; 1920 + } 1921 + } 1922 + return updated; 1923 + } 1924 + EXPORT_SYMBOL(inode_update_timestamps); 1901 1925 1926 + /** 1927 + * generic_update_time - update the timestamps on the inode 1928 + * @inode: inode to be updated 1929 + * @flags: S_* flags that needed to be updated 1930 + * 1931 + * The update_time function is called when an inode's timestamps need to be 1932 + * updated for a read or write operation. In the case where any of S_MTIME, S_CTIME, 1933 + * or S_VERSION need to be updated we attempt to update all three of them. S_ATIME 1934 + * updates can be handled done independently of the rest. 1935 + * 1936 + * Returns a S_* mask indicating which fields were updated. 1937 + */ 1938 + int generic_update_time(struct inode *inode, int flags) 1939 + { 1940 + int updated = inode_update_timestamps(inode, flags); 1941 + int dirty_flags = 0; 1942 + 1943 + if (updated & (S_ATIME|S_MTIME|S_CTIME)) 1944 + dirty_flags = inode->i_sb->s_flags & SB_LAZYTIME ? I_DIRTY_TIME : I_DIRTY_SYNC; 1945 + if (updated & S_VERSION) 1946 + dirty_flags |= I_DIRTY_SYNC; 1902 1947 __mark_inode_dirty(inode, dirty_flags); 1903 - return 0; 1948 + return updated; 1904 1949 } 1905 1950 EXPORT_SYMBOL(generic_update_time); 1906 1951 ··· 1955 1906 * This does the actual work of updating an inodes time or version. Must have 1956 1907 * had called mnt_want_write() before calling this. 1957 1908 */ 1958 - int inode_update_time(struct inode *inode, struct timespec64 *time, int flags) 1909 + int inode_update_time(struct inode *inode, int flags) 1959 1910 { 1960 1911 if (inode->i_op->update_time) 1961 - return inode->i_op->update_time(inode, time, flags); 1962 - return generic_update_time(inode, time, flags); 1912 + return inode->i_op->update_time(inode, flags); 1913 + generic_update_time(inode, flags); 1914 + return 0; 1963 1915 } 1964 1916 EXPORT_SYMBOL(inode_update_time); 1965 1917 ··· 2012 1962 { 2013 1963 struct vfsmount *mnt = path->mnt; 2014 1964 struct inode *inode = d_inode(path->dentry); 2015 - struct timespec64 now; 2016 1965 2017 1966 if (!atime_needs_update(path, inode)) 2018 1967 return; ··· 2030 1981 * We may also fail on filesystems that have the ability to make parts 2031 1982 * of the fs read only, e.g. subvolumes in Btrfs. 2032 1983 */ 2033 - now = current_time(inode); 2034 - inode_update_time(inode, &now, S_ATIME); 1984 + inode_update_time(inode, S_ATIME); 2035 1985 __mnt_drop_write(mnt); 2036 1986 skip_update: 2037 1987 sb_end_write(inode->i_sb); ··· 2115 2067 } 2116 2068 EXPORT_SYMBOL(file_remove_privs); 2117 2069 2118 - static int inode_needs_update_time(struct inode *inode, struct timespec64 *now) 2070 + /** 2071 + * current_mgtime - Return FS time (possibly fine-grained) 2072 + * @inode: inode. 2073 + * 2074 + * Return the current time truncated to the time granularity supported by 2075 + * the fs, as suitable for a ctime/mtime change. If the ctime is flagged 2076 + * as having been QUERIED, get a fine-grained timestamp. 2077 + */ 2078 + struct timespec64 current_mgtime(struct inode *inode) 2079 + { 2080 + struct timespec64 now, ctime; 2081 + atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec; 2082 + long nsec = atomic_long_read(pnsec); 2083 + 2084 + if (nsec & I_CTIME_QUERIED) { 2085 + ktime_get_real_ts64(&now); 2086 + return timestamp_truncate(now, inode); 2087 + } 2088 + 2089 + ktime_get_coarse_real_ts64(&now); 2090 + now = timestamp_truncate(now, inode); 2091 + 2092 + /* 2093 + * If we've recently fetched a fine-grained timestamp 2094 + * then the coarse-grained one may still be earlier than the 2095 + * existing ctime. Just keep the existing value if so. 2096 + */ 2097 + ctime = inode_get_ctime(inode); 2098 + if (timespec64_compare(&ctime, &now) > 0) 2099 + now = ctime; 2100 + 2101 + return now; 2102 + } 2103 + EXPORT_SYMBOL(current_mgtime); 2104 + 2105 + static struct timespec64 current_ctime(struct inode *inode) 2106 + { 2107 + if (is_mgtime(inode)) 2108 + return current_mgtime(inode); 2109 + return current_time(inode); 2110 + } 2111 + 2112 + static int inode_needs_update_time(struct inode *inode) 2119 2113 { 2120 2114 int sync_it = 0; 2115 + struct timespec64 now = current_ctime(inode); 2116 + struct timespec64 ctime; 2121 2117 2122 2118 /* First try to exhaust all avenues to not sync */ 2123 2119 if (IS_NOCMTIME(inode)) 2124 2120 return 0; 2125 2121 2126 - if (!timespec64_equal(&inode->i_mtime, now)) 2122 + if (!timespec64_equal(&inode->i_mtime, &now)) 2127 2123 sync_it = S_MTIME; 2128 2124 2129 - if (!timespec64_equal(&inode->i_ctime, now)) 2125 + ctime = inode_get_ctime(inode); 2126 + if (!timespec64_equal(&ctime, &now)) 2130 2127 sync_it |= S_CTIME; 2131 2128 2132 2129 if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode)) ··· 2180 2087 return sync_it; 2181 2088 } 2182 2089 2183 - static int __file_update_time(struct file *file, struct timespec64 *now, 2184 - int sync_mode) 2090 + static int __file_update_time(struct file *file, int sync_mode) 2185 2091 { 2186 2092 int ret = 0; 2187 2093 struct inode *inode = file_inode(file); 2188 2094 2189 2095 /* try to update time settings */ 2190 2096 if (!__mnt_want_write_file(file)) { 2191 - ret = inode_update_time(inode, now, sync_mode); 2097 + ret = inode_update_time(inode, sync_mode); 2192 2098 __mnt_drop_write_file(file); 2193 2099 } 2194 2100 ··· 2212 2120 { 2213 2121 int ret; 2214 2122 struct inode *inode = file_inode(file); 2215 - struct timespec64 now = current_time(inode); 2216 2123 2217 - ret = inode_needs_update_time(inode, &now); 2124 + ret = inode_needs_update_time(inode); 2218 2125 if (ret <= 0) 2219 2126 return ret; 2220 2127 2221 - return __file_update_time(file, &now, ret); 2128 + return __file_update_time(file, ret); 2222 2129 } 2223 2130 EXPORT_SYMBOL(file_update_time); 2224 2131 ··· 2240 2149 { 2241 2150 int ret; 2242 2151 struct inode *inode = file_inode(file); 2243 - struct timespec64 now = current_time(inode); 2244 2152 2245 2153 /* 2246 2154 * Clear the security bits if the process is not being run by root. ··· 2252 2162 if (unlikely(file->f_mode & FMODE_NOCMTIME)) 2253 2163 return 0; 2254 2164 2255 - ret = inode_needs_update_time(inode, &now); 2165 + ret = inode_needs_update_time(inode); 2256 2166 if (ret <= 0) 2257 2167 return ret; 2258 2168 if (flags & IOCB_NOWAIT) 2259 2169 return -EAGAIN; 2260 2170 2261 - return __file_update_time(file, &now, ret); 2171 + return __file_update_time(file, ret); 2262 2172 } 2263 2173 2264 2174 /** ··· 2578 2488 struct timespec64 now; 2579 2489 2580 2490 ktime_get_coarse_real_ts64(&now); 2581 - 2582 - if (unlikely(!inode->i_sb)) { 2583 - WARN(1, "current_time() called with uninitialized super_block in the inode"); 2584 - return now; 2585 - } 2586 - 2587 2491 return timestamp_truncate(now, inode); 2588 2492 } 2589 2493 EXPORT_SYMBOL(current_time); 2494 + 2495 + /** 2496 + * inode_set_ctime_current - set the ctime to current_time 2497 + * @inode: inode 2498 + * 2499 + * Set the inode->i_ctime to the current value for the inode. Returns 2500 + * the current value that was assigned to i_ctime. 2501 + */ 2502 + struct timespec64 inode_set_ctime_current(struct inode *inode) 2503 + { 2504 + struct timespec64 now; 2505 + struct timespec64 ctime; 2506 + 2507 + ctime.tv_nsec = READ_ONCE(inode->__i_ctime.tv_nsec); 2508 + if (!(ctime.tv_nsec & I_CTIME_QUERIED)) { 2509 + now = current_time(inode); 2510 + 2511 + /* Just copy it into place if it's not multigrain */ 2512 + if (!is_mgtime(inode)) { 2513 + inode_set_ctime_to_ts(inode, now); 2514 + return now; 2515 + } 2516 + 2517 + /* 2518 + * If we've recently updated with a fine-grained timestamp, 2519 + * then the coarse-grained one may still be earlier than the 2520 + * existing ctime. Just keep the existing value if so. 2521 + */ 2522 + ctime.tv_sec = inode->__i_ctime.tv_sec; 2523 + if (timespec64_compare(&ctime, &now) > 0) 2524 + return ctime; 2525 + 2526 + /* 2527 + * Ctime updates are usually protected by the inode_lock, but 2528 + * we can still race with someone setting the QUERIED flag. 2529 + * Try to swap the new nsec value into place. If it's changed 2530 + * in the interim, then just go with a fine-grained timestamp. 2531 + */ 2532 + if (cmpxchg(&inode->__i_ctime.tv_nsec, ctime.tv_nsec, 2533 + now.tv_nsec) != ctime.tv_nsec) 2534 + goto fine_grained; 2535 + inode->__i_ctime.tv_sec = now.tv_sec; 2536 + return now; 2537 + } 2538 + fine_grained: 2539 + ktime_get_real_ts64(&now); 2540 + inode_set_ctime_to_ts(inode, timestamp_truncate(now, inode)); 2541 + return now; 2542 + } 2543 + EXPORT_SYMBOL(inode_set_ctime_current); 2590 2544 2591 2545 /** 2592 2546 * in_group_or_capable - check whether caller is CAP_FSETID privileged
+2 -7
fs/isofs/inode.c
··· 1422 1422 inode->i_ino, de->flags[-high_sierra]); 1423 1423 } 1424 1424 #endif 1425 - 1426 - inode->i_mtime.tv_sec = 1427 - inode->i_atime.tv_sec = 1428 - inode->i_ctime.tv_sec = iso_date(de->date, high_sierra); 1429 - inode->i_mtime.tv_nsec = 1430 - inode->i_atime.tv_nsec = 1431 - inode->i_ctime.tv_nsec = 0; 1425 + inode->i_mtime = inode->i_atime = 1426 + inode_set_ctime(inode, iso_date(de->date, high_sierra), 0); 1432 1427 1433 1428 ei->i_first_extent = (isonum_733(de->extent) + 1434 1429 isonum_711(de->ext_attr_length));
+7 -9
fs/isofs/rock.c
··· 421 421 /* Rock ridge never appears on a High Sierra disk */ 422 422 cnt = 0; 423 423 if (rr->u.TF.flags & TF_CREATE) { 424 - inode->i_ctime.tv_sec = 425 - iso_date(rr->u.TF.times[cnt++].time, 426 - 0); 427 - inode->i_ctime.tv_nsec = 0; 424 + inode_set_ctime(inode, 425 + iso_date(rr->u.TF.times[cnt++].time, 0), 426 + 0); 428 427 } 429 428 if (rr->u.TF.flags & TF_MODIFY) { 430 429 inode->i_mtime.tv_sec = ··· 438 439 inode->i_atime.tv_nsec = 0; 439 440 } 440 441 if (rr->u.TF.flags & TF_ATTRIBUTES) { 441 - inode->i_ctime.tv_sec = 442 - iso_date(rr->u.TF.times[cnt++].time, 443 - 0); 444 - inode->i_ctime.tv_nsec = 0; 442 + inode_set_ctime(inode, 443 + iso_date(rr->u.TF.times[cnt++].time, 0), 444 + 0); 445 445 } 446 446 break; 447 447 case SIG('S', 'L'): ··· 532 534 inode->i_size = reloc->i_size; 533 535 inode->i_blocks = reloc->i_blocks; 534 536 inode->i_atime = reloc->i_atime; 535 - inode->i_ctime = reloc->i_ctime; 537 + inode_set_ctime_to_ts(inode, inode_get_ctime(reloc)); 536 538 inode->i_mtime = reloc->i_mtime; 537 539 iput(reloc); 538 540 break;
+15 -9
fs/jffs2/dir.c
··· 204 204 if (ret) 205 205 goto fail; 206 206 207 - dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(ri->ctime)); 207 + dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, 208 + ITIME(je32_to_cpu(ri->ctime))); 208 209 209 210 jffs2_free_raw_inode(ri); 210 211 ··· 238 237 if (dead_f->inocache) 239 238 set_nlink(d_inode(dentry), dead_f->inocache->pino_nlink); 240 239 if (!ret) 241 - dir_i->i_mtime = dir_i->i_ctime = ITIME(now); 240 + dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, ITIME(now)); 242 241 return ret; 243 242 } 244 243 /***********************************************************************/ ··· 272 271 set_nlink(d_inode(old_dentry), ++f->inocache->pino_nlink); 273 272 mutex_unlock(&f->sem); 274 273 d_instantiate(dentry, d_inode(old_dentry)); 275 - dir_i->i_mtime = dir_i->i_ctime = ITIME(now); 274 + dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, ITIME(now)); 276 275 ihold(d_inode(old_dentry)); 277 276 } 278 277 return ret; ··· 423 422 goto fail; 424 423 } 425 424 426 - dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); 425 + dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, 426 + ITIME(je32_to_cpu(rd->mctime))); 427 427 428 428 jffs2_free_raw_dirent(rd); 429 429 ··· 568 566 goto fail; 569 567 } 570 568 571 - dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); 569 + dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, 570 + ITIME(je32_to_cpu(rd->mctime))); 572 571 inc_nlink(dir_i); 573 572 574 573 jffs2_free_raw_dirent(rd); ··· 610 607 ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, 611 608 dentry->d_name.len, f, now); 612 609 if (!ret) { 613 - dir_i->i_mtime = dir_i->i_ctime = ITIME(now); 610 + dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, ITIME(now)); 614 611 clear_nlink(d_inode(dentry)); 615 612 drop_nlink(dir_i); 616 613 } ··· 746 743 goto fail; 747 744 } 748 745 749 - dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); 746 + dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, 747 + ITIME(je32_to_cpu(rd->mctime))); 750 748 751 749 jffs2_free_raw_dirent(rd); 752 750 ··· 868 864 * caller won't do it on its own since we are returning an error. 869 865 */ 870 866 d_invalidate(new_dentry); 871 - new_dir_i->i_mtime = new_dir_i->i_ctime = ITIME(now); 867 + new_dir_i->i_mtime = inode_set_ctime_to_ts(new_dir_i, 868 + ITIME(now)); 872 869 return ret; 873 870 } 874 871 875 872 if (d_is_dir(old_dentry)) 876 873 drop_nlink(old_dir_i); 877 874 878 - new_dir_i->i_mtime = new_dir_i->i_ctime = old_dir_i->i_mtime = old_dir_i->i_ctime = ITIME(now); 875 + old_dir_i->i_mtime = inode_set_ctime_to_ts(old_dir_i, ITIME(now)); 876 + new_dir_i->i_mtime = inode_set_ctime_to_ts(new_dir_i, ITIME(now)); 879 877 880 878 return 0; 881 879 }
+2 -1
fs/jffs2/file.c
··· 317 317 inode->i_size = pos + writtenlen; 318 318 inode->i_blocks = (inode->i_size + 511) >> 9; 319 319 320 - inode->i_ctime = inode->i_mtime = ITIME(je32_to_cpu(ri->ctime)); 320 + inode->i_mtime = inode_set_ctime_to_ts(inode, 321 + ITIME(je32_to_cpu(ri->ctime))); 321 322 } 322 323 } 323 324
+5 -5
fs/jffs2/fs.c
··· 115 115 ri->isize = cpu_to_je32((ivalid & ATTR_SIZE)?iattr->ia_size:inode->i_size); 116 116 ri->atime = cpu_to_je32(I_SEC((ivalid & ATTR_ATIME)?iattr->ia_atime:inode->i_atime)); 117 117 ri->mtime = cpu_to_je32(I_SEC((ivalid & ATTR_MTIME)?iattr->ia_mtime:inode->i_mtime)); 118 - ri->ctime = cpu_to_je32(I_SEC((ivalid & ATTR_CTIME)?iattr->ia_ctime:inode->i_ctime)); 118 + ri->ctime = cpu_to_je32(I_SEC((ivalid & ATTR_CTIME)?iattr->ia_ctime:inode_get_ctime(inode))); 119 119 120 120 ri->offset = cpu_to_je32(0); 121 121 ri->csize = ri->dsize = cpu_to_je32(mdatalen); ··· 148 148 } 149 149 /* It worked. Update the inode */ 150 150 inode->i_atime = ITIME(je32_to_cpu(ri->atime)); 151 - inode->i_ctime = ITIME(je32_to_cpu(ri->ctime)); 151 + inode_set_ctime_to_ts(inode, ITIME(je32_to_cpu(ri->ctime))); 152 152 inode->i_mtime = ITIME(je32_to_cpu(ri->mtime)); 153 153 inode->i_mode = jemode_to_cpu(ri->mode); 154 154 i_uid_write(inode, je16_to_cpu(ri->uid)); ··· 284 284 inode->i_size = je32_to_cpu(latest_node.isize); 285 285 inode->i_atime = ITIME(je32_to_cpu(latest_node.atime)); 286 286 inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime)); 287 - inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime)); 287 + inode_set_ctime_to_ts(inode, ITIME(je32_to_cpu(latest_node.ctime))); 288 288 289 289 set_nlink(inode, f->inocache->pino_nlink); 290 290 ··· 388 388 iattr.ia_gid = inode->i_gid; 389 389 iattr.ia_atime = inode->i_atime; 390 390 iattr.ia_mtime = inode->i_mtime; 391 - iattr.ia_ctime = inode->i_ctime; 391 + iattr.ia_ctime = inode_get_ctime(inode); 392 392 393 393 jffs2_do_setattr(inode, &iattr); 394 394 } ··· 475 475 inode->i_mode = jemode_to_cpu(ri->mode); 476 476 i_gid_write(inode, je16_to_cpu(ri->gid)); 477 477 i_uid_write(inode, je16_to_cpu(ri->uid)); 478 - inode->i_atime = inode->i_ctime = inode->i_mtime = current_time(inode); 478 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 479 479 ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime)); 480 480 481 481 inode->i_blocks = 0;
+1 -1
fs/jffs2/os-linux.h
··· 35 35 #define ITIME(sec) ((struct timespec64){sec, 0}) 36 36 #define JFFS2_NOW() JFFS2_CLAMP_TIME(ktime_get_real_seconds()) 37 37 #define I_SEC(tv) JFFS2_CLAMP_TIME((tv).tv_sec) 38 - #define JFFS2_F_I_CTIME(f) I_SEC(OFNI_EDONI_2SFFJ(f)->i_ctime) 38 + #define JFFS2_F_I_CTIME(f) I_SEC(inode_get_ctime(OFNI_EDONI_2SFFJ(f))) 39 39 #define JFFS2_F_I_MTIME(f) I_SEC(OFNI_EDONI_2SFFJ(f)->i_mtime) 40 40 #define JFFS2_F_I_ATIME(f) I_SEC(OFNI_EDONI_2SFFJ(f)->i_atime) 41 41 #define sleep_on_spinunlock(wq, s) \
+1 -1
fs/jfs/acl.c
··· 116 116 if (!rc) { 117 117 if (update_mode) { 118 118 inode->i_mode = mode; 119 - inode->i_ctime = current_time(inode); 119 + inode_set_ctime_current(inode); 120 120 mark_inode_dirty(inode); 121 121 } 122 122 rc = txCommit(tid, 1, &inode, 0);
+1 -1
fs/jfs/inode.c
··· 393 393 break; 394 394 } 395 395 396 - ip->i_mtime = ip->i_ctime = current_time(ip); 396 + ip->i_mtime = inode_set_ctime_current(ip); 397 397 mark_inode_dirty(ip); 398 398 399 399 txCommit(tid, 1, &ip, 0);
+1 -1
fs/jfs/ioctl.c
··· 96 96 jfs_inode->mode2 = flags; 97 97 98 98 jfs_set_inode_flags(inode); 99 - inode->i_ctime = current_time(inode); 99 + inode_set_ctime_current(inode); 100 100 mark_inode_dirty(inode); 101 101 102 102 return 0;
+4 -4
fs/jfs/jfs_imap.c
··· 3064 3064 ip->i_atime.tv_nsec = le32_to_cpu(dip->di_atime.tv_nsec); 3065 3065 ip->i_mtime.tv_sec = le32_to_cpu(dip->di_mtime.tv_sec); 3066 3066 ip->i_mtime.tv_nsec = le32_to_cpu(dip->di_mtime.tv_nsec); 3067 - ip->i_ctime.tv_sec = le32_to_cpu(dip->di_ctime.tv_sec); 3068 - ip->i_ctime.tv_nsec = le32_to_cpu(dip->di_ctime.tv_nsec); 3067 + inode_set_ctime(ip, le32_to_cpu(dip->di_ctime.tv_sec), 3068 + le32_to_cpu(dip->di_ctime.tv_nsec)); 3069 3069 ip->i_blocks = LBLK2PBLK(ip->i_sb, le64_to_cpu(dip->di_nblocks)); 3070 3070 ip->i_generation = le32_to_cpu(dip->di_gen); 3071 3071 ··· 3139 3139 3140 3140 dip->di_atime.tv_sec = cpu_to_le32(ip->i_atime.tv_sec); 3141 3141 dip->di_atime.tv_nsec = cpu_to_le32(ip->i_atime.tv_nsec); 3142 - dip->di_ctime.tv_sec = cpu_to_le32(ip->i_ctime.tv_sec); 3143 - dip->di_ctime.tv_nsec = cpu_to_le32(ip->i_ctime.tv_nsec); 3142 + dip->di_ctime.tv_sec = cpu_to_le32(inode_get_ctime(ip).tv_sec); 3143 + dip->di_ctime.tv_nsec = cpu_to_le32(inode_get_ctime(ip).tv_nsec); 3144 3144 dip->di_mtime.tv_sec = cpu_to_le32(ip->i_mtime.tv_sec); 3145 3145 dip->di_mtime.tv_nsec = cpu_to_le32(ip->i_mtime.tv_nsec); 3146 3146 dip->di_ixpxd = jfs_ip->ixpxd; /* in-memory pxd's are little-endian */
+2 -2
fs/jfs/jfs_inode.c
··· 97 97 jfs_inode->mode2 |= inode->i_mode; 98 98 99 99 inode->i_blocks = 0; 100 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 101 - jfs_inode->otime = inode->i_ctime.tv_sec; 100 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 101 + jfs_inode->otime = inode_get_ctime(inode).tv_sec; 102 102 inode->i_generation = JFS_SBI(sb)->gengen++; 103 103 104 104 jfs_inode->cflag = 0;
+12 -12
fs/jfs/namei.c
··· 149 149 150 150 mark_inode_dirty(ip); 151 151 152 - dip->i_ctime = dip->i_mtime = current_time(dip); 152 + dip->i_mtime = inode_set_ctime_current(dip); 153 153 154 154 mark_inode_dirty(dip); 155 155 ··· 284 284 285 285 /* update parent directory inode */ 286 286 inc_nlink(dip); /* for '..' from child directory */ 287 - dip->i_ctime = dip->i_mtime = current_time(dip); 287 + dip->i_mtime = inode_set_ctime_current(dip); 288 288 mark_inode_dirty(dip); 289 289 290 290 rc = txCommit(tid, 2, &iplist[0], 0); ··· 390 390 /* update parent directory's link count corresponding 391 391 * to ".." entry of the target directory deleted 392 392 */ 393 - dip->i_ctime = dip->i_mtime = current_time(dip); 393 + dip->i_mtime = inode_set_ctime_current(dip); 394 394 inode_dec_link_count(dip); 395 395 396 396 /* ··· 512 512 513 513 ASSERT(ip->i_nlink); 514 514 515 - ip->i_ctime = dip->i_ctime = dip->i_mtime = current_time(ip); 515 + dip->i_mtime = inode_set_ctime_to_ts(dip, inode_set_ctime_current(ip)); 516 516 mark_inode_dirty(dip); 517 517 518 518 /* update target's inode */ ··· 827 827 828 828 /* update object inode */ 829 829 inc_nlink(ip); /* for new link */ 830 - ip->i_ctime = current_time(ip); 831 - dir->i_ctime = dir->i_mtime = current_time(dir); 830 + inode_set_ctime_current(ip); 831 + dir->i_mtime = inode_set_ctime_current(dir); 832 832 mark_inode_dirty(dir); 833 833 ihold(ip); 834 834 ··· 1028 1028 1029 1029 mark_inode_dirty(ip); 1030 1030 1031 - dip->i_ctime = dip->i_mtime = current_time(dip); 1031 + dip->i_mtime = inode_set_ctime_current(dip); 1032 1032 mark_inode_dirty(dip); 1033 1033 /* 1034 1034 * commit update of parent directory and link object ··· 1205 1205 tblk->xflag |= COMMIT_DELETE; 1206 1206 tblk->u.ip = new_ip; 1207 1207 } else { 1208 - new_ip->i_ctime = current_time(new_ip); 1208 + inode_set_ctime_current(new_ip); 1209 1209 mark_inode_dirty(new_ip); 1210 1210 } 1211 1211 } else { ··· 1268 1268 /* 1269 1269 * Update ctime on changed/moved inodes & mark dirty 1270 1270 */ 1271 - old_ip->i_ctime = current_time(old_ip); 1271 + inode_set_ctime_current(old_ip); 1272 1272 mark_inode_dirty(old_ip); 1273 1273 1274 - new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir); 1274 + new_dir->i_mtime = inode_set_ctime_current(new_dir); 1275 1275 mark_inode_dirty(new_dir); 1276 1276 1277 1277 /* Build list of inodes modified by this transaction */ ··· 1283 1283 1284 1284 if (old_dir != new_dir) { 1285 1285 iplist[ipcount++] = new_dir; 1286 - old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); 1286 + old_dir->i_mtime = inode_set_ctime_current(old_dir); 1287 1287 mark_inode_dirty(old_dir); 1288 1288 } 1289 1289 ··· 1416 1416 1417 1417 mark_inode_dirty(ip); 1418 1418 1419 - dir->i_ctime = dir->i_mtime = current_time(dir); 1419 + dir->i_mtime = inode_set_ctime_current(dir); 1420 1420 1421 1421 mark_inode_dirty(dir); 1422 1422
+1 -1
fs/jfs/super.c
··· 818 818 } 819 819 if (inode->i_size < off+len-towrite) 820 820 i_size_write(inode, off+len-towrite); 821 - inode->i_mtime = inode->i_ctime = current_time(inode); 821 + inode->i_mtime = inode_set_ctime_current(inode); 822 822 mark_inode_dirty(inode); 823 823 inode_unlock(inode); 824 824 return len - towrite;
+1 -1
fs/jfs/xattr.c
··· 647 647 if (old_blocks) 648 648 dquot_free_block(inode, old_blocks); 649 649 650 - inode->i_ctime = current_time(inode); 650 + inode_set_ctime_current(inode); 651 651 652 652 return 0; 653 653 }
+3 -4
fs/kernfs/inode.c
··· 151 151 static inline void set_default_inode_attr(struct inode *inode, umode_t mode) 152 152 { 153 153 inode->i_mode = mode; 154 - inode->i_atime = inode->i_mtime = 155 - inode->i_ctime = current_time(inode); 154 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 156 155 } 157 156 158 157 static inline void set_inode_attr(struct inode *inode, ··· 161 162 inode->i_gid = attrs->ia_gid; 162 163 inode->i_atime = attrs->ia_atime; 163 164 inode->i_mtime = attrs->ia_mtime; 164 - inode->i_ctime = attrs->ia_ctime; 165 + inode_set_ctime_to_ts(inode, attrs->ia_ctime); 165 166 } 166 167 167 168 static void kernfs_refresh_inode(struct kernfs_node *kn, struct inode *inode) ··· 190 191 191 192 down_read(&root->kernfs_iattr_rwsem); 192 193 kernfs_refresh_inode(kn, inode); 193 - generic_fillattr(&nop_mnt_idmap, inode, stat); 194 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 194 195 up_read(&root->kernfs_iattr_rwsem); 195 196 196 197 return 0;
+39 -20
fs/libfs.c
··· 33 33 unsigned int query_flags) 34 34 { 35 35 struct inode *inode = d_inode(path->dentry); 36 - generic_fillattr(&nop_mnt_idmap, inode, stat); 36 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 37 37 stat->blocks = inode->i_mapping->nrpages << (PAGE_SHIFT - 9); 38 38 return 0; 39 39 } ··· 275 275 while ((child = find_next_child(this, victim)) == NULL) { 276 276 // kill and ascend 277 277 // update metadata while it's still locked 278 - inode->i_ctime = current_time(inode); 278 + inode_set_ctime_current(inode); 279 279 clear_nlink(inode); 280 280 inode_unlock(inode); 281 281 victim = this; ··· 293 293 dput(victim); // unpin it 294 294 } 295 295 if (victim == dentry) { 296 - inode->i_ctime = inode->i_mtime = 297 - current_time(inode); 296 + inode->i_mtime = inode_set_ctime_current(inode); 298 297 if (d_is_dir(dentry)) 299 298 drop_nlink(inode); 300 299 inode_unlock(inode); ··· 334 335 */ 335 336 root->i_ino = 1; 336 337 root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; 337 - root->i_atime = root->i_mtime = root->i_ctime = current_time(root); 338 + root->i_atime = root->i_mtime = inode_set_ctime_current(root); 338 339 s->s_root = d_make_root(root); 339 340 if (!s->s_root) 340 341 return -ENOMEM; ··· 390 391 { 391 392 struct inode *inode = d_inode(old_dentry); 392 393 393 - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); 394 + dir->i_mtime = inode_set_ctime_to_ts(dir, 395 + inode_set_ctime_current(inode)); 394 396 inc_nlink(inode); 395 397 ihold(inode); 396 398 dget(dentry); ··· 425 425 { 426 426 struct inode *inode = d_inode(dentry); 427 427 428 - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); 428 + dir->i_mtime = inode_set_ctime_to_ts(dir, 429 + inode_set_ctime_current(inode)); 429 430 drop_nlink(inode); 430 431 dput(dentry); 431 432 return 0; ··· 445 444 } 446 445 EXPORT_SYMBOL(simple_rmdir); 447 446 447 + /** 448 + * simple_rename_timestamp - update the various inode timestamps for rename 449 + * @old_dir: old parent directory 450 + * @old_dentry: dentry that is being renamed 451 + * @new_dir: new parent directory 452 + * @new_dentry: target for rename 453 + * 454 + * POSIX mandates that the old and new parent directories have their ctime and 455 + * mtime updated, and that inodes of @old_dentry and @new_dentry (if any), have 456 + * their ctime updated. 457 + */ 458 + void simple_rename_timestamp(struct inode *old_dir, struct dentry *old_dentry, 459 + struct inode *new_dir, struct dentry *new_dentry) 460 + { 461 + struct inode *newino = d_inode(new_dentry); 462 + 463 + old_dir->i_mtime = inode_set_ctime_current(old_dir); 464 + if (new_dir != old_dir) 465 + new_dir->i_mtime = inode_set_ctime_current(new_dir); 466 + inode_set_ctime_current(d_inode(old_dentry)); 467 + if (newino) 468 + inode_set_ctime_current(newino); 469 + } 470 + EXPORT_SYMBOL_GPL(simple_rename_timestamp); 471 + 448 472 int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry, 449 473 struct inode *new_dir, struct dentry *new_dentry) 450 474 { ··· 485 459 inc_nlink(old_dir); 486 460 } 487 461 } 488 - old_dir->i_ctime = old_dir->i_mtime = 489 - new_dir->i_ctime = new_dir->i_mtime = 490 - d_inode(old_dentry)->i_ctime = 491 - d_inode(new_dentry)->i_ctime = current_time(old_dir); 492 - 462 + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); 493 463 return 0; 494 464 } 495 465 EXPORT_SYMBOL_GPL(simple_rename_exchange); ··· 494 472 struct dentry *old_dentry, struct inode *new_dir, 495 473 struct dentry *new_dentry, unsigned int flags) 496 474 { 497 - struct inode *inode = d_inode(old_dentry); 498 475 int they_are_dirs = d_is_dir(old_dentry); 499 476 500 477 if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) ··· 516 495 inc_nlink(new_dir); 517 496 } 518 497 519 - old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = 520 - new_dir->i_mtime = inode->i_ctime = current_time(old_dir); 521 - 498 + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); 522 499 return 0; 523 500 } 524 501 EXPORT_SYMBOL(simple_rename); ··· 678 659 */ 679 660 inode->i_ino = 1; 680 661 inode->i_mode = S_IFDIR | 0755; 681 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 662 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 682 663 inode->i_op = &simple_dir_inode_operations; 683 664 inode->i_fop = &simple_dir_operations; 684 665 set_nlink(inode, 2); ··· 704 685 goto out; 705 686 } 706 687 inode->i_mode = S_IFREG | files->mode; 707 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 688 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 708 689 inode->i_fop = files->ops; 709 690 inode->i_ino = i; 710 691 d_add(dentry, inode); ··· 1272 1253 inode->i_uid = current_fsuid(); 1273 1254 inode->i_gid = current_fsgid(); 1274 1255 inode->i_flags |= S_PRIVATE; 1275 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 1256 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 1276 1257 return inode; 1277 1258 } 1278 1259 EXPORT_SYMBOL(alloc_anon_inode); ··· 1334 1315 u32 request_mask, unsigned int query_flags) 1335 1316 { 1336 1317 struct inode *inode = d_inode(path->dentry); 1337 - generic_fillattr(&nop_mnt_idmap, inode, stat); 1318 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 1338 1319 return 0; 1339 1320 } 1340 1321
+1 -1
fs/minix/bitmap.c
··· 251 251 } 252 252 inode_init_owner(&nop_mnt_idmap, inode, dir, mode); 253 253 inode->i_ino = j; 254 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 254 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 255 255 inode->i_blocks = 0; 256 256 memset(&minix_i(inode)->u, 0, sizeof(minix_i(inode)->u)); 257 257 insert_inode_hash(inode);
+3 -3
fs/minix/dir.c
··· 281 281 de->inode = inode->i_ino; 282 282 } 283 283 dir_commit_chunk(page, pos, sbi->s_dirsize); 284 - dir->i_mtime = dir->i_ctime = current_time(dir); 284 + dir->i_mtime = inode_set_ctime_current(dir); 285 285 mark_inode_dirty(dir); 286 286 err = minix_handle_dirsync(dir); 287 287 out_put: ··· 313 313 else 314 314 de->inode = 0; 315 315 dir_commit_chunk(page, pos, len); 316 - inode->i_ctime = inode->i_mtime = current_time(inode); 316 + inode->i_mtime = inode_set_ctime_current(inode); 317 317 mark_inode_dirty(inode); 318 318 return minix_handle_dirsync(inode); 319 319 } ··· 436 436 else 437 437 de->inode = inode->i_ino; 438 438 dir_commit_chunk(page, pos, sbi->s_dirsize); 439 - dir->i_mtime = dir->i_ctime = current_time(dir); 439 + dir->i_mtime = inode_set_ctime_current(dir); 440 440 mark_inode_dirty(dir); 441 441 return minix_handle_dirsync(dir); 442 442 }
+4 -8
fs/minix/inode.c
··· 501 501 i_gid_write(inode, raw_inode->i_gid); 502 502 set_nlink(inode, raw_inode->i_nlinks); 503 503 inode->i_size = raw_inode->i_size; 504 - inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec = raw_inode->i_time; 505 - inode->i_mtime.tv_nsec = 0; 506 - inode->i_atime.tv_nsec = 0; 507 - inode->i_ctime.tv_nsec = 0; 504 + inode->i_mtime = inode->i_atime = inode_set_ctime(inode, raw_inode->i_time, 0); 508 505 inode->i_blocks = 0; 509 506 for (i = 0; i < 9; i++) 510 507 minix_inode->u.i1_data[i] = raw_inode->i_zone[i]; ··· 540 543 inode->i_size = raw_inode->i_size; 541 544 inode->i_mtime.tv_sec = raw_inode->i_mtime; 542 545 inode->i_atime.tv_sec = raw_inode->i_atime; 543 - inode->i_ctime.tv_sec = raw_inode->i_ctime; 546 + inode_set_ctime(inode, raw_inode->i_ctime, 0); 544 547 inode->i_mtime.tv_nsec = 0; 545 548 inode->i_atime.tv_nsec = 0; 546 - inode->i_ctime.tv_nsec = 0; 547 549 inode->i_blocks = 0; 548 550 for (i = 0; i < 10; i++) 549 551 minix_inode->u.i2_data[i] = raw_inode->i_zone[i]; ··· 618 622 raw_inode->i_size = inode->i_size; 619 623 raw_inode->i_mtime = inode->i_mtime.tv_sec; 620 624 raw_inode->i_atime = inode->i_atime.tv_sec; 621 - raw_inode->i_ctime = inode->i_ctime.tv_sec; 625 + raw_inode->i_ctime = inode_get_ctime(inode).tv_sec; 622 626 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) 623 627 raw_inode->i_zone[0] = old_encode_dev(inode->i_rdev); 624 628 else for (i = 0; i < 10; i++) ··· 656 660 struct super_block *sb = path->dentry->d_sb; 657 661 struct inode *inode = d_inode(path->dentry); 658 662 659 - generic_fillattr(&nop_mnt_idmap, inode, stat); 663 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 660 664 if (INODE_VERSION(inode) == MINIX_V1) 661 665 stat->blocks = (BLOCK_SIZE / 512) * V1_minix_blocks(stat->size, sb); 662 666 else
+2 -2
fs/minix/itree_common.c
··· 131 131 132 132 /* We are done with atomic stuff, now do the rest of housekeeping */ 133 133 134 - inode->i_ctime = current_time(inode); 134 + inode_set_ctime_current(inode); 135 135 136 136 /* had we spliced it onto indirect block? */ 137 137 if (where->bh) ··· 350 350 } 351 351 first_whole++; 352 352 } 353 - inode->i_mtime = inode->i_ctime = current_time(inode); 353 + inode->i_mtime = inode_set_ctime_current(inode); 354 354 mark_inode_dirty(inode); 355 355 } 356 356
+3 -3
fs/minix/namei.c
··· 98 98 { 99 99 struct inode *inode = d_inode(old_dentry); 100 100 101 - inode->i_ctime = current_time(inode); 101 + inode_set_ctime_current(inode); 102 102 inode_inc_link_count(inode); 103 103 ihold(inode); 104 104 return add_nondir(dentry, inode); ··· 154 154 155 155 if (err) 156 156 return err; 157 - inode->i_ctime = dir->i_ctime; 157 + inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); 158 158 inode_dec_link_count(inode); 159 159 return 0; 160 160 } ··· 218 218 put_page(new_page); 219 219 if (err) 220 220 goto out_dir; 221 - new_inode->i_ctime = current_time(new_inode); 221 + inode_set_ctime_current(new_inode); 222 222 if (dir_de) 223 223 drop_nlink(new_inode); 224 224 inode_dec_link_count(new_inode);
+1 -1
fs/nfs/callback_proc.c
··· 59 59 res->change_attr = delegation->change_attr; 60 60 if (nfs_have_writebacks(inode)) 61 61 res->change_attr++; 62 - res->ctime = inode->i_ctime; 62 + res->ctime = inode_get_ctime(inode); 63 63 res->mtime = inode->i_mtime; 64 64 res->bitmap[0] = (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) & 65 65 args->bitmap[0];
+2 -2
fs/nfs/fscache.h
··· 116 116 memset(auxdata, 0, sizeof(*auxdata)); 117 117 auxdata->mtime_sec = inode->i_mtime.tv_sec; 118 118 auxdata->mtime_nsec = inode->i_mtime.tv_nsec; 119 - auxdata->ctime_sec = inode->i_ctime.tv_sec; 120 - auxdata->ctime_nsec = inode->i_ctime.tv_nsec; 119 + auxdata->ctime_sec = inode_get_ctime(inode).tv_sec; 120 + auxdata->ctime_nsec = inode_get_ctime(inode).tv_nsec; 121 121 122 122 if (NFS_SERVER(inode)->nfs_client->rpc_ops->version == 4) 123 123 auxdata->change_attr = inode_peek_iversion_raw(inode);
+11 -11
fs/nfs/inode.c
··· 514 514 515 515 memset(&inode->i_atime, 0, sizeof(inode->i_atime)); 516 516 memset(&inode->i_mtime, 0, sizeof(inode->i_mtime)); 517 - memset(&inode->i_ctime, 0, sizeof(inode->i_ctime)); 517 + inode_set_ctime(inode, 0, 0); 518 518 inode_set_iversion_raw(inode, 0); 519 519 inode->i_size = 0; 520 520 clear_nlink(inode); ··· 535 535 else if (fattr_supported & NFS_ATTR_FATTR_MTIME) 536 536 nfs_set_cache_invalid(inode, NFS_INO_INVALID_MTIME); 537 537 if (fattr->valid & NFS_ATTR_FATTR_CTIME) 538 - inode->i_ctime = fattr->ctime; 538 + inode_set_ctime_to_ts(inode, fattr->ctime); 539 539 else if (fattr_supported & NFS_ATTR_FATTR_CTIME) 540 540 nfs_set_cache_invalid(inode, NFS_INO_INVALID_CTIME); 541 541 if (fattr->valid & NFS_ATTR_FATTR_CHANGE) ··· 731 731 if ((attr->ia_valid & ATTR_GID) != 0) 732 732 inode->i_gid = attr->ia_gid; 733 733 if (fattr->valid & NFS_ATTR_FATTR_CTIME) 734 - inode->i_ctime = fattr->ctime; 734 + inode_set_ctime_to_ts(inode, fattr->ctime); 735 735 else 736 736 nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE 737 737 | NFS_INO_INVALID_CTIME); ··· 749 749 nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATIME); 750 750 751 751 if (fattr->valid & NFS_ATTR_FATTR_CTIME) 752 - inode->i_ctime = fattr->ctime; 752 + inode_set_ctime_to_ts(inode, fattr->ctime); 753 753 else 754 754 nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE 755 755 | NFS_INO_INVALID_CTIME); ··· 765 765 nfs_set_cache_invalid(inode, NFS_INO_INVALID_MTIME); 766 766 767 767 if (fattr->valid & NFS_ATTR_FATTR_CTIME) 768 - inode->i_ctime = fattr->ctime; 768 + inode_set_ctime_to_ts(inode, fattr->ctime); 769 769 else 770 770 nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE 771 771 | NFS_INO_INVALID_CTIME); ··· 912 912 /* Only return attributes that were revalidated. */ 913 913 stat->result_mask = nfs_get_valid_attrmask(inode) | request_mask; 914 914 915 - generic_fillattr(&nop_mnt_idmap, inode, stat); 915 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 916 916 stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); 917 917 stat->change_cookie = inode_peek_iversion_raw(inode); 918 918 stat->attributes_mask |= STATX_ATTR_CHANGE_MONOTONIC; ··· 1444 1444 nfs_set_cache_invalid(inode, NFS_INO_INVALID_XATTR); 1445 1445 } 1446 1446 /* If we have atomic WCC data, we may update some attributes */ 1447 - ts = inode->i_ctime; 1447 + ts = inode_get_ctime(inode); 1448 1448 if ((fattr->valid & NFS_ATTR_FATTR_PRECTIME) 1449 1449 && (fattr->valid & NFS_ATTR_FATTR_CTIME) 1450 1450 && timespec64_equal(&ts, &fattr->pre_ctime)) { 1451 - inode->i_ctime = fattr->ctime; 1451 + inode_set_ctime_to_ts(inode, fattr->ctime); 1452 1452 } 1453 1453 1454 1454 ts = inode->i_mtime; ··· 1510 1510 if ((fattr->valid & NFS_ATTR_FATTR_MTIME) && !timespec64_equal(&ts, &fattr->mtime)) 1511 1511 invalid |= NFS_INO_INVALID_MTIME; 1512 1512 1513 - ts = inode->i_ctime; 1513 + ts = inode_get_ctime(inode); 1514 1514 if ((fattr->valid & NFS_ATTR_FATTR_CTIME) && !timespec64_equal(&ts, &fattr->ctime)) 1515 1515 invalid |= NFS_INO_INVALID_CTIME; 1516 1516 ··· 1997 1997 } 1998 1998 if ((fattr->valid & NFS_ATTR_FATTR_CTIME) != 0 && 1999 1999 (fattr->valid & NFS_ATTR_FATTR_PRECTIME) == 0) { 2000 - fattr->pre_ctime = inode->i_ctime; 2000 + fattr->pre_ctime = inode_get_ctime(inode); 2001 2001 fattr->valid |= NFS_ATTR_FATTR_PRECTIME; 2002 2002 } 2003 2003 if ((fattr->valid & NFS_ATTR_FATTR_MTIME) != 0 && ··· 2190 2190 save_cache_validity & NFS_INO_INVALID_MTIME; 2191 2191 2192 2192 if (fattr->valid & NFS_ATTR_FATTR_CTIME) 2193 - inode->i_ctime = fattr->ctime; 2193 + inode_set_ctime_to_ts(inode, fattr->ctime); 2194 2194 else if (fattr_supported & NFS_ATTR_FATTR_CTIME) 2195 2195 nfsi->cache_validity |= 2196 2196 save_cache_validity & NFS_INO_INVALID_CTIME;
+2 -1
fs/nfs/namespace.c
··· 215 215 if (NFS_FH(d_inode(path->dentry))->size != 0) 216 216 return nfs_getattr(idmap, path, stat, request_mask, 217 217 query_flags); 218 - generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat); 218 + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(path->dentry), 219 + stat); 219 220 return 0; 220 221 } 221 222
+1 -1
fs/nfsd/nfsctl.c
··· 1132 1132 /* Following advice from simple_fill_super documentation: */ 1133 1133 inode->i_ino = iunique(sb, NFSD_MaxReserved); 1134 1134 inode->i_mode = mode; 1135 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 1135 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 1136 1136 switch (mode & S_IFMT) { 1137 1137 case S_IFDIR: 1138 1138 inode->i_fop = &simple_dir_operations;
+1 -1
fs/nfsd/vfs.c
··· 520 520 521 521 nfsd_sanitize_attrs(inode, iap); 522 522 523 - if (check_guard && guardtime != inode->i_ctime.tv_sec) 523 + if (check_guard && guardtime != inode_get_ctime(inode).tv_sec) 524 524 return nfserr_notsync; 525 525 526 526 /*
+3 -3
fs/nilfs2/dir.c
··· 429 429 nilfs_set_de_type(de, inode); 430 430 nilfs_commit_chunk(page, mapping, from, to); 431 431 nilfs_put_page(page); 432 - dir->i_mtime = dir->i_ctime = current_time(dir); 432 + dir->i_mtime = inode_set_ctime_current(dir); 433 433 } 434 434 435 435 /* ··· 519 519 de->inode = cpu_to_le64(inode->i_ino); 520 520 nilfs_set_de_type(de, inode); 521 521 nilfs_commit_chunk(page, page->mapping, from, to); 522 - dir->i_mtime = dir->i_ctime = current_time(dir); 522 + dir->i_mtime = inode_set_ctime_current(dir); 523 523 nilfs_mark_inode_dirty(dir); 524 524 /* OFFSET_CACHE */ 525 525 out_put: ··· 567 567 pde->rec_len = nilfs_rec_len_to_disk(to - from); 568 568 dir->inode = 0; 569 569 nilfs_commit_chunk(page, mapping, from, to); 570 - inode->i_ctime = inode->i_mtime = current_time(inode); 570 + inode->i_mtime = inode_set_ctime_current(inode); 571 571 out: 572 572 nilfs_put_page(page); 573 573 return err;
+6 -6
fs/nilfs2/inode.c
··· 366 366 atomic64_inc(&root->inodes_count); 367 367 inode_init_owner(&nop_mnt_idmap, inode, dir, mode); 368 368 inode->i_ino = ino; 369 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 369 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 370 370 371 371 if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) { 372 372 err = nilfs_bmap_read(ii->i_bmap, NULL); ··· 450 450 set_nlink(inode, le16_to_cpu(raw_inode->i_links_count)); 451 451 inode->i_size = le64_to_cpu(raw_inode->i_size); 452 452 inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime); 453 - inode->i_ctime.tv_sec = le64_to_cpu(raw_inode->i_ctime); 453 + inode_set_ctime(inode, le64_to_cpu(raw_inode->i_ctime), 454 + le32_to_cpu(raw_inode->i_ctime_nsec)); 454 455 inode->i_mtime.tv_sec = le64_to_cpu(raw_inode->i_mtime); 455 456 inode->i_atime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec); 456 - inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec); 457 457 inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec); 458 458 if (nilfs_is_metadata_file_inode(inode) && !S_ISREG(inode->i_mode)) 459 459 return -EIO; /* this inode is for metadata and corrupted */ ··· 768 768 raw_inode->i_gid = cpu_to_le32(i_gid_read(inode)); 769 769 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); 770 770 raw_inode->i_size = cpu_to_le64(inode->i_size); 771 - raw_inode->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 771 + raw_inode->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec); 772 772 raw_inode->i_mtime = cpu_to_le64(inode->i_mtime.tv_sec); 773 - raw_inode->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 773 + raw_inode->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 774 774 raw_inode->i_mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); 775 775 raw_inode->i_blocks = cpu_to_le64(inode->i_blocks); 776 776 ··· 875 875 876 876 nilfs_truncate_bmap(ii, blkoff); 877 877 878 - inode->i_mtime = inode->i_ctime = current_time(inode); 878 + inode->i_mtime = inode_set_ctime_current(inode); 879 879 if (IS_SYNC(inode)) 880 880 nilfs_set_transaction_flag(NILFS_TI_SYNC); 881 881
+1 -1
fs/nilfs2/ioctl.c
··· 149 149 NILFS_I(inode)->i_flags = oldflags | (flags & FS_FL_USER_MODIFIABLE); 150 150 151 151 nilfs_set_inode_flags(inode); 152 - inode->i_ctime = current_time(inode); 152 + inode_set_ctime_current(inode); 153 153 if (IS_SYNC(inode)) 154 154 nilfs_set_transaction_flag(NILFS_TI_SYNC); 155 155
+4 -4
fs/nilfs2/namei.c
··· 185 185 if (err) 186 186 return err; 187 187 188 - inode->i_ctime = current_time(inode); 188 + inode_set_ctime_current(inode); 189 189 inode_inc_link_count(inode); 190 190 ihold(inode); 191 191 ··· 283 283 if (err) 284 284 goto out; 285 285 286 - inode->i_ctime = dir->i_ctime; 286 + inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); 287 287 drop_nlink(inode); 288 288 err = 0; 289 289 out: ··· 387 387 goto out_dir; 388 388 nilfs_set_link(new_dir, new_de, new_page, old_inode); 389 389 nilfs_mark_inode_dirty(new_dir); 390 - new_inode->i_ctime = current_time(new_inode); 390 + inode_set_ctime_current(new_inode); 391 391 if (dir_de) 392 392 drop_nlink(new_inode); 393 393 drop_nlink(new_inode); ··· 406 406 * Like most other Unix systems, set the ctime for inodes on a 407 407 * rename. 408 408 */ 409 - old_inode->i_ctime = current_time(old_inode); 409 + inode_set_ctime_current(old_inode); 410 410 411 411 nilfs_delete_entry(old_de, old_page); 412 412
+1 -1
fs/nsfs.c
··· 84 84 return -ENOMEM; 85 85 } 86 86 inode->i_ino = ns->inum; 87 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 87 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 88 88 inode->i_flags |= S_IMMUTABLE; 89 89 inode->i_mode = S_IFREG | S_IRUGO; 90 90 inode->i_fop = &ns_file_operations;
+8 -7
fs/ntfs/inode.c
··· 654 654 * always changes, when mtime is changed. ctime can be changed on its 655 655 * own, mtime is then not changed, e.g. when a file is renamed. 656 656 */ 657 - vi->i_ctime = ntfs2utc(si->last_mft_change_time); 657 + inode_set_ctime_to_ts(vi, ntfs2utc(si->last_mft_change_time)); 658 658 /* 659 659 * Last access to the data within the file. Not changed during a rename 660 660 * for example but changed whenever the file is written to. ··· 1218 1218 vi->i_gid = base_vi->i_gid; 1219 1219 set_nlink(vi, base_vi->i_nlink); 1220 1220 vi->i_mtime = base_vi->i_mtime; 1221 - vi->i_ctime = base_vi->i_ctime; 1221 + inode_set_ctime_to_ts(vi, inode_get_ctime(base_vi)); 1222 1222 vi->i_atime = base_vi->i_atime; 1223 1223 vi->i_generation = ni->seq_no = base_ni->seq_no; 1224 1224 ··· 1484 1484 vi->i_gid = base_vi->i_gid; 1485 1485 set_nlink(vi, base_vi->i_nlink); 1486 1486 vi->i_mtime = base_vi->i_mtime; 1487 - vi->i_ctime = base_vi->i_ctime; 1487 + inode_set_ctime_to_ts(vi, inode_get_ctime(base_vi)); 1488 1488 vi->i_atime = base_vi->i_atime; 1489 1489 vi->i_generation = ni->seq_no = base_ni->seq_no; 1490 1490 /* Set inode type to zero but preserve permissions. */ ··· 2804 2804 */ 2805 2805 if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) { 2806 2806 struct timespec64 now = current_time(VFS_I(base_ni)); 2807 + struct timespec64 ctime = inode_get_ctime(VFS_I(base_ni)); 2807 2808 int sync_it = 0; 2808 2809 2809 2810 if (!timespec64_equal(&VFS_I(base_ni)->i_mtime, &now) || 2810 - !timespec64_equal(&VFS_I(base_ni)->i_ctime, &now)) 2811 + !timespec64_equal(&ctime, &now)) 2811 2812 sync_it = 1; 2813 + inode_set_ctime_to_ts(VFS_I(base_ni), now); 2812 2814 VFS_I(base_ni)->i_mtime = now; 2813 - VFS_I(base_ni)->i_ctime = now; 2814 2815 2815 2816 if (sync_it) 2816 2817 mark_inode_dirty_sync(VFS_I(base_ni)); ··· 2929 2928 if (ia_valid & ATTR_MTIME) 2930 2929 vi->i_mtime = attr->ia_mtime; 2931 2930 if (ia_valid & ATTR_CTIME) 2932 - vi->i_ctime = attr->ia_ctime; 2931 + inode_set_ctime_to_ts(vi, attr->ia_ctime); 2933 2932 mark_inode_dirty(vi); 2934 2933 out: 2935 2934 return err; ··· 3005 3004 si->last_data_change_time = nt; 3006 3005 modified = true; 3007 3006 } 3008 - nt = utc2ntfs(vi->i_ctime); 3007 + nt = utc2ntfs(inode_get_ctime(vi)); 3009 3008 if (si->last_mft_change_time != nt) { 3010 3009 ntfs_debug("Updating ctime for inode 0x%lx: old = 0x%llx, " 3011 3010 "new = 0x%llx", vi->i_ino, (long long)
+1 -2
fs/ntfs/mft.c
··· 2682 2682 vi->i_mode &= ~S_IWUGO; 2683 2683 2684 2684 /* Set the inode times to the current time. */ 2685 - vi->i_atime = vi->i_mtime = vi->i_ctime = 2686 - current_time(vi); 2685 + vi->i_atime = vi->i_mtime = inode_set_ctime_current(vi); 2687 2686 /* 2688 2687 * Set the file size to 0, the ntfs inode sizes are set to 0 by 2689 2688 * the call to ntfs_init_big_inode() below.
+4 -4
fs/ntfs3/file.c
··· 85 85 86 86 stat->attributes_mask |= STATX_ATTR_COMPRESSED | STATX_ATTR_ENCRYPTED; 87 87 88 - generic_fillattr(idmap, inode, stat); 88 + generic_fillattr(idmap, request_mask, inode, stat); 89 89 90 90 stat->result_mask |= STATX_BTIME; 91 91 stat->btime = ni->i_crtime; ··· 342 342 err = 0; 343 343 } 344 344 345 - inode->i_ctime = inode->i_mtime = current_time(inode); 345 + inode->i_mtime = inode_set_ctime_current(inode); 346 346 mark_inode_dirty(inode); 347 347 348 348 if (IS_SYNC(inode)) { ··· 400 400 ni_unlock(ni); 401 401 402 402 ni->std_fa |= FILE_ATTRIBUTE_ARCHIVE; 403 - inode->i_ctime = inode->i_mtime = current_time(inode); 403 + inode->i_mtime = inode_set_ctime_current(inode); 404 404 if (!IS_DIRSYNC(inode)) { 405 405 dirty = 1; 406 406 } else { ··· 642 642 filemap_invalidate_unlock(mapping); 643 643 644 644 if (!err) { 645 - inode->i_ctime = inode->i_mtime = current_time(inode); 645 + inode->i_mtime = inode_set_ctime_current(inode); 646 646 mark_inode_dirty(inode); 647 647 } 648 648
+2 -1
fs/ntfs3/frecord.c
··· 3265 3265 if (is_rec_inuse(ni->mi.mrec) && 3266 3266 !(sbi->flags & NTFS_FLAGS_LOG_REPLAYING) && inode->i_nlink) { 3267 3267 bool modified = false; 3268 + struct timespec64 ctime = inode_get_ctime(inode); 3268 3269 3269 3270 /* Update times in standard attribute. */ 3270 3271 std = ni_std(ni); ··· 3281 3280 modified = true; 3282 3281 } 3283 3282 3284 - dup.c_time = kernel2nt(&inode->i_ctime); 3283 + dup.c_time = kernel2nt(&ctime); 3285 3284 if (std->c_time != dup.c_time) { 3286 3285 std->c_time = dup.c_time; 3287 3286 modified = true;
+8 -6
fs/ntfs3/inode.c
··· 44 44 u64 t64; 45 45 struct MFT_REC *rec; 46 46 struct runs_tree *run; 47 + struct timespec64 ctime; 47 48 48 49 inode->i_op = NULL; 49 50 /* Setup 'uid' and 'gid' */ ··· 170 169 nt2kernel(std5->cr_time, &ni->i_crtime); 171 170 #endif 172 171 nt2kernel(std5->a_time, &inode->i_atime); 173 - nt2kernel(std5->c_time, &inode->i_ctime); 172 + ctime = inode_get_ctime(inode); 173 + nt2kernel(std5->c_time, &ctime); 174 174 nt2kernel(std5->m_time, &inode->i_mtime); 175 175 176 176 ni->std_fa = std5->fa; ··· 960 958 961 959 if (err >= 0) { 962 960 if (!(ni->std_fa & FILE_ATTRIBUTE_ARCHIVE)) { 963 - inode->i_ctime = inode->i_mtime = current_time(inode); 961 + inode->i_mtime = inode_set_ctime_current(inode); 964 962 ni->std_fa |= FILE_ATTRIBUTE_ARCHIVE; 965 963 dirty = true; 966 964 } ··· 1660 1658 d_instantiate(dentry, inode); 1661 1659 1662 1660 /* Set original time. inode times (i_ctime) may be changed in ntfs_init_acl. */ 1663 - inode->i_atime = inode->i_mtime = inode->i_ctime = dir->i_mtime = 1664 - dir->i_ctime = ni->i_crtime; 1661 + inode->i_atime = inode->i_mtime = inode_set_ctime_to_ts(inode, ni->i_crtime); 1662 + dir->i_mtime = inode_set_ctime_to_ts(dir, ni->i_crtime); 1665 1663 1666 1664 mark_inode_dirty(dir); 1667 1665 mark_inode_dirty(inode); ··· 1767 1765 1768 1766 if (!err) { 1769 1767 drop_nlink(inode); 1770 - dir->i_mtime = dir->i_ctime = current_time(dir); 1768 + dir->i_mtime = inode_set_ctime_current(dir); 1771 1769 mark_inode_dirty(dir); 1772 - inode->i_ctime = dir->i_ctime; 1770 + inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); 1773 1771 if (inode->i_nlink) 1774 1772 mark_inode_dirty(inode); 1775 1773 } else if (!ni_remove_name_undo(dir_ni, ni, de, de2, undo_remove)) {
+4 -7
fs/ntfs3/namei.c
··· 156 156 err = ntfs_link_inode(inode, de); 157 157 158 158 if (!err) { 159 - dir->i_ctime = dir->i_mtime = inode->i_ctime = 160 - current_time(dir); 159 + dir->i_mtime = inode_set_ctime_to_ts(inode, 160 + inode_set_ctime_current(dir)); 161 161 mark_inode_dirty(inode); 162 162 mark_inode_dirty(dir); 163 163 d_instantiate(de, inode); ··· 324 324 /* Restore after failed rename failed too. */ 325 325 _ntfs_bad_inode(inode); 326 326 } else if (!err) { 327 - inode->i_ctime = dir->i_ctime = dir->i_mtime = 328 - current_time(dir); 327 + simple_rename_timestamp(dir, dentry, new_dir, new_dentry); 329 328 mark_inode_dirty(inode); 330 329 mark_inode_dirty(dir); 331 - if (dir != new_dir) { 332 - new_dir->i_mtime = new_dir->i_ctime = dir->i_ctime; 330 + if (dir != new_dir) 333 331 mark_inode_dirty(new_dir); 334 - } 335 332 336 333 if (IS_DIRSYNC(dir)) 337 334 ntfs_sync_inode(dir);
+2 -2
fs/ntfs3/xattr.c
··· 637 637 if (!err) { 638 638 set_cached_acl(inode, type, acl); 639 639 inode->i_mode = mode; 640 - inode->i_ctime = current_time(inode); 640 + inode_set_ctime_current(inode); 641 641 mark_inode_dirty(inode); 642 642 } 643 643 ··· 924 924 NULL); 925 925 926 926 out: 927 - inode->i_ctime = current_time(inode); 927 + inode_set_ctime_current(inode); 928 928 mark_inode_dirty(inode); 929 929 930 930 return err;
+3 -3
fs/ocfs2/acl.c
··· 191 191 } 192 192 193 193 inode->i_mode = new_mode; 194 - inode->i_ctime = current_time(inode); 194 + inode_set_ctime_current(inode); 195 195 di->i_mode = cpu_to_le16(inode->i_mode); 196 - di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 197 - di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 196 + di->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec); 197 + di->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 198 198 ocfs2_update_inode_fsync_trans(handle, inode, 0); 199 199 200 200 ocfs2_journal_dirty(handle, di_bh);
+3 -3
fs/ocfs2/alloc.c
··· 7436 7436 } 7437 7437 7438 7438 inode->i_blocks = ocfs2_inode_sector_count(inode); 7439 - inode->i_ctime = inode->i_mtime = current_time(inode); 7439 + inode->i_mtime = inode_set_ctime_current(inode); 7440 7440 7441 - di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); 7442 - di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 7441 + di->i_ctime = di->i_mtime = cpu_to_le64(inode_get_ctime(inode).tv_sec); 7442 + di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 7443 7443 7444 7444 ocfs2_update_inode_fsync_trans(handle, inode, 1); 7445 7445 ocfs2_journal_dirty(handle, di_bh);
+1 -1
fs/ocfs2/aops.c
··· 2048 2048 } 2049 2049 inode->i_blocks = ocfs2_inode_sector_count(inode); 2050 2050 di->i_size = cpu_to_le64((u64)i_size_read(inode)); 2051 - inode->i_mtime = inode->i_ctime = current_time(inode); 2051 + inode->i_mtime = inode_set_ctime_current(inode); 2052 2052 di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec); 2053 2053 di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); 2054 2054 if (handle)
+4 -4
fs/ocfs2/dir.c
··· 1658 1658 offset, ocfs2_dir_trailer_blk_off(dir->i_sb)); 1659 1659 1660 1660 if (ocfs2_dirent_would_fit(de, rec_len)) { 1661 - dir->i_mtime = dir->i_ctime = current_time(dir); 1661 + dir->i_mtime = inode_set_ctime_current(dir); 1662 1662 retval = ocfs2_mark_inode_dirty(handle, dir, parent_fe_bh); 1663 1663 if (retval < 0) { 1664 1664 mlog_errno(retval); ··· 2962 2962 ocfs2_dinode_new_extent_list(dir, di); 2963 2963 2964 2964 i_size_write(dir, sb->s_blocksize); 2965 - dir->i_mtime = dir->i_ctime = current_time(dir); 2965 + dir->i_mtime = inode_set_ctime_current(dir); 2966 2966 2967 2967 di->i_size = cpu_to_le64(sb->s_blocksize); 2968 - di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec); 2969 - di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(dir->i_ctime.tv_nsec); 2968 + di->i_ctime = di->i_mtime = cpu_to_le64(inode_get_ctime(dir).tv_sec); 2969 + di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode_get_ctime(dir).tv_nsec); 2970 2970 ocfs2_update_inode_fsync_trans(handle, dir, 1); 2971 2971 2972 2972 /*
+2 -2
fs/ocfs2/dlmfs/dlmfs.c
··· 337 337 if (inode) { 338 338 inode->i_ino = get_next_ino(); 339 339 inode_init_owner(&nop_mnt_idmap, inode, NULL, mode); 340 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 340 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 341 341 inc_nlink(inode); 342 342 343 343 inode->i_fop = &simple_dir_operations; ··· 360 360 361 361 inode->i_ino = get_next_ino(); 362 362 inode_init_owner(&nop_mnt_idmap, inode, parent, mode); 363 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 363 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 364 364 365 365 ip = DLMFS_I(inode); 366 366 ip->ip_conn = DLMFS_I(parent)->ip_conn;
+5 -2
fs/ocfs2/dlmglue.c
··· 2162 2162 struct ocfs2_inode_info *oi = OCFS2_I(inode); 2163 2163 struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres; 2164 2164 struct ocfs2_meta_lvb *lvb; 2165 + struct timespec64 ctime = inode_get_ctime(inode); 2165 2166 2166 2167 lvb = ocfs2_dlm_lvb(&lockres->l_lksb); 2167 2168 ··· 2186 2185 lvb->lvb_iatime_packed = 2187 2186 cpu_to_be64(ocfs2_pack_timespec(&inode->i_atime)); 2188 2187 lvb->lvb_ictime_packed = 2189 - cpu_to_be64(ocfs2_pack_timespec(&inode->i_ctime)); 2188 + cpu_to_be64(ocfs2_pack_timespec(&ctime)); 2190 2189 lvb->lvb_imtime_packed = 2191 2190 cpu_to_be64(ocfs2_pack_timespec(&inode->i_mtime)); 2192 2191 lvb->lvb_iattr = cpu_to_be32(oi->ip_attr); ··· 2209 2208 struct ocfs2_inode_info *oi = OCFS2_I(inode); 2210 2209 struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres; 2211 2210 struct ocfs2_meta_lvb *lvb; 2211 + struct timespec64 ctime; 2212 2212 2213 2213 mlog_meta_lvb(0, lockres); 2214 2214 ··· 2240 2238 be64_to_cpu(lvb->lvb_iatime_packed)); 2241 2239 ocfs2_unpack_timespec(&inode->i_mtime, 2242 2240 be64_to_cpu(lvb->lvb_imtime_packed)); 2243 - ocfs2_unpack_timespec(&inode->i_ctime, 2241 + ocfs2_unpack_timespec(&ctime, 2244 2242 be64_to_cpu(lvb->lvb_ictime_packed)); 2243 + inode_set_ctime_to_ts(inode, ctime); 2245 2244 spin_unlock(&oi->ip_lock); 2246 2245 return 0; 2247 2246 }
+10 -8
fs/ocfs2/file.c
··· 232 232 return 0; 233 233 234 234 if (vfsmnt->mnt_flags & MNT_RELATIME) { 235 + struct timespec64 ctime = inode_get_ctime(inode); 236 + 235 237 if ((timespec64_compare(&inode->i_atime, &inode->i_mtime) <= 0) || 236 - (timespec64_compare(&inode->i_atime, &inode->i_ctime) <= 0)) 238 + (timespec64_compare(&inode->i_atime, &ctime) <= 0)) 237 239 return 1; 238 240 239 241 return 0; ··· 296 294 297 295 i_size_write(inode, new_i_size); 298 296 inode->i_blocks = ocfs2_inode_sector_count(inode); 299 - inode->i_ctime = inode->i_mtime = current_time(inode); 297 + inode->i_mtime = inode_set_ctime_current(inode); 300 298 301 299 status = ocfs2_mark_inode_dirty(handle, inode, fe_bh); 302 300 if (status < 0) { ··· 417 415 } 418 416 419 417 i_size_write(inode, new_i_size); 420 - inode->i_ctime = inode->i_mtime = current_time(inode); 418 + inode->i_mtime = inode_set_ctime_current(inode); 421 419 422 420 di = (struct ocfs2_dinode *) fe_bh->b_data; 423 421 di->i_size = cpu_to_le64(new_i_size); 424 - di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); 425 - di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 422 + di->i_ctime = di->i_mtime = cpu_to_le64(inode_get_ctime(inode).tv_sec); 423 + di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 426 424 ocfs2_update_inode_fsync_trans(handle, inode, 0); 427 425 428 426 ocfs2_journal_dirty(handle, fe_bh); ··· 826 824 i_size_write(inode, abs_to); 827 825 inode->i_blocks = ocfs2_inode_sector_count(inode); 828 826 di->i_size = cpu_to_le64((u64)i_size_read(inode)); 829 - inode->i_mtime = inode->i_ctime = current_time(inode); 827 + inode->i_mtime = inode_set_ctime_current(inode); 830 828 di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec); 831 829 di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); 832 830 di->i_mtime_nsec = di->i_ctime_nsec; ··· 1319 1317 goto bail; 1320 1318 } 1321 1319 1322 - generic_fillattr(&nop_mnt_idmap, inode, stat); 1320 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 1323 1321 /* 1324 1322 * If there is inline data in the inode, the inode will normally not 1325 1323 * have data blocks allocated (it may have an external xattr block). ··· 2045 2043 goto out_inode_unlock; 2046 2044 } 2047 2045 2048 - inode->i_ctime = inode->i_mtime = current_time(inode); 2046 + inode->i_mtime = inode_set_ctime_current(inode); 2049 2047 ret = ocfs2_mark_inode_dirty(handle, inode, di_bh); 2050 2048 if (ret < 0) 2051 2049 mlog_errno(ret);
+6 -6
fs/ocfs2/inode.c
··· 306 306 inode->i_atime.tv_nsec = le32_to_cpu(fe->i_atime_nsec); 307 307 inode->i_mtime.tv_sec = le64_to_cpu(fe->i_mtime); 308 308 inode->i_mtime.tv_nsec = le32_to_cpu(fe->i_mtime_nsec); 309 - inode->i_ctime.tv_sec = le64_to_cpu(fe->i_ctime); 310 - inode->i_ctime.tv_nsec = le32_to_cpu(fe->i_ctime_nsec); 309 + inode_set_ctime(inode, le64_to_cpu(fe->i_ctime), 310 + le32_to_cpu(fe->i_ctime_nsec)); 311 311 312 312 if (OCFS2_I(inode)->ip_blkno != le64_to_cpu(fe->i_blkno)) 313 313 mlog(ML_ERROR, ··· 1314 1314 fe->i_mode = cpu_to_le16(inode->i_mode); 1315 1315 fe->i_atime = cpu_to_le64(inode->i_atime.tv_sec); 1316 1316 fe->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); 1317 - fe->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 1318 - fe->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 1317 + fe->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec); 1318 + fe->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 1319 1319 fe->i_mtime = cpu_to_le64(inode->i_mtime.tv_sec); 1320 1320 fe->i_mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); 1321 1321 ··· 1352 1352 inode->i_atime.tv_nsec = le32_to_cpu(fe->i_atime_nsec); 1353 1353 inode->i_mtime.tv_sec = le64_to_cpu(fe->i_mtime); 1354 1354 inode->i_mtime.tv_nsec = le32_to_cpu(fe->i_mtime_nsec); 1355 - inode->i_ctime.tv_sec = le64_to_cpu(fe->i_ctime); 1356 - inode->i_ctime.tv_nsec = le32_to_cpu(fe->i_ctime_nsec); 1355 + inode_set_ctime(inode, le64_to_cpu(fe->i_ctime), 1356 + le32_to_cpu(fe->i_ctime_nsec)); 1357 1357 1358 1358 spin_unlock(&OCFS2_I(inode)->ip_lock); 1359 1359 }
+3 -3
fs/ocfs2/move_extents.c
··· 950 950 } 951 951 952 952 di = (struct ocfs2_dinode *)di_bh->b_data; 953 - inode->i_ctime = current_time(inode); 954 - di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 955 - di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 953 + inode_set_ctime_current(inode); 954 + di->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec); 955 + di->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 956 956 ocfs2_update_inode_fsync_trans(handle, inode, 0); 957 957 958 958 ocfs2_journal_dirty(handle, di_bh);
+11 -10
fs/ocfs2/namei.c
··· 793 793 } 794 794 795 795 inc_nlink(inode); 796 - inode->i_ctime = current_time(inode); 796 + inode_set_ctime_current(inode); 797 797 ocfs2_set_links_count(fe, inode->i_nlink); 798 - fe->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 799 - fe->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 798 + fe->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec); 799 + fe->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 800 800 ocfs2_journal_dirty(handle, fe_bh); 801 801 802 802 err = ocfs2_add_entry(handle, dentry, inode, ··· 995 995 ocfs2_set_links_count(fe, inode->i_nlink); 996 996 ocfs2_journal_dirty(handle, fe_bh); 997 997 998 - dir->i_ctime = dir->i_mtime = current_time(dir); 998 + dir->i_mtime = inode_set_ctime_current(dir); 999 999 if (S_ISDIR(inode->i_mode)) 1000 1000 drop_nlink(dir); 1001 1001 ··· 1537 1537 new_dir_bh, &target_insert); 1538 1538 } 1539 1539 1540 - old_inode->i_ctime = current_time(old_inode); 1540 + inode_set_ctime_current(old_inode); 1541 1541 mark_inode_dirty(old_inode); 1542 1542 1543 1543 status = ocfs2_journal_access_di(handle, INODE_CACHE(old_inode), ··· 1546 1546 if (status >= 0) { 1547 1547 old_di = (struct ocfs2_dinode *) old_inode_bh->b_data; 1548 1548 1549 - old_di->i_ctime = cpu_to_le64(old_inode->i_ctime.tv_sec); 1550 - old_di->i_ctime_nsec = cpu_to_le32(old_inode->i_ctime.tv_nsec); 1549 + old_di->i_ctime = cpu_to_le64(inode_get_ctime(old_inode).tv_sec); 1550 + old_di->i_ctime_nsec = cpu_to_le32(inode_get_ctime(old_inode).tv_nsec); 1551 1551 ocfs2_journal_dirty(handle, old_inode_bh); 1552 1552 } else 1553 1553 mlog_errno(status); ··· 1586 1586 1587 1587 if (new_inode) { 1588 1588 drop_nlink(new_inode); 1589 - new_inode->i_ctime = current_time(new_inode); 1589 + inode_set_ctime_current(new_inode); 1590 1590 } 1591 - old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); 1591 + old_dir->i_mtime = inode_set_ctime_current(old_dir); 1592 1592 1593 1593 if (update_dot_dot) { 1594 1594 status = ocfs2_update_entry(old_inode, handle, ··· 1610 1610 1611 1611 if (old_dir != new_dir) { 1612 1612 /* Keep the same times on both directories.*/ 1613 - new_dir->i_ctime = new_dir->i_mtime = old_dir->i_ctime; 1613 + new_dir->i_mtime = inode_set_ctime_to_ts(new_dir, 1614 + inode_get_ctime(old_dir)); 1614 1615 1615 1616 /* 1616 1617 * This will also pick up the i_nlink change from the
+7 -7
fs/ocfs2/refcounttree.c
··· 3750 3750 goto out_commit; 3751 3751 } 3752 3752 3753 - inode->i_ctime = current_time(inode); 3754 - di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 3755 - di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 3753 + inode_set_ctime_current(inode); 3754 + di->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec); 3755 + di->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 3756 3756 3757 3757 ocfs2_journal_dirty(handle, di_bh); 3758 3758 ··· 4073 4073 * we want mtime to appear identical to the source and 4074 4074 * update ctime. 4075 4075 */ 4076 - t_inode->i_ctime = current_time(t_inode); 4076 + inode_set_ctime_current(t_inode); 4077 4077 4078 - di->i_ctime = cpu_to_le64(t_inode->i_ctime.tv_sec); 4079 - di->i_ctime_nsec = cpu_to_le32(t_inode->i_ctime.tv_nsec); 4078 + di->i_ctime = cpu_to_le64(inode_get_ctime(t_inode).tv_sec); 4079 + di->i_ctime_nsec = cpu_to_le32(inode_get_ctime(t_inode).tv_nsec); 4080 4080 4081 4081 t_inode->i_mtime = s_inode->i_mtime; 4082 4082 di->i_mtime = s_di->i_mtime; ··· 4456 4456 if (newlen > i_size_read(dest)) 4457 4457 i_size_write(dest, newlen); 4458 4458 spin_unlock(&OCFS2_I(dest)->ip_lock); 4459 - dest->i_ctime = dest->i_mtime = current_time(dest); 4459 + dest->i_mtime = inode_set_ctime_current(dest); 4460 4460 4461 4461 ret = ocfs2_mark_inode_dirty(handle, dest, d_bh); 4462 4462 if (ret) {
+3 -3
fs/ocfs2/xattr.c
··· 3421 3421 goto out; 3422 3422 } 3423 3423 3424 - inode->i_ctime = current_time(inode); 3425 - di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 3426 - di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 3424 + inode_set_ctime_current(inode); 3425 + di->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec); 3426 + di->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 3427 3427 ocfs2_journal_dirty(ctxt->handle, xis->inode_bh); 3428 3428 } 3429 3429 out:
+2 -2
fs/omfs/dir.c
··· 143 143 mark_buffer_dirty(bh); 144 144 brelse(bh); 145 145 146 - dir->i_ctime = current_time(dir); 146 + inode_set_ctime_current(dir); 147 147 148 148 /* mark affected inodes dirty to rebuild checksums */ 149 149 mark_inode_dirty(dir); ··· 399 399 if (err) 400 400 goto out; 401 401 402 - old_inode->i_ctime = current_time(old_inode); 402 + inode_set_ctime_current(old_inode); 403 403 mark_inode_dirty(old_inode); 404 404 out: 405 405 return err;
+4 -5
fs/omfs/inode.c
··· 51 51 inode_init_owner(&nop_mnt_idmap, inode, NULL, mode); 52 52 inode->i_mapping->a_ops = &omfs_aops; 53 53 54 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 54 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 55 55 switch (mode & S_IFMT) { 56 56 case S_IFDIR: 57 57 inode->i_op = &omfs_dir_inops; ··· 134 134 oi->i_head.h_magic = OMFS_IMAGIC; 135 135 oi->i_size = cpu_to_be64(inode->i_size); 136 136 137 - ctime = inode->i_ctime.tv_sec * 1000LL + 138 - ((inode->i_ctime.tv_nsec + 999)/1000); 137 + ctime = inode_get_ctime(inode).tv_sec * 1000LL + 138 + ((inode_get_ctime(inode).tv_nsec + 999)/1000); 139 139 oi->i_ctime = cpu_to_be64(ctime); 140 140 141 141 omfs_update_checksums(oi); ··· 232 232 233 233 inode->i_atime.tv_sec = ctime; 234 234 inode->i_mtime.tv_sec = ctime; 235 - inode->i_ctime.tv_sec = ctime; 235 + inode_set_ctime(inode, ctime, nsecs); 236 236 inode->i_atime.tv_nsec = nsecs; 237 237 inode->i_mtime.tv_nsec = nsecs; 238 - inode->i_ctime.tv_nsec = nsecs; 239 238 240 239 inode->i_mapping->a_ops = &omfs_aops; 241 240
+2 -3
fs/openpromfs/inode.c
··· 237 237 if (IS_ERR(inode)) 238 238 return ERR_CAST(inode); 239 239 if (inode->i_state & I_NEW) { 240 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 240 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 241 241 ent_oi = OP_I(inode); 242 242 ent_oi->type = ent_type; 243 243 ent_oi->u = ent_data; ··· 387 387 goto out_no_root; 388 388 } 389 389 390 - root_inode->i_mtime = root_inode->i_atime = 391 - root_inode->i_ctime = current_time(root_inode); 390 + root_inode->i_mtime = root_inode->i_atime = inode_set_ctime_current(root_inode); 392 391 root_inode->i_op = &openprom_inode_operations; 393 392 root_inode->i_fop = &openprom_operations; 394 393 root_inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
+4 -3
fs/orangefs/inode.c
··· 871 871 ret = orangefs_inode_getattr(inode, 872 872 request_mask & STATX_SIZE ? ORANGEFS_GETATTR_SIZE : 0); 873 873 if (ret == 0) { 874 - generic_fillattr(&nop_mnt_idmap, inode, stat); 874 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 875 875 876 876 /* override block size reported to stat */ 877 877 if (!(request_mask & STATX_SIZE)) ··· 900 900 return generic_permission(&nop_mnt_idmap, inode, mask); 901 901 } 902 902 903 - int orangefs_update_time(struct inode *inode, struct timespec64 *time, int flags) 903 + int orangefs_update_time(struct inode *inode, int flags) 904 904 { 905 905 struct iattr iattr; 906 + 906 907 gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_update_time: %pU\n", 907 908 get_khandle_from_ino(inode)); 908 - generic_update_time(inode, time, flags); 909 + flags = generic_update_time(inode, flags); 909 910 memset(&iattr, 0, sizeof iattr); 910 911 if (flags & S_ATIME) 911 912 iattr.ia_valid |= ATTR_ATIME;
+1 -1
fs/orangefs/namei.c
··· 421 421 ret); 422 422 423 423 if (new_dentry->d_inode) 424 - new_dentry->d_inode->i_ctime = current_time(new_dentry->d_inode); 424 + inode_set_ctime_current(d_inode(new_dentry)); 425 425 426 426 op_release(new_op); 427 427 return ret;
+1 -1
fs/orangefs/orangefs-kernel.h
··· 370 370 int orangefs_permission(struct mnt_idmap *idmap, 371 371 struct inode *inode, int mask); 372 372 373 - int orangefs_update_time(struct inode *, struct timespec64 *, int); 373 + int orangefs_update_time(struct inode *, int); 374 374 375 375 /* 376 376 * defined in xattr.c
+3 -3
fs/orangefs/orangefs-utils.c
··· 361 361 downcall.resp.getattr.attributes.atime; 362 362 inode->i_mtime.tv_sec = (time64_t)new_op-> 363 363 downcall.resp.getattr.attributes.mtime; 364 - inode->i_ctime.tv_sec = (time64_t)new_op-> 365 - downcall.resp.getattr.attributes.ctime; 364 + inode_set_ctime(inode, 365 + (time64_t)new_op->downcall.resp.getattr.attributes.ctime, 366 + 0); 366 367 inode->i_atime.tv_nsec = 0; 367 368 inode->i_mtime.tv_nsec = 0; 368 - inode->i_ctime.tv_nsec = 0; 369 369 370 370 /* special case: mark the root inode as sticky */ 371 371 inode->i_mode = type | (is_root_handle(inode) ? S_ISVTX : 0) |
+5 -2
fs/overlayfs/file.c
··· 239 239 static void ovl_file_accessed(struct file *file) 240 240 { 241 241 struct inode *inode, *upperinode; 242 + struct timespec64 ctime, uctime; 242 243 243 244 if (file->f_flags & O_NOATIME) 244 245 return; ··· 250 249 if (!upperinode) 251 250 return; 252 251 252 + ctime = inode_get_ctime(inode); 253 + uctime = inode_get_ctime(upperinode); 253 254 if ((!timespec64_equal(&inode->i_mtime, &upperinode->i_mtime) || 254 - !timespec64_equal(&inode->i_ctime, &upperinode->i_ctime))) { 255 + !timespec64_equal(&ctime, &uctime))) { 255 256 inode->i_mtime = upperinode->i_mtime; 256 - inode->i_ctime = upperinode->i_ctime; 257 + inode_set_ctime_to_ts(inode, uctime); 257 258 } 258 259 259 260 touch_atime(&file->f_path);
+1 -1
fs/overlayfs/inode.c
··· 693 693 } 694 694 #endif 695 695 696 - int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags) 696 + int ovl_update_time(struct inode *inode, int flags) 697 697 { 698 698 if (flags & S_ATIME) { 699 699 struct ovl_fs *ofs = inode->i_sb->s_fs_info;
+1 -1
fs/overlayfs/overlayfs.h
··· 665 665 } 666 666 #endif 667 667 668 - int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags); 668 + int ovl_update_time(struct inode *inode, int flags); 669 669 bool ovl_is_private_xattr(struct super_block *sb, const char *name); 670 670 671 671 struct ovl_inode_params {
+1 -1
fs/overlayfs/util.c
··· 1202 1202 inode->i_mode = realinode->i_mode; 1203 1203 inode->i_atime = realinode->i_atime; 1204 1204 inode->i_mtime = realinode->i_mtime; 1205 - inode->i_ctime = realinode->i_ctime; 1205 + inode_set_ctime_to_ts(inode, inode_get_ctime(realinode)); 1206 1206 i_size_write(inode, i_size_read(realinode)); 1207 1207 }
+1 -1
fs/pipe.c
··· 899 899 inode->i_mode = S_IFIFO | S_IRUSR | S_IWUSR; 900 900 inode->i_uid = current_fsuid(); 901 901 inode->i_gid = current_fsgid(); 902 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 902 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 903 903 904 904 return inode; 905 905
+1 -1
fs/posix_acl.c
··· 1027 1027 return error; 1028 1028 } 1029 1029 1030 - inode->i_ctime = current_time(inode); 1030 + inode_set_ctime_current(inode); 1031 1031 if (IS_I_VERSION(inode)) 1032 1032 inode_inc_iversion(inode); 1033 1033 set_cached_acl(inode, type, acl);
+3 -3
fs/proc/base.c
··· 1902 1902 ei = PROC_I(inode); 1903 1903 inode->i_mode = mode; 1904 1904 inode->i_ino = get_next_ino(); 1905 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 1905 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 1906 1906 inode->i_op = &proc_def_inode_operations; 1907 1907 1908 1908 /* ··· 1966 1966 struct proc_fs_info *fs_info = proc_sb_info(inode->i_sb); 1967 1967 struct task_struct *task; 1968 1968 1969 - generic_fillattr(&nop_mnt_idmap, inode, stat); 1969 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 1970 1970 1971 1971 stat->uid = GLOBAL_ROOT_UID; 1972 1972 stat->gid = GLOBAL_ROOT_GID; ··· 3899 3899 { 3900 3900 struct inode *inode = d_inode(path->dentry); 3901 3901 struct task_struct *p = get_proc_task(inode); 3902 - generic_fillattr(&nop_mnt_idmap, inode, stat); 3902 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 3903 3903 3904 3904 if (p) { 3905 3905 stat->nlink += get_nr_threads(p);
+1 -1
fs/proc/fd.c
··· 352 352 struct inode *inode = d_inode(path->dentry); 353 353 int rv = 0; 354 354 355 - generic_fillattr(&nop_mnt_idmap, inode, stat); 355 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 356 356 357 357 /* If it's a directory, put the number of open fds there */ 358 358 if (S_ISDIR(inode->i_mode)) {
+1 -1
fs/proc/generic.c
··· 146 146 } 147 147 } 148 148 149 - generic_fillattr(&nop_mnt_idmap, inode, stat); 149 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 150 150 return 0; 151 151 } 152 152
+1 -1
fs/proc/inode.c
··· 660 660 661 661 inode->i_private = de->data; 662 662 inode->i_ino = de->low_ino; 663 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 663 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 664 664 PROC_I(inode)->pde = de; 665 665 if (is_empty_pde(de)) { 666 666 make_empty_dir_inode(inode);
+1 -1
fs/proc/proc_net.c
··· 308 308 309 309 net = get_proc_task_net(inode); 310 310 311 - generic_fillattr(&nop_mnt_idmap, inode, stat); 311 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 312 312 313 313 if (net != NULL) { 314 314 stat->nlink = net->proc_net->nlink;
+2 -2
fs/proc/proc_sysctl.c
··· 463 463 head->count++; 464 464 spin_unlock(&sysctl_lock); 465 465 466 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 466 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 467 467 inode->i_mode = table->mode; 468 468 if (!S_ISDIR(table->mode)) { 469 469 inode->i_mode |= S_IFREG; ··· 849 849 if (IS_ERR(head)) 850 850 return PTR_ERR(head); 851 851 852 - generic_fillattr(&nop_mnt_idmap, inode, stat); 852 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 853 853 if (table) 854 854 stat->mode = (stat->mode & S_IFMT) | table->mode; 855 855
+2 -1
fs/proc/root.c
··· 314 314 const struct path *path, struct kstat *stat, 315 315 u32 request_mask, unsigned int query_flags) 316 316 { 317 - generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat); 317 + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(path->dentry), 318 + stat); 318 319 stat->nlink = proc_root.nlink + nr_processes(); 319 320 return 0; 320 321 }
+1 -1
fs/proc/self.c
··· 46 46 struct inode *inode = new_inode(s); 47 47 if (inode) { 48 48 inode->i_ino = self_inum; 49 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 49 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 50 50 inode->i_mode = S_IFLNK | S_IRWXUGO; 51 51 inode->i_uid = GLOBAL_ROOT_UID; 52 52 inode->i_gid = GLOBAL_ROOT_GID;
+1 -1
fs/proc/thread_self.c
··· 46 46 struct inode *inode = new_inode(s); 47 47 if (inode) { 48 48 inode->i_ino = thread_self_inum; 49 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 49 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 50 50 inode->i_mode = S_IFLNK | S_IRWXUGO; 51 51 inode->i_uid = GLOBAL_ROOT_UID; 52 52 inode->i_gid = GLOBAL_ROOT_GID;
+2 -2
fs/pstore/inode.c
··· 223 223 struct inode *inode = new_inode(sb); 224 224 if (inode) { 225 225 inode->i_ino = get_next_ino(); 226 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 226 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 227 227 } 228 228 return inode; 229 229 } ··· 390 390 inode->i_private = private; 391 391 392 392 if (record->time.tv_sec) 393 - inode->i_mtime = inode->i_ctime = record->time; 393 + inode->i_mtime = inode_set_ctime_to_ts(inode, record->time); 394 394 395 395 d_add(dentry, inode); 396 396
+1 -2
fs/qnx4/inode.c
··· 305 305 inode->i_mtime.tv_nsec = 0; 306 306 inode->i_atime.tv_sec = le32_to_cpu(raw_inode->di_atime); 307 307 inode->i_atime.tv_nsec = 0; 308 - inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->di_ctime); 309 - inode->i_ctime.tv_nsec = 0; 308 + inode_set_ctime(inode, le32_to_cpu(raw_inode->di_ctime), 0); 310 309 inode->i_blocks = le32_to_cpu(raw_inode->di_first_xtnt.xtnt_size); 311 310 312 311 memcpy(qnx4_inode, raw_inode, QNX4_DIR_ENTRY_SIZE);
+1 -2
fs/qnx6/inode.c
··· 562 562 inode->i_mtime.tv_nsec = 0; 563 563 inode->i_atime.tv_sec = fs32_to_cpu(sbi, raw_inode->di_atime); 564 564 inode->i_atime.tv_nsec = 0; 565 - inode->i_ctime.tv_sec = fs32_to_cpu(sbi, raw_inode->di_ctime); 566 - inode->i_ctime.tv_nsec = 0; 565 + inode_set_ctime(inode, fs32_to_cpu(sbi, raw_inode->di_ctime), 0); 567 566 568 567 /* calc blocks based on 512 byte blocksize */ 569 568 inode->i_blocks = (inode->i_size + 511) >> 9;
+3 -3
fs/ramfs/inode.c
··· 65 65 inode->i_mapping->a_ops = &ram_aops; 66 66 mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER); 67 67 mapping_set_unevictable(inode->i_mapping); 68 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 68 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 69 69 switch (mode & S_IFMT) { 70 70 default: 71 71 init_special_inode(inode, mode, dev); ··· 105 105 d_instantiate(dentry, inode); 106 106 dget(dentry); /* Extra count - pin the dentry in core */ 107 107 error = 0; 108 - dir->i_mtime = dir->i_ctime = current_time(dir); 108 + dir->i_mtime = inode_set_ctime_current(dir); 109 109 } 110 110 return error; 111 111 } ··· 138 138 if (!error) { 139 139 d_instantiate(dentry, inode); 140 140 dget(dentry); 141 - dir->i_mtime = dir->i_ctime = current_time(dir); 141 + dir->i_mtime = inode_set_ctime_current(dir); 142 142 } else 143 143 iput(inode); 144 144 }
+5 -7
fs/reiserfs/inode.c
··· 1259 1259 inode->i_size = sd_v1_size(sd); 1260 1260 inode->i_atime.tv_sec = sd_v1_atime(sd); 1261 1261 inode->i_mtime.tv_sec = sd_v1_mtime(sd); 1262 - inode->i_ctime.tv_sec = sd_v1_ctime(sd); 1262 + inode_set_ctime(inode, sd_v1_ctime(sd), 0); 1263 1263 inode->i_atime.tv_nsec = 0; 1264 - inode->i_ctime.tv_nsec = 0; 1265 1264 inode->i_mtime.tv_nsec = 0; 1266 1265 1267 1266 inode->i_blocks = sd_v1_blocks(sd); ··· 1313 1314 i_gid_write(inode, sd_v2_gid(sd)); 1314 1315 inode->i_mtime.tv_sec = sd_v2_mtime(sd); 1315 1316 inode->i_atime.tv_sec = sd_v2_atime(sd); 1316 - inode->i_ctime.tv_sec = sd_v2_ctime(sd); 1317 - inode->i_ctime.tv_nsec = 0; 1317 + inode_set_ctime(inode, sd_v2_ctime(sd), 0); 1318 1318 inode->i_mtime.tv_nsec = 0; 1319 1319 inode->i_atime.tv_nsec = 0; 1320 1320 inode->i_blocks = sd_v2_blocks(sd); ··· 1372 1374 set_sd_v2_gid(sd_v2, i_gid_read(inode)); 1373 1375 set_sd_v2_mtime(sd_v2, inode->i_mtime.tv_sec); 1374 1376 set_sd_v2_atime(sd_v2, inode->i_atime.tv_sec); 1375 - set_sd_v2_ctime(sd_v2, inode->i_ctime.tv_sec); 1377 + set_sd_v2_ctime(sd_v2, inode_get_ctime(inode).tv_sec); 1376 1378 set_sd_v2_blocks(sd_v2, to_fake_used_blocks(inode, SD_V2_SIZE)); 1377 1379 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) 1378 1380 set_sd_v2_rdev(sd_v2, new_encode_dev(inode->i_rdev)); ··· 1392 1394 set_sd_v1_nlink(sd_v1, inode->i_nlink); 1393 1395 set_sd_v1_size(sd_v1, size); 1394 1396 set_sd_v1_atime(sd_v1, inode->i_atime.tv_sec); 1395 - set_sd_v1_ctime(sd_v1, inode->i_ctime.tv_sec); 1397 + set_sd_v1_ctime(sd_v1, inode_get_ctime(inode).tv_sec); 1396 1398 set_sd_v1_mtime(sd_v1, inode->i_mtime.tv_sec); 1397 1399 1398 1400 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) ··· 1984 1986 1985 1987 /* uid and gid must already be set by the caller for quota init */ 1986 1988 1987 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 1989 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 1988 1990 inode->i_size = i_size; 1989 1991 inode->i_blocks = 0; 1990 1992 inode->i_bytes = 0;
+2 -2
fs/reiserfs/ioctl.c
··· 55 55 } 56 56 sd_attrs_to_i_attrs(flags, inode); 57 57 REISERFS_I(inode)->i_attrs = flags; 58 - inode->i_ctime = current_time(inode); 58 + inode_set_ctime_current(inode); 59 59 mark_inode_dirty(inode); 60 60 err = 0; 61 61 unlock: ··· 107 107 err = -EFAULT; 108 108 goto setversion_out; 109 109 } 110 - inode->i_ctime = current_time(inode); 110 + inode_set_ctime_current(inode); 111 111 mark_inode_dirty(inode); 112 112 setversion_out: 113 113 mnt_drop_write_file(filp);
+7 -11
fs/reiserfs/namei.c
··· 572 572 } 573 573 574 574 dir->i_size += paste_size; 575 - dir->i_mtime = dir->i_ctime = current_time(dir); 575 + dir->i_mtime = inode_set_ctime_current(dir); 576 576 if (!S_ISDIR(inode->i_mode) && visible) 577 577 /* reiserfs_mkdir or reiserfs_rename will do that by itself */ 578 578 reiserfs_update_sd(th, dir); ··· 966 966 inode->i_nlink); 967 967 968 968 clear_nlink(inode); 969 - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(dir); 969 + dir->i_mtime = inode_set_ctime_to_ts(dir, 970 + inode_set_ctime_current(inode)); 970 971 reiserfs_update_sd(&th, inode); 971 972 972 973 DEC_DIR_INODE_NLINK(dir) ··· 1071 1070 inc_nlink(inode); 1072 1071 goto end_unlink; 1073 1072 } 1074 - inode->i_ctime = current_time(inode); 1073 + inode_set_ctime_current(inode); 1075 1074 reiserfs_update_sd(&th, inode); 1076 1075 1077 1076 dir->i_size -= (de.de_entrylen + DEH_SIZE); 1078 - dir->i_ctime = dir->i_mtime = current_time(dir); 1077 + dir->i_mtime = inode_set_ctime_current(dir); 1079 1078 reiserfs_update_sd(&th, dir); 1080 1079 1081 1080 if (!savelink) ··· 1251 1250 return err ? err : retval; 1252 1251 } 1253 1252 1254 - inode->i_ctime = current_time(inode); 1253 + inode_set_ctime_current(inode); 1255 1254 reiserfs_update_sd(&th, inode); 1256 1255 1257 1256 ihold(inode); ··· 1326 1325 int jbegin_count; 1327 1326 umode_t old_inode_mode; 1328 1327 unsigned long savelink = 1; 1329 - struct timespec64 ctime; 1330 1328 1331 1329 if (flags & ~RENAME_NOREPLACE) 1332 1330 return -EINVAL; ··· 1576 1576 1577 1577 mark_de_hidden(old_de.de_deh + old_de.de_entry_num); 1578 1578 journal_mark_dirty(&th, old_de.de_bh); 1579 - ctime = current_time(old_dir); 1580 - old_dir->i_ctime = old_dir->i_mtime = ctime; 1581 - new_dir->i_ctime = new_dir->i_mtime = ctime; 1582 1579 /* 1583 1580 * thanks to Alex Adriaanse <alex_a@caltech.edu> for patch 1584 1581 * which adds ctime update of renamed object 1585 1582 */ 1586 - old_inode->i_ctime = ctime; 1583 + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); 1587 1584 1588 1585 if (new_dentry_inode) { 1589 1586 /* adjust link number of the victim */ ··· 1589 1592 } else { 1590 1593 drop_nlink(new_dentry_inode); 1591 1594 } 1592 - new_dentry_inode->i_ctime = ctime; 1593 1595 savelink = new_dentry_inode->i_nlink; 1594 1596 } 1595 1597
+2 -2
fs/reiserfs/stree.c
··· 2004 2004 2005 2005 if (update_timestamps) { 2006 2006 inode->i_mtime = current_time(inode); 2007 - inode->i_ctime = current_time(inode); 2007 + inode_set_ctime_current(inode); 2008 2008 } 2009 2009 reiserfs_update_sd(th, inode); 2010 2010 ··· 2029 2029 if (update_timestamps) { 2030 2030 /* this is truncate, not file closing */ 2031 2031 inode->i_mtime = current_time(inode); 2032 - inode->i_ctime = current_time(inode); 2032 + inode_set_ctime_current(inode); 2033 2033 } 2034 2034 reiserfs_update_sd(th, inode); 2035 2035
+1 -1
fs/reiserfs/super.c
··· 2587 2587 return err; 2588 2588 if (inode->i_size < off + len - towrite) 2589 2589 i_size_write(inode, off + len - towrite); 2590 - inode->i_mtime = inode->i_ctime = current_time(inode); 2590 + inode->i_mtime = inode_set_ctime_current(inode); 2591 2591 mark_inode_dirty(inode); 2592 2592 return len - towrite; 2593 2593 }
+3 -2
fs/reiserfs/xattr.c
··· 466 466 static void update_ctime(struct inode *inode) 467 467 { 468 468 struct timespec64 now = current_time(inode); 469 + struct timespec64 ctime = inode_get_ctime(inode); 469 470 470 471 if (inode_unhashed(inode) || !inode->i_nlink || 471 - timespec64_equal(&inode->i_ctime, &now)) 472 + timespec64_equal(&ctime, &now)) 472 473 return; 473 474 474 - inode->i_ctime = current_time(inode); 475 + inode_set_ctime_to_ts(inode, now); 475 476 mark_inode_dirty(inode); 476 477 } 477 478
+1 -1
fs/reiserfs/xattr_acl.c
··· 285 285 if (error == -ENODATA) { 286 286 error = 0; 287 287 if (type == ACL_TYPE_ACCESS) { 288 - inode->i_ctime = current_time(inode); 288 + inode_set_ctime_current(inode); 289 289 mark_inode_dirty(inode); 290 290 } 291 291 }
+1 -2
fs/romfs/super.c
··· 322 322 323 323 set_nlink(i, 1); /* Hard to decide.. */ 324 324 i->i_size = be32_to_cpu(ri.size); 325 - i->i_mtime.tv_sec = i->i_atime.tv_sec = i->i_ctime.tv_sec = 0; 326 - i->i_mtime.tv_nsec = i->i_atime.tv_nsec = i->i_ctime.tv_nsec = 0; 325 + i->i_mtime = i->i_atime = inode_set_ctime(i, 0, 0); 327 326 328 327 /* set up mode and ops */ 329 328 mode = romfs_modemap[nextfh & ROMFH_TYPE];
+2 -2
fs/smb/client/file.c
··· 1085 1085 !test_bit(CIFS_INO_CLOSE_ON_LOCK, &cinode->flags) && 1086 1086 dclose) { 1087 1087 if (test_and_clear_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) { 1088 - inode->i_ctime = inode->i_mtime = current_time(inode); 1088 + inode->i_mtime = inode_set_ctime_current(inode); 1089 1089 } 1090 1090 spin_lock(&cinode->deferred_lock); 1091 1091 cifs_add_deferred_close(cfile, dclose); ··· 2596 2596 write_data, to - from, &offset); 2597 2597 cifsFileInfo_put(open_file); 2598 2598 /* Does mm or vfs already set times? */ 2599 - inode->i_atime = inode->i_mtime = current_time(inode); 2599 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 2600 2600 if ((bytes_written > 0) && (offset)) 2601 2601 rc = 0; 2602 2602 else if (bytes_written < 0)
+3 -2
fs/smb/client/fscache.h
··· 50 50 struct cifs_fscache_inode_coherency_data *cd) 51 51 { 52 52 struct cifsInodeInfo *cifsi = CIFS_I(inode); 53 + struct timespec64 ctime = inode_get_ctime(inode); 53 54 54 55 memset(cd, 0, sizeof(*cd)); 55 56 cd->last_write_time_sec = cpu_to_le64(cifsi->netfs.inode.i_mtime.tv_sec); 56 57 cd->last_write_time_nsec = cpu_to_le32(cifsi->netfs.inode.i_mtime.tv_nsec); 57 - cd->last_change_time_sec = cpu_to_le64(cifsi->netfs.inode.i_ctime.tv_sec); 58 - cd->last_change_time_nsec = cpu_to_le32(cifsi->netfs.inode.i_ctime.tv_nsec); 58 + cd->last_change_time_sec = cpu_to_le64(ctime.tv_sec); 59 + cd->last_change_time_nsec = cpu_to_le32(ctime.tv_nsec); 59 60 } 60 61 61 62
+8 -8
fs/smb/client/inode.c
··· 172 172 else 173 173 inode->i_atime = fattr->cf_atime; 174 174 inode->i_mtime = fattr->cf_mtime; 175 - inode->i_ctime = fattr->cf_ctime; 175 + inode_set_ctime_to_ts(inode, fattr->cf_ctime); 176 176 inode->i_rdev = fattr->cf_rdev; 177 177 cifs_nlink_fattr_to_inode(inode, fattr); 178 178 inode->i_uid = fattr->cf_uid; ··· 1744 1744 cifs_inode = CIFS_I(inode); 1745 1745 cifs_inode->time = 0; /* will force revalidate to get info 1746 1746 when needed */ 1747 - inode->i_ctime = current_time(inode); 1747 + inode_set_ctime_current(inode); 1748 1748 } 1749 - dir->i_ctime = dir->i_mtime = current_time(dir); 1749 + dir->i_mtime = inode_set_ctime_current(dir); 1750 1750 cifs_inode = CIFS_I(dir); 1751 1751 CIFS_I(dir)->time = 0; /* force revalidate of dir as well */ 1752 1752 unlink_out: ··· 2060 2060 */ 2061 2061 cifsInode->time = 0; 2062 2062 2063 - d_inode(direntry)->i_ctime = inode->i_ctime = inode->i_mtime = 2064 - current_time(inode); 2063 + inode_set_ctime_current(d_inode(direntry)); 2064 + inode->i_mtime = inode_set_ctime_current(inode); 2065 2065 2066 2066 rmdir_exit: 2067 2067 free_dentry_path(page); ··· 2267 2267 /* force revalidate to go get info when needed */ 2268 2268 CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0; 2269 2269 2270 - source_dir->i_ctime = source_dir->i_mtime = target_dir->i_ctime = 2271 - target_dir->i_mtime = current_time(source_dir); 2270 + source_dir->i_mtime = target_dir->i_mtime = inode_set_ctime_to_ts(source_dir, 2271 + inode_set_ctime_current(target_dir)); 2272 2272 2273 2273 cifs_rename_exit: 2274 2274 kfree(info_buf_source); ··· 2540 2540 return rc; 2541 2541 } 2542 2542 2543 - generic_fillattr(&nop_mnt_idmap, inode, stat); 2543 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 2544 2544 stat->blksize = cifs_sb->ctx->bsize; 2545 2545 stat->ino = CIFS_I(inode)->uniqueid; 2546 2546
+2 -1
fs/smb/client/smb2ops.c
··· 1396 1396 if (file_inf.LastWriteTime) 1397 1397 inode->i_mtime = cifs_NTtimeToUnix(file_inf.LastWriteTime); 1398 1398 if (file_inf.ChangeTime) 1399 - inode->i_ctime = cifs_NTtimeToUnix(file_inf.ChangeTime); 1399 + inode_set_ctime_to_ts(inode, 1400 + cifs_NTtimeToUnix(file_inf.ChangeTime)); 1400 1401 if (file_inf.LastAccessTime) 1401 1402 inode->i_atime = cifs_NTtimeToUnix(file_inf.LastAccessTime); 1402 1403
+15 -15
fs/smb/server/smb2pdu.c
··· 4402 4402 } 4403 4403 4404 4404 basic_info = (struct smb2_file_basic_info *)rsp->Buffer; 4405 - generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp), 4406 - &stat); 4405 + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, 4406 + file_inode(fp->filp), &stat); 4407 4407 basic_info->CreationTime = cpu_to_le64(fp->create_time); 4408 4408 time = ksmbd_UnixTimeToNT(stat.atime); 4409 4409 basic_info->LastAccessTime = cpu_to_le64(time); ··· 4428 4428 struct kstat stat; 4429 4429 4430 4430 inode = file_inode(fp->filp); 4431 - generic_fillattr(file_mnt_idmap(fp->filp), inode, &stat); 4431 + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, inode, &stat); 4432 4432 4433 4433 sinfo = (struct smb2_file_standard_info *)rsp->Buffer; 4434 4434 delete_pending = ksmbd_inode_pending_delete(fp); ··· 4482 4482 return PTR_ERR(filename); 4483 4483 4484 4484 inode = file_inode(fp->filp); 4485 - generic_fillattr(file_mnt_idmap(fp->filp), inode, &stat); 4485 + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, inode, &stat); 4486 4486 4487 4487 ksmbd_debug(SMB, "filename = %s\n", filename); 4488 4488 delete_pending = ksmbd_inode_pending_delete(fp); ··· 4559 4559 int buf_free_len; 4560 4560 struct smb2_query_info_req *req = ksmbd_req_buf_next(work); 4561 4561 4562 - generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp), 4563 - &stat); 4562 + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, 4563 + file_inode(fp->filp), &stat); 4564 4564 file_info = (struct smb2_file_stream_info *)rsp->Buffer; 4565 4565 4566 4566 buf_free_len = ··· 4650 4650 struct smb2_file_internal_info *file_info; 4651 4651 struct kstat stat; 4652 4652 4653 - generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp), 4654 - &stat); 4653 + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, 4654 + file_inode(fp->filp), &stat); 4655 4655 file_info = (struct smb2_file_internal_info *)rsp->Buffer; 4656 4656 file_info->IndexNumber = cpu_to_le64(stat.ino); 4657 4657 rsp->OutputBufferLength = ··· 4676 4676 file_info = (struct smb2_file_ntwrk_info *)rsp->Buffer; 4677 4677 4678 4678 inode = file_inode(fp->filp); 4679 - generic_fillattr(file_mnt_idmap(fp->filp), inode, &stat); 4679 + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, inode, &stat); 4680 4680 4681 4681 file_info->CreationTime = cpu_to_le64(fp->create_time); 4682 4682 time = ksmbd_UnixTimeToNT(stat.atime); ··· 4737 4737 struct smb2_file_comp_info *file_info; 4738 4738 struct kstat stat; 4739 4739 4740 - generic_fillattr(file_mnt_idmap(fp->filp), file_inode(fp->filp), 4741 - &stat); 4740 + generic_fillattr(file_mnt_idmap(fp->filp), STATX_BASIC_STATS, 4741 + file_inode(fp->filp), &stat); 4742 4742 4743 4743 file_info = (struct smb2_file_comp_info *)rsp->Buffer; 4744 4744 file_info->CompressedFileSize = cpu_to_le64(stat.blocks << 9); ··· 4790 4790 file_info->LastAccessTime = cpu_to_le64(time); 4791 4791 time = ksmbd_UnixTimeToNT(inode->i_mtime); 4792 4792 file_info->LastWriteTime = cpu_to_le64(time); 4793 - time = ksmbd_UnixTimeToNT(inode->i_ctime); 4793 + time = ksmbd_UnixTimeToNT(inode_get_ctime(inode)); 4794 4794 file_info->ChangeTime = cpu_to_le64(time); 4795 4795 file_info->DosAttributes = fp->f_ci->m_fattr; 4796 4796 file_info->Inode = cpu_to_le64(inode->i_ino); ··· 5433 5433 rsp->LastAccessTime = cpu_to_le64(time); 5434 5434 time = ksmbd_UnixTimeToNT(inode->i_mtime); 5435 5435 rsp->LastWriteTime = cpu_to_le64(time); 5436 - time = ksmbd_UnixTimeToNT(inode->i_ctime); 5436 + time = ksmbd_UnixTimeToNT(inode_get_ctime(inode)); 5437 5437 rsp->ChangeTime = cpu_to_le64(time); 5438 5438 ksmbd_fd_put(work, fp); 5439 5439 } else { ··· 5656 5656 if (file_info->ChangeTime) 5657 5657 attrs.ia_ctime = ksmbd_NTtimeToUnix(file_info->ChangeTime); 5658 5658 else 5659 - attrs.ia_ctime = inode->i_ctime; 5659 + attrs.ia_ctime = inode_get_ctime(inode); 5660 5660 5661 5661 if (file_info->LastWriteTime) { 5662 5662 attrs.ia_mtime = ksmbd_NTtimeToUnix(file_info->LastWriteTime); ··· 5701 5701 return -EACCES; 5702 5702 5703 5703 inode_lock(inode); 5704 - inode->i_ctime = attrs.ia_ctime; 5704 + inode_set_ctime_to_ts(inode, attrs.ia_ctime); 5705 5705 attrs.ia_valid &= ~ATTR_CTIME; 5706 5706 rc = notify_change(idmap, dentry, &attrs, NULL); 5707 5707 inode_unlock(inode);
+2 -1
fs/smb/server/vfs.c
··· 1659 1659 u64 time; 1660 1660 int rc; 1661 1661 1662 - generic_fillattr(idmap, d_inode(dentry), ksmbd_kstat->kstat); 1662 + generic_fillattr(idmap, STATX_BASIC_STATS, d_inode(dentry), 1663 + ksmbd_kstat->kstat); 1663 1664 1664 1665 time = ksmbd_UnixTimeToNT(ksmbd_kstat->kstat->ctime); 1665 1666 ksmbd_kstat->create_time = time;
+1 -1
fs/squashfs/inode.c
··· 61 61 inode->i_ino = le32_to_cpu(sqsh_ino->inode_number); 62 62 inode->i_mtime.tv_sec = le32_to_cpu(sqsh_ino->mtime); 63 63 inode->i_atime.tv_sec = inode->i_mtime.tv_sec; 64 - inode->i_ctime.tv_sec = inode->i_mtime.tv_sec; 64 + inode_set_ctime(inode, inode->i_mtime.tv_sec, 0); 65 65 inode->i_mode = le16_to_cpu(sqsh_ino->mode); 66 66 inode->i_size = 0; 67 67
+1 -1
fs/stack.c
··· 68 68 dest->i_rdev = src->i_rdev; 69 69 dest->i_atime = src->i_atime; 70 70 dest->i_mtime = src->i_mtime; 71 - dest->i_ctime = src->i_ctime; 71 + inode_set_ctime_to_ts(dest, inode_get_ctime(src)); 72 72 dest->i_blkbits = src->i_blkbits; 73 73 dest->i_flags = src->i_flags; 74 74 set_nlink(dest, src->i_nlink);
+52 -13
fs/stat.c
··· 27 27 #include "mount.h" 28 28 29 29 /** 30 + * fill_mg_cmtime - Fill in the mtime and ctime and flag ctime as QUERIED 31 + * @stat: where to store the resulting values 32 + * @request_mask: STATX_* values requested 33 + * @inode: inode from which to grab the c/mtime 34 + * 35 + * Given @inode, grab the ctime and mtime out if it and store the result 36 + * in @stat. When fetching the value, flag it as queried so the next write 37 + * will use a fine-grained timestamp. 38 + */ 39 + void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode) 40 + { 41 + atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec; 42 + 43 + /* If neither time was requested, then don't report them */ 44 + if (!(request_mask & (STATX_CTIME|STATX_MTIME))) { 45 + stat->result_mask &= ~(STATX_CTIME|STATX_MTIME); 46 + return; 47 + } 48 + 49 + stat->mtime = inode->i_mtime; 50 + stat->ctime.tv_sec = inode->__i_ctime.tv_sec; 51 + /* 52 + * Atomically set the QUERIED flag and fetch the new value with 53 + * the flag masked off. 54 + */ 55 + stat->ctime.tv_nsec = atomic_long_fetch_or(I_CTIME_QUERIED, pnsec) & 56 + ~I_CTIME_QUERIED; 57 + } 58 + EXPORT_SYMBOL(fill_mg_cmtime); 59 + 60 + /** 30 61 * generic_fillattr - Fill in the basic attributes from the inode struct 31 - * @idmap: idmap of the mount the inode was found from 32 - * @inode: Inode to use as the source 33 - * @stat: Where to fill in the attributes 62 + * @idmap: idmap of the mount the inode was found from 63 + * @request_mask: statx request_mask 64 + * @inode: Inode to use as the source 65 + * @stat: Where to fill in the attributes 34 66 * 35 67 * Fill in the basic attributes in the kstat structure from data that's to be 36 68 * found on the VFS inode structure. This is the default if no getattr inode ··· 74 42 * uid and gid filds. On non-idmapped mounts or if permission checking is to be 75 43 * performed on the raw inode simply passs @nop_mnt_idmap. 76 44 */ 77 - void generic_fillattr(struct mnt_idmap *idmap, struct inode *inode, 78 - struct kstat *stat) 45 + void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask, 46 + struct inode *inode, struct kstat *stat) 79 47 { 80 48 vfsuid_t vfsuid = i_uid_into_vfsuid(idmap, inode); 81 49 vfsgid_t vfsgid = i_gid_into_vfsgid(idmap, inode); ··· 89 57 stat->rdev = inode->i_rdev; 90 58 stat->size = i_size_read(inode); 91 59 stat->atime = inode->i_atime; 92 - stat->mtime = inode->i_mtime; 93 - stat->ctime = inode->i_ctime; 60 + 61 + if (is_mgtime(inode)) { 62 + fill_mg_cmtime(stat, request_mask, inode); 63 + } else { 64 + stat->mtime = inode->i_mtime; 65 + stat->ctime = inode_get_ctime(inode); 66 + } 67 + 94 68 stat->blksize = i_blocksize(inode); 95 69 stat->blocks = inode->i_blocks; 70 + 71 + if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) { 72 + stat->result_mask |= STATX_CHANGE_COOKIE; 73 + stat->change_cookie = inode_query_iversion(inode); 74 + } 75 + 96 76 } 97 77 EXPORT_SYMBOL(generic_fillattr); 98 78 ··· 167 123 stat->attributes_mask |= (STATX_ATTR_AUTOMOUNT | 168 124 STATX_ATTR_DAX); 169 125 170 - if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) { 171 - stat->result_mask |= STATX_CHANGE_COOKIE; 172 - stat->change_cookie = inode_query_iversion(inode); 173 - } 174 - 175 126 idmap = mnt_idmap(path->mnt); 176 127 if (inode->i_op->getattr) 177 128 return inode->i_op->getattr(idmap, path, stat, 178 129 request_mask, query_flags); 179 130 180 - generic_fillattr(idmap, inode, stat); 131 + generic_fillattr(idmap, request_mask, inode, stat); 181 132 return 0; 182 133 } 183 134 EXPORT_SYMBOL(vfs_getattr_nosec);
+3 -3
fs/sysv/dir.c
··· 224 224 memset (de->name + namelen, 0, SYSV_DIRSIZE - namelen - 2); 225 225 de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino); 226 226 dir_commit_chunk(page, pos, SYSV_DIRSIZE); 227 - dir->i_mtime = dir->i_ctime = current_time(dir); 227 + dir->i_mtime = inode_set_ctime_current(dir); 228 228 mark_inode_dirty(dir); 229 229 err = sysv_handle_dirsync(dir); 230 230 out_page: ··· 249 249 } 250 250 de->inode = 0; 251 251 dir_commit_chunk(page, pos, SYSV_DIRSIZE); 252 - inode->i_ctime = inode->i_mtime = current_time(inode); 252 + inode->i_mtime = inode_set_ctime_current(inode); 253 253 mark_inode_dirty(inode); 254 254 return sysv_handle_dirsync(inode); 255 255 } ··· 346 346 } 347 347 de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino); 348 348 dir_commit_chunk(page, pos, SYSV_DIRSIZE); 349 - dir->i_mtime = dir->i_ctime = current_time(dir); 349 + dir->i_mtime = inode_set_ctime_current(dir); 350 350 mark_inode_dirty(dir); 351 351 return sysv_handle_dirsync(inode); 352 352 }
+1 -1
fs/sysv/ialloc.c
··· 165 165 dirty_sb(sb); 166 166 inode_init_owner(&nop_mnt_idmap, inode, dir, mode); 167 167 inode->i_ino = fs16_to_cpu(sbi, ino); 168 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 168 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 169 169 inode->i_blocks = 0; 170 170 memset(SYSV_I(inode)->i_data, 0, sizeof(SYSV_I(inode)->i_data)); 171 171 SYSV_I(inode)->i_dir_start_lookup = 0;
+2 -3
fs/sysv/inode.c
··· 202 202 inode->i_size = fs32_to_cpu(sbi, raw_inode->i_size); 203 203 inode->i_atime.tv_sec = fs32_to_cpu(sbi, raw_inode->i_atime); 204 204 inode->i_mtime.tv_sec = fs32_to_cpu(sbi, raw_inode->i_mtime); 205 - inode->i_ctime.tv_sec = fs32_to_cpu(sbi, raw_inode->i_ctime); 206 - inode->i_ctime.tv_nsec = 0; 205 + inode_set_ctime(inode, fs32_to_cpu(sbi, raw_inode->i_ctime), 0); 207 206 inode->i_atime.tv_nsec = 0; 208 207 inode->i_mtime.tv_nsec = 0; 209 208 inode->i_blocks = 0; ··· 255 256 raw_inode->i_size = cpu_to_fs32(sbi, inode->i_size); 256 257 raw_inode->i_atime = cpu_to_fs32(sbi, inode->i_atime.tv_sec); 257 258 raw_inode->i_mtime = cpu_to_fs32(sbi, inode->i_mtime.tv_sec); 258 - raw_inode->i_ctime = cpu_to_fs32(sbi, inode->i_ctime.tv_sec); 259 + raw_inode->i_ctime = cpu_to_fs32(sbi, inode_get_ctime(inode).tv_sec); 259 260 260 261 si = SYSV_I(inode); 261 262 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
+4 -3
fs/sysv/itree.c
··· 183 183 *where->p = where->key; 184 184 write_unlock(&pointers_lock); 185 185 186 - inode->i_ctime = current_time(inode); 186 + inode_set_ctime_current(inode); 187 187 188 188 /* had we spliced it onto indirect block? */ 189 189 if (where->bh) ··· 423 423 } 424 424 n++; 425 425 } 426 - inode->i_mtime = inode->i_ctime = current_time(inode); 426 + inode->i_mtime = inode_set_ctime_current(inode); 427 427 if (IS_SYNC(inode)) 428 428 sysv_sync_inode (inode); 429 429 else ··· 449 449 struct kstat *stat, u32 request_mask, unsigned int flags) 450 450 { 451 451 struct super_block *s = path->dentry->d_sb; 452 - generic_fillattr(&nop_mnt_idmap, d_inode(path->dentry), stat); 452 + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(path->dentry), 453 + stat); 453 454 stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size); 454 455 stat->blksize = s->s_blocksize; 455 456 return 0;
+3 -3
fs/sysv/namei.c
··· 103 103 { 104 104 struct inode *inode = d_inode(old_dentry); 105 105 106 - inode->i_ctime = current_time(inode); 106 + inode_set_ctime_current(inode); 107 107 inode_inc_link_count(inode); 108 108 ihold(inode); 109 109 ··· 161 161 162 162 err = sysv_delete_entry(de, page); 163 163 if (!err) { 164 - inode->i_ctime = dir->i_ctime; 164 + inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); 165 165 inode_dec_link_count(inode); 166 166 } 167 167 unmap_and_put_page(page, de); ··· 230 230 unmap_and_put_page(new_page, new_de); 231 231 if (err) 232 232 goto out_dir; 233 - new_inode->i_ctime = current_time(new_inode); 233 + inode_set_ctime_current(new_inode); 234 234 if (dir_de) 235 235 drop_nlink(new_inode); 236 236 inode_dec_link_count(new_inode);
+1 -1
fs/tracefs/inode.c
··· 132 132 struct inode *inode = new_inode(sb); 133 133 if (inode) { 134 134 inode->i_ino = get_next_ino(); 135 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 135 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 136 136 } 137 137 return inode; 138 138 }
+2 -2
fs/ubifs/debug.c
··· 243 243 (unsigned int)inode->i_mtime.tv_sec, 244 244 (unsigned int)inode->i_mtime.tv_nsec); 245 245 pr_err("\tctime %u.%u\n", 246 - (unsigned int)inode->i_ctime.tv_sec, 247 - (unsigned int)inode->i_ctime.tv_nsec); 246 + (unsigned int) inode_get_ctime(inode).tv_sec, 247 + (unsigned int) inode_get_ctime(inode).tv_nsec); 248 248 pr_err("\tcreat_sqnum %llu\n", ui->creat_sqnum); 249 249 pr_err("\txattr_size %u\n", ui->xattr_size); 250 250 pr_err("\txattr_cnt %u\n", ui->xattr_cnt);
+15 -26
fs/ubifs/dir.c
··· 96 96 inode->i_flags |= S_NOCMTIME; 97 97 98 98 inode_init_owner(&nop_mnt_idmap, inode, dir, mode); 99 - inode->i_mtime = inode->i_atime = inode->i_ctime = 100 - current_time(inode); 99 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 101 100 inode->i_mapping->nrpages = 0; 102 101 103 102 if (!is_xattr) { ··· 324 325 mutex_lock(&dir_ui->ui_mutex); 325 326 dir->i_size += sz_change; 326 327 dir_ui->ui_size = dir->i_size; 327 - dir->i_mtime = dir->i_ctime = inode->i_ctime; 328 + dir->i_mtime = inode_set_ctime_to_ts(dir, inode_get_ctime(inode)); 328 329 err = ubifs_jnl_update(c, dir, &nm, inode, 0, 0); 329 330 if (err) 330 331 goto out_cancel; ··· 764 765 765 766 inc_nlink(inode); 766 767 ihold(inode); 767 - inode->i_ctime = current_time(inode); 768 + inode_set_ctime_current(inode); 768 769 dir->i_size += sz_change; 769 770 dir_ui->ui_size = dir->i_size; 770 - dir->i_mtime = dir->i_ctime = inode->i_ctime; 771 + dir->i_mtime = inode_set_ctime_to_ts(dir, inode_get_ctime(inode)); 771 772 err = ubifs_jnl_update(c, dir, &nm, inode, 0, 0); 772 773 if (err) 773 774 goto out_cancel; ··· 837 838 } 838 839 839 840 lock_2_inodes(dir, inode); 840 - inode->i_ctime = current_time(dir); 841 + inode_set_ctime_current(inode); 841 842 drop_nlink(inode); 842 843 dir->i_size -= sz_change; 843 844 dir_ui->ui_size = dir->i_size; 844 - dir->i_mtime = dir->i_ctime = inode->i_ctime; 845 + dir->i_mtime = inode_set_ctime_to_ts(dir, inode_get_ctime(inode)); 845 846 err = ubifs_jnl_update(c, dir, &nm, inode, 1, 0); 846 847 if (err) 847 848 goto out_cancel; ··· 939 940 } 940 941 941 942 lock_2_inodes(dir, inode); 942 - inode->i_ctime = current_time(dir); 943 + inode_set_ctime_current(inode); 943 944 clear_nlink(inode); 944 945 drop_nlink(dir); 945 946 dir->i_size -= sz_change; 946 947 dir_ui->ui_size = dir->i_size; 947 - dir->i_mtime = dir->i_ctime = inode->i_ctime; 948 + dir->i_mtime = inode_set_ctime_to_ts(dir, inode_get_ctime(inode)); 948 949 err = ubifs_jnl_update(c, dir, &nm, inode, 1, 0); 949 950 if (err) 950 951 goto out_cancel; ··· 1018 1019 inc_nlink(dir); 1019 1020 dir->i_size += sz_change; 1020 1021 dir_ui->ui_size = dir->i_size; 1021 - dir->i_mtime = dir->i_ctime = inode->i_ctime; 1022 + dir->i_mtime = inode_set_ctime_to_ts(dir, inode_get_ctime(inode)); 1022 1023 err = ubifs_jnl_update(c, dir, &nm, inode, 0, 0); 1023 1024 if (err) { 1024 1025 ubifs_err(c, "cannot create directory, error %d", err); ··· 1109 1110 mutex_lock(&dir_ui->ui_mutex); 1110 1111 dir->i_size += sz_change; 1111 1112 dir_ui->ui_size = dir->i_size; 1112 - dir->i_mtime = dir->i_ctime = inode->i_ctime; 1113 + dir->i_mtime = inode_set_ctime_to_ts(dir, inode_get_ctime(inode)); 1113 1114 err = ubifs_jnl_update(c, dir, &nm, inode, 0, 0); 1114 1115 if (err) 1115 1116 goto out_cancel; ··· 1209 1210 mutex_lock(&dir_ui->ui_mutex); 1210 1211 dir->i_size += sz_change; 1211 1212 dir_ui->ui_size = dir->i_size; 1212 - dir->i_mtime = dir->i_ctime = inode->i_ctime; 1213 + dir->i_mtime = inode_set_ctime_to_ts(dir, inode_get_ctime(inode)); 1213 1214 err = ubifs_jnl_update(c, dir, &nm, inode, 0, 0); 1214 1215 if (err) 1215 1216 goto out_cancel; ··· 1297 1298 struct ubifs_budget_req ino_req = { .dirtied_ino = 1, 1298 1299 .dirtied_ino_d = ALIGN(old_inode_ui->data_len, 8) }; 1299 1300 struct ubifs_budget_req wht_req; 1300 - struct timespec64 time; 1301 1301 unsigned int saved_nlink; 1302 1302 struct fscrypt_name old_nm, new_nm; 1303 1303 ··· 1412 1414 * Like most other Unix systems, set the @i_ctime for inodes on a 1413 1415 * rename. 1414 1416 */ 1415 - time = current_time(old_dir); 1416 - old_inode->i_ctime = time; 1417 + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); 1417 1418 1418 1419 /* We must adjust parent link count when renaming directories */ 1419 1420 if (is_dir) { ··· 1441 1444 1442 1445 old_dir->i_size -= old_sz; 1443 1446 ubifs_inode(old_dir)->ui_size = old_dir->i_size; 1444 - old_dir->i_mtime = old_dir->i_ctime = time; 1445 - new_dir->i_mtime = new_dir->i_ctime = time; 1446 1447 1447 1448 /* 1448 1449 * And finally, if we unlinked a direntry which happened to have the 1449 1450 * same name as the moved direntry, we have to decrement @i_nlink of 1450 - * the unlinked inode and change its ctime. 1451 + * the unlinked inode. 1451 1452 */ 1452 1453 if (unlink) { 1453 1454 /* ··· 1457 1462 clear_nlink(new_inode); 1458 1463 else 1459 1464 drop_nlink(new_inode); 1460 - new_inode->i_ctime = time; 1461 1465 } else { 1462 1466 new_dir->i_size += new_sz; 1463 1467 ubifs_inode(new_dir)->ui_size = new_dir->i_size; ··· 1551 1557 int sync = IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir); 1552 1558 struct inode *fst_inode = d_inode(old_dentry); 1553 1559 struct inode *snd_inode = d_inode(new_dentry); 1554 - struct timespec64 time; 1555 1560 int err; 1556 1561 struct fscrypt_name fst_nm, snd_nm; 1557 1562 ··· 1581 1588 1582 1589 lock_4_inodes(old_dir, new_dir, NULL, NULL); 1583 1590 1584 - time = current_time(old_dir); 1585 - fst_inode->i_ctime = time; 1586 - snd_inode->i_ctime = time; 1587 - old_dir->i_mtime = old_dir->i_ctime = time; 1588 - new_dir->i_mtime = new_dir->i_ctime = time; 1591 + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); 1589 1592 1590 1593 if (old_dir != new_dir) { 1591 1594 if (S_ISDIR(fst_inode->i_mode) && !S_ISDIR(snd_inode->i_mode)) { ··· 1654 1665 STATX_ATTR_ENCRYPTED | 1655 1666 STATX_ATTR_IMMUTABLE); 1656 1667 1657 - generic_fillattr(&nop_mnt_idmap, inode, stat); 1668 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 1658 1669 stat->blksize = UBIFS_BLOCK_SIZE; 1659 1670 stat->size = ui->ui_size; 1660 1671
+14 -17
fs/ubifs/file.c
··· 1092 1092 if (attr->ia_valid & ATTR_MTIME) 1093 1093 inode->i_mtime = attr->ia_mtime; 1094 1094 if (attr->ia_valid & ATTR_CTIME) 1095 - inode->i_ctime = attr->ia_ctime; 1095 + inode_set_ctime_to_ts(inode, attr->ia_ctime); 1096 1096 if (attr->ia_valid & ATTR_MODE) { 1097 1097 umode_t mode = attr->ia_mode; 1098 1098 ··· 1192 1192 mutex_lock(&ui->ui_mutex); 1193 1193 ui->ui_size = inode->i_size; 1194 1194 /* Truncation changes inode [mc]time */ 1195 - inode->i_mtime = inode->i_ctime = current_time(inode); 1195 + inode->i_mtime = inode_set_ctime_current(inode); 1196 1196 /* Other attributes may be changed at the same time as well */ 1197 1197 do_attr_changes(inode, attr); 1198 1198 err = ubifs_jnl_truncate(c, inode, old_size, new_size); ··· 1239 1239 mutex_lock(&ui->ui_mutex); 1240 1240 if (attr->ia_valid & ATTR_SIZE) { 1241 1241 /* Truncation changes inode [mc]time */ 1242 - inode->i_mtime = inode->i_ctime = current_time(inode); 1242 + inode->i_mtime = inode_set_ctime_current(inode); 1243 1243 /* 'truncate_setsize()' changed @i_size, update @ui_size */ 1244 1244 ui->ui_size = inode->i_size; 1245 1245 } ··· 1364 1364 static inline int mctime_update_needed(const struct inode *inode, 1365 1365 const struct timespec64 *now) 1366 1366 { 1367 + struct timespec64 ctime = inode_get_ctime(inode); 1368 + 1367 1369 if (!timespec64_equal(&inode->i_mtime, now) || 1368 - !timespec64_equal(&inode->i_ctime, now)) 1370 + !timespec64_equal(&ctime, now)) 1369 1371 return 1; 1370 1372 return 0; 1371 1373 } ··· 1378 1376 * 1379 1377 * This function updates time of the inode. 1380 1378 */ 1381 - int ubifs_update_time(struct inode *inode, struct timespec64 *time, 1382 - int flags) 1379 + int ubifs_update_time(struct inode *inode, int flags) 1383 1380 { 1384 1381 struct ubifs_inode *ui = ubifs_inode(inode); 1385 1382 struct ubifs_info *c = inode->i_sb->s_fs_info; ··· 1386 1385 .dirtied_ino_d = ALIGN(ui->data_len, 8) }; 1387 1386 int err, release; 1388 1387 1389 - if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT)) 1390 - return generic_update_time(inode, time, flags); 1388 + if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT)) { 1389 + generic_update_time(inode, flags); 1390 + return 0; 1391 + } 1391 1392 1392 1393 err = ubifs_budget_space(c, &req); 1393 1394 if (err) 1394 1395 return err; 1395 1396 1396 1397 mutex_lock(&ui->ui_mutex); 1397 - if (flags & S_ATIME) 1398 - inode->i_atime = *time; 1399 - if (flags & S_CTIME) 1400 - inode->i_ctime = *time; 1401 - if (flags & S_MTIME) 1402 - inode->i_mtime = *time; 1403 - 1398 + inode_update_timestamps(inode, flags); 1404 1399 release = ui->dirty; 1405 1400 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1406 1401 mutex_unlock(&ui->ui_mutex); ··· 1429 1432 return err; 1430 1433 1431 1434 mutex_lock(&ui->ui_mutex); 1432 - inode->i_mtime = inode->i_ctime = current_time(inode); 1435 + inode->i_mtime = inode_set_ctime_current(inode); 1433 1436 release = ui->dirty; 1434 1437 mark_inode_dirty_sync(inode); 1435 1438 mutex_unlock(&ui->ui_mutex); ··· 1567 1570 struct ubifs_inode *ui = ubifs_inode(inode); 1568 1571 1569 1572 mutex_lock(&ui->ui_mutex); 1570 - inode->i_mtime = inode->i_ctime = current_time(inode); 1573 + inode->i_mtime = inode_set_ctime_current(inode); 1571 1574 release = ui->dirty; 1572 1575 mark_inode_dirty_sync(inode); 1573 1576 mutex_unlock(&ui->ui_mutex);
+1 -1
fs/ubifs/ioctl.c
··· 118 118 ui->flags &= ~ioctl2ubifs(UBIFS_SETTABLE_IOCTL_FLAGS); 119 119 ui->flags |= ioctl2ubifs(flags); 120 120 ubifs_set_inode_flags(inode); 121 - inode->i_ctime = current_time(inode); 121 + inode_set_ctime_current(inode); 122 122 release = ui->dirty; 123 123 mark_inode_dirty_sync(inode); 124 124 mutex_unlock(&ui->ui_mutex);
+2 -2
fs/ubifs/journal.c
··· 454 454 ino->creat_sqnum = cpu_to_le64(ui->creat_sqnum); 455 455 ino->atime_sec = cpu_to_le64(inode->i_atime.tv_sec); 456 456 ino->atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); 457 - ino->ctime_sec = cpu_to_le64(inode->i_ctime.tv_sec); 458 - ino->ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 457 + ino->ctime_sec = cpu_to_le64(inode_get_ctime(inode).tv_sec); 458 + ino->ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec); 459 459 ino->mtime_sec = cpu_to_le64(inode->i_mtime.tv_sec); 460 460 ino->mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); 461 461 ino->uid = cpu_to_le32(i_uid_read(inode));
+2 -2
fs/ubifs/super.c
··· 146 146 inode->i_atime.tv_nsec = le32_to_cpu(ino->atime_nsec); 147 147 inode->i_mtime.tv_sec = (int64_t)le64_to_cpu(ino->mtime_sec); 148 148 inode->i_mtime.tv_nsec = le32_to_cpu(ino->mtime_nsec); 149 - inode->i_ctime.tv_sec = (int64_t)le64_to_cpu(ino->ctime_sec); 150 - inode->i_ctime.tv_nsec = le32_to_cpu(ino->ctime_nsec); 149 + inode_set_ctime(inode, (int64_t)le64_to_cpu(ino->ctime_sec), 150 + le32_to_cpu(ino->ctime_nsec)); 151 151 inode->i_mode = le32_to_cpu(ino->mode); 152 152 inode->i_size = le64_to_cpu(ino->size); 153 153
+1 -1
fs/ubifs/ubifs.h
··· 2027 2027 int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync); 2028 2028 int ubifs_setattr(struct mnt_idmap *idmap, struct dentry *dentry, 2029 2029 struct iattr *attr); 2030 - int ubifs_update_time(struct inode *inode, struct timespec64 *time, int flags); 2030 + int ubifs_update_time(struct inode *inode, int flags); 2031 2031 2032 2032 /* dir.c */ 2033 2033 struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
+3 -3
fs/ubifs/xattr.c
··· 134 134 ui->data_len = size; 135 135 136 136 mutex_lock(&host_ui->ui_mutex); 137 - host->i_ctime = current_time(host); 137 + inode_set_ctime_current(host); 138 138 host_ui->xattr_cnt += 1; 139 139 host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm)); 140 140 host_ui->xattr_size += CALC_XATTR_BYTES(size); ··· 215 215 ui->data_len = size; 216 216 217 217 mutex_lock(&host_ui->ui_mutex); 218 - host->i_ctime = current_time(host); 218 + inode_set_ctime_current(host); 219 219 host_ui->xattr_size -= CALC_XATTR_BYTES(old_size); 220 220 host_ui->xattr_size += CALC_XATTR_BYTES(size); 221 221 ··· 474 474 return err; 475 475 476 476 mutex_lock(&host_ui->ui_mutex); 477 - host->i_ctime = current_time(host); 477 + inode_set_ctime_current(host); 478 478 host_ui->xattr_cnt -= 1; 479 479 host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm)); 480 480 host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
+1 -1
fs/udf/ialloc.c
··· 100 100 iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; 101 101 else 102 102 iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; 103 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 103 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 104 104 iinfo->i_crtime = inode->i_mtime; 105 105 if (unlikely(insert_inode_locked(inode) < 0)) { 106 106 make_bad_inode(inode);
+10 -7
fs/udf/inode.c
··· 910 910 map->oflags = UDF_BLK_NEW | UDF_BLK_MAPPED; 911 911 iinfo->i_next_alloc_block = map->lblk + 1; 912 912 iinfo->i_next_alloc_goal = newblocknum + 1; 913 - inode->i_ctime = current_time(inode); 913 + inode_set_ctime_current(inode); 914 914 915 915 if (IS_SYNC(inode)) 916 916 udf_sync_inode(inode); ··· 1298 1298 goto out_unlock; 1299 1299 } 1300 1300 update_time: 1301 - inode->i_mtime = inode->i_ctime = current_time(inode); 1301 + inode->i_mtime = inode_set_ctime_current(inode); 1302 1302 if (IS_SYNC(inode)) 1303 1303 udf_sync_inode(inode); 1304 1304 else ··· 1329 1329 int bs = inode->i_sb->s_blocksize; 1330 1330 int ret = -EIO; 1331 1331 uint32_t uid, gid; 1332 + struct timespec64 ctime; 1332 1333 1333 1334 reread: 1334 1335 if (iloc->partitionReferenceNum >= sbi->s_partitions) { ··· 1508 1507 1509 1508 udf_disk_stamp_to_time(&inode->i_atime, fe->accessTime); 1510 1509 udf_disk_stamp_to_time(&inode->i_mtime, fe->modificationTime); 1511 - udf_disk_stamp_to_time(&inode->i_ctime, fe->attrTime); 1510 + udf_disk_stamp_to_time(&ctime, fe->attrTime); 1511 + inode_set_ctime_to_ts(inode, ctime); 1512 1512 1513 1513 iinfo->i_unique = le64_to_cpu(fe->uniqueID); 1514 1514 iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); ··· 1524 1522 udf_disk_stamp_to_time(&inode->i_atime, efe->accessTime); 1525 1523 udf_disk_stamp_to_time(&inode->i_mtime, efe->modificationTime); 1526 1524 udf_disk_stamp_to_time(&iinfo->i_crtime, efe->createTime); 1527 - udf_disk_stamp_to_time(&inode->i_ctime, efe->attrTime); 1525 + udf_disk_stamp_to_time(&ctime, efe->attrTime); 1526 + inode_set_ctime_to_ts(inode, ctime); 1528 1527 1529 1528 iinfo->i_unique = le64_to_cpu(efe->uniqueID); 1530 1529 iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); ··· 1802 1799 1803 1800 udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime); 1804 1801 udf_time_to_disk_stamp(&fe->modificationTime, inode->i_mtime); 1805 - udf_time_to_disk_stamp(&fe->attrTime, inode->i_ctime); 1802 + udf_time_to_disk_stamp(&fe->attrTime, inode_get_ctime(inode)); 1806 1803 memset(&(fe->impIdent), 0, sizeof(struct regid)); 1807 1804 strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); 1808 1805 fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; ··· 1833 1830 1834 1831 udf_adjust_time(iinfo, inode->i_atime); 1835 1832 udf_adjust_time(iinfo, inode->i_mtime); 1836 - udf_adjust_time(iinfo, inode->i_ctime); 1833 + udf_adjust_time(iinfo, inode_get_ctime(inode)); 1837 1834 1838 1835 udf_time_to_disk_stamp(&efe->accessTime, inode->i_atime); 1839 1836 udf_time_to_disk_stamp(&efe->modificationTime, inode->i_mtime); 1840 1837 udf_time_to_disk_stamp(&efe->createTime, iinfo->i_crtime); 1841 - udf_time_to_disk_stamp(&efe->attrTime, inode->i_ctime); 1838 + udf_time_to_disk_stamp(&efe->attrTime, inode_get_ctime(inode)); 1842 1839 1843 1840 memset(&(efe->impIdent), 0, sizeof(efe->impIdent)); 1844 1841 strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER);
+12 -12
fs/udf/namei.c
··· 365 365 *(__le32 *)((struct allocDescImpUse *)iter.fi.icb.impUse)->impUse = 366 366 cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL); 367 367 udf_fiiter_write_fi(&iter, NULL); 368 - dir->i_ctime = dir->i_mtime = current_time(dir); 368 + dir->i_mtime = inode_set_ctime_current(dir); 369 369 mark_inode_dirty(dir); 370 370 udf_fiiter_release(&iter); 371 371 udf_add_fid_counter(dir->i_sb, false, 1); ··· 471 471 udf_fiiter_release(&iter); 472 472 udf_add_fid_counter(dir->i_sb, true, 1); 473 473 inc_nlink(dir); 474 - dir->i_ctime = dir->i_mtime = current_time(dir); 474 + dir->i_mtime = inode_set_ctime_current(dir); 475 475 mark_inode_dirty(dir); 476 476 d_instantiate_new(dentry, inode); 477 477 ··· 523 523 inode->i_size = 0; 524 524 inode_dec_link_count(dir); 525 525 udf_add_fid_counter(dir->i_sb, true, -1); 526 - inode->i_ctime = dir->i_ctime = dir->i_mtime = 527 - current_time(inode); 526 + dir->i_mtime = inode_set_ctime_to_ts(dir, 527 + inode_set_ctime_current(inode)); 528 528 mark_inode_dirty(dir); 529 529 ret = 0; 530 530 end_rmdir: ··· 555 555 set_nlink(inode, 1); 556 556 } 557 557 udf_fiiter_delete_entry(&iter); 558 - dir->i_ctime = dir->i_mtime = current_time(dir); 558 + dir->i_mtime = inode_set_ctime_current(dir); 559 559 mark_inode_dirty(dir); 560 560 inode_dec_link_count(inode); 561 561 udf_add_fid_counter(dir->i_sb, false, -1); 562 - inode->i_ctime = dir->i_ctime; 562 + inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); 563 563 ret = 0; 564 564 end_unlink: 565 565 udf_fiiter_release(&iter); ··· 746 746 747 747 inc_nlink(inode); 748 748 udf_add_fid_counter(dir->i_sb, false, 1); 749 - inode->i_ctime = current_time(inode); 749 + inode_set_ctime_current(inode); 750 750 mark_inode_dirty(inode); 751 - dir->i_ctime = dir->i_mtime = current_time(dir); 751 + dir->i_mtime = inode_set_ctime_current(dir); 752 752 mark_inode_dirty(dir); 753 753 ihold(inode); 754 754 d_instantiate(dentry, inode); ··· 833 833 * Like most other Unix systems, set the ctime for inodes on a 834 834 * rename. 835 835 */ 836 - old_inode->i_ctime = current_time(old_inode); 836 + inode_set_ctime_current(old_inode); 837 837 mark_inode_dirty(old_inode); 838 838 839 839 /* ··· 861 861 } 862 862 863 863 if (new_inode) { 864 - new_inode->i_ctime = current_time(new_inode); 864 + inode_set_ctime_current(new_inode); 865 865 inode_dec_link_count(new_inode); 866 866 udf_add_fid_counter(old_dir->i_sb, S_ISDIR(new_inode->i_mode), 867 867 -1); 868 868 } 869 - old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); 870 - new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir); 869 + old_dir->i_mtime = inode_set_ctime_current(old_dir); 870 + new_dir->i_mtime = inode_set_ctime_current(new_dir); 871 871 mark_inode_dirty(old_dir); 872 872 mark_inode_dirty(new_dir); 873 873
+1 -1
fs/udf/symlink.c
··· 149 149 struct inode *inode = d_backing_inode(dentry); 150 150 struct page *page; 151 151 152 - generic_fillattr(&nop_mnt_idmap, inode, stat); 152 + generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); 153 153 page = read_mapping_page(inode->i_mapping, 0, NULL); 154 154 if (IS_ERR(page)) 155 155 return PTR_ERR(page);
+3 -3
fs/ufs/dir.c
··· 107 107 ufs_commit_chunk(page, pos, len); 108 108 ufs_put_page(page); 109 109 if (update_times) 110 - dir->i_mtime = dir->i_ctime = current_time(dir); 110 + dir->i_mtime = inode_set_ctime_current(dir); 111 111 mark_inode_dirty(dir); 112 112 ufs_handle_dirsync(dir); 113 113 } ··· 397 397 ufs_set_de_type(sb, de, inode->i_mode); 398 398 399 399 ufs_commit_chunk(page, pos, rec_len); 400 - dir->i_mtime = dir->i_ctime = current_time(dir); 400 + dir->i_mtime = inode_set_ctime_current(dir); 401 401 402 402 mark_inode_dirty(dir); 403 403 err = ufs_handle_dirsync(dir); ··· 539 539 pde->d_reclen = cpu_to_fs16(sb, to - from); 540 540 dir->d_ino = 0; 541 541 ufs_commit_chunk(page, pos, to - from); 542 - inode->i_ctime = inode->i_mtime = current_time(inode); 542 + inode->i_mtime = inode_set_ctime_current(inode); 543 543 mark_inode_dirty(inode); 544 544 err = ufs_handle_dirsync(inode); 545 545 out:
+1 -1
fs/ufs/ialloc.c
··· 292 292 inode_init_owner(&nop_mnt_idmap, inode, dir, mode); 293 293 inode->i_blocks = 0; 294 294 inode->i_generation = 0; 295 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 295 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 296 296 ufsi->i_flags = UFS_I(dir)->i_flags; 297 297 ufsi->i_lastfrag = 0; 298 298 ufsi->i_shadow = 0;
+13 -10
fs/ufs/inode.c
··· 296 296 297 297 if (new) 298 298 *new = 1; 299 - inode->i_ctime = current_time(inode); 299 + inode_set_ctime_current(inode); 300 300 if (IS_SYNC(inode)) 301 301 ufs_sync_inode (inode); 302 302 mark_inode_dirty(inode); ··· 378 378 mark_buffer_dirty(bh); 379 379 if (IS_SYNC(inode)) 380 380 sync_dirty_buffer(bh); 381 - inode->i_ctime = current_time(inode); 381 + inode_set_ctime_current(inode); 382 382 mark_inode_dirty(inode); 383 383 out: 384 384 brelse (bh); ··· 580 580 581 581 inode->i_size = fs64_to_cpu(sb, ufs_inode->ui_size); 582 582 inode->i_atime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_atime.tv_sec); 583 - inode->i_ctime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_ctime.tv_sec); 583 + inode_set_ctime(inode, 584 + (signed)fs32_to_cpu(sb, ufs_inode->ui_ctime.tv_sec), 585 + 0); 584 586 inode->i_mtime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_mtime.tv_sec); 585 587 inode->i_mtime.tv_nsec = 0; 586 588 inode->i_atime.tv_nsec = 0; 587 - inode->i_ctime.tv_nsec = 0; 588 589 inode->i_blocks = fs32_to_cpu(sb, ufs_inode->ui_blocks); 589 590 inode->i_generation = fs32_to_cpu(sb, ufs_inode->ui_gen); 590 591 ufsi->i_flags = fs32_to_cpu(sb, ufs_inode->ui_flags); ··· 627 626 628 627 inode->i_size = fs64_to_cpu(sb, ufs2_inode->ui_size); 629 628 inode->i_atime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_atime); 630 - inode->i_ctime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_ctime); 629 + inode_set_ctime(inode, fs64_to_cpu(sb, ufs2_inode->ui_ctime), 630 + fs32_to_cpu(sb, ufs2_inode->ui_ctimensec)); 631 631 inode->i_mtime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_mtime); 632 632 inode->i_atime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_atimensec); 633 - inode->i_ctime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_ctimensec); 634 633 inode->i_mtime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_mtimensec); 635 634 inode->i_blocks = fs64_to_cpu(sb, ufs2_inode->ui_blocks); 636 635 inode->i_generation = fs32_to_cpu(sb, ufs2_inode->ui_gen); ··· 727 726 ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); 728 727 ufs_inode->ui_atime.tv_sec = cpu_to_fs32(sb, inode->i_atime.tv_sec); 729 728 ufs_inode->ui_atime.tv_usec = 0; 730 - ufs_inode->ui_ctime.tv_sec = cpu_to_fs32(sb, inode->i_ctime.tv_sec); 729 + ufs_inode->ui_ctime.tv_sec = cpu_to_fs32(sb, 730 + inode_get_ctime(inode).tv_sec); 731 731 ufs_inode->ui_ctime.tv_usec = 0; 732 732 ufs_inode->ui_mtime.tv_sec = cpu_to_fs32(sb, inode->i_mtime.tv_sec); 733 733 ufs_inode->ui_mtime.tv_usec = 0; ··· 772 770 ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); 773 771 ufs_inode->ui_atime = cpu_to_fs64(sb, inode->i_atime.tv_sec); 774 772 ufs_inode->ui_atimensec = cpu_to_fs32(sb, inode->i_atime.tv_nsec); 775 - ufs_inode->ui_ctime = cpu_to_fs64(sb, inode->i_ctime.tv_sec); 776 - ufs_inode->ui_ctimensec = cpu_to_fs32(sb, inode->i_ctime.tv_nsec); 773 + ufs_inode->ui_ctime = cpu_to_fs64(sb, inode_get_ctime(inode).tv_sec); 774 + ufs_inode->ui_ctimensec = cpu_to_fs32(sb, 775 + inode_get_ctime(inode).tv_nsec); 777 776 ufs_inode->ui_mtime = cpu_to_fs64(sb, inode->i_mtime.tv_sec); 778 777 ufs_inode->ui_mtimensec = cpu_to_fs32(sb, inode->i_mtime.tv_nsec); 779 778 ··· 1208 1205 truncate_setsize(inode, size); 1209 1206 1210 1207 ufs_truncate_blocks(inode); 1211 - inode->i_mtime = inode->i_ctime = current_time(inode); 1208 + inode->i_mtime = inode_set_ctime_current(inode); 1212 1209 mark_inode_dirty(inode); 1213 1210 out: 1214 1211 UFSD("EXIT: err %d\n", err);
+4 -4
fs/ufs/namei.c
··· 153 153 struct inode *inode = d_inode(old_dentry); 154 154 int error; 155 155 156 - inode->i_ctime = current_time(inode); 156 + inode_set_ctime_current(inode); 157 157 inode_inc_link_count(inode); 158 158 ihold(inode); 159 159 ··· 220 220 if (err) 221 221 goto out; 222 222 223 - inode->i_ctime = dir->i_ctime; 223 + inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); 224 224 inode_dec_link_count(inode); 225 225 err = 0; 226 226 out: ··· 282 282 if (!new_de) 283 283 goto out_dir; 284 284 ufs_set_link(new_dir, new_de, new_page, old_inode, 1); 285 - new_inode->i_ctime = current_time(new_inode); 285 + inode_set_ctime_current(new_inode); 286 286 if (dir_de) 287 287 drop_nlink(new_inode); 288 288 inode_dec_link_count(new_inode); ··· 298 298 * Like most other Unix systems, set the ctime for inodes on a 299 299 * rename. 300 300 */ 301 - old_inode->i_ctime = current_time(old_inode); 301 + inode_set_ctime_current(old_inode); 302 302 303 303 ufs_delete_entry(old_dir, old_de, old_page); 304 304 mark_inode_dirty(old_inode);
+3 -3
fs/vboxsf/utils.c
··· 128 128 129 129 inode->i_atime = ns_to_timespec64( 130 130 info->access_time.ns_relative_to_unix_epoch); 131 - inode->i_ctime = ns_to_timespec64( 132 - info->change_time.ns_relative_to_unix_epoch); 131 + inode_set_ctime_to_ts(inode, 132 + ns_to_timespec64(info->change_time.ns_relative_to_unix_epoch)); 133 133 inode->i_mtime = ns_to_timespec64( 134 134 info->modification_time.ns_relative_to_unix_epoch); 135 135 return 0; ··· 252 252 if (err) 253 253 return err; 254 254 255 - generic_fillattr(&nop_mnt_idmap, d_inode(dentry), kstat); 255 + generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), kstat); 256 256 return 0; 257 257 } 258 258
+3 -2
fs/xfs/libxfs/xfs_inode_buf.c
··· 222 222 */ 223 223 inode->i_atime = xfs_inode_from_disk_ts(from, from->di_atime); 224 224 inode->i_mtime = xfs_inode_from_disk_ts(from, from->di_mtime); 225 - inode->i_ctime = xfs_inode_from_disk_ts(from, from->di_ctime); 225 + inode_set_ctime_to_ts(inode, 226 + xfs_inode_from_disk_ts(from, from->di_ctime)); 226 227 227 228 ip->i_disk_size = be64_to_cpu(from->di_size); 228 229 ip->i_nblocks = be64_to_cpu(from->di_nblocks); ··· 317 316 318 317 to->di_atime = xfs_inode_to_disk_ts(ip, inode->i_atime); 319 318 to->di_mtime = xfs_inode_to_disk_ts(ip, inode->i_mtime); 320 - to->di_ctime = xfs_inode_to_disk_ts(ip, inode->i_ctime); 319 + to->di_ctime = xfs_inode_to_disk_ts(ip, inode_get_ctime(inode)); 321 320 to->di_nlink = cpu_to_be32(inode->i_nlink); 322 321 to->di_gen = cpu_to_be32(inode->i_generation); 323 322 to->di_mode = cpu_to_be16(inode->i_mode);
+3 -3
fs/xfs/libxfs/xfs_trans_inode.c
··· 62 62 ASSERT(tp); 63 63 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); 64 64 65 - tv = current_time(inode); 65 + /* If the mtime changes, then ctime must also change */ 66 + ASSERT(flags & XFS_ICHGTIME_CHG); 66 67 68 + tv = inode_set_ctime_current(inode); 67 69 if (flags & XFS_ICHGTIME_MOD) 68 70 inode->i_mtime = tv; 69 - if (flags & XFS_ICHGTIME_CHG) 70 - inode->i_ctime = tv; 71 71 if (flags & XFS_ICHGTIME_CREATE) 72 72 ip->i_crtime = tv; 73 73 }
+1 -1
fs/xfs/xfs_acl.c
··· 233 233 xfs_ilock(ip, XFS_ILOCK_EXCL); 234 234 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); 235 235 inode->i_mode = mode; 236 - inode->i_ctime = current_time(inode); 236 + inode_set_ctime_current(inode); 237 237 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); 238 238 239 239 if (xfs_has_wsync(mp))
+4 -2
fs/xfs/xfs_bmap_util.c
··· 1644 1644 uint64_t f; 1645 1645 int resblks = 0; 1646 1646 unsigned int flags = 0; 1647 + struct timespec64 ctime; 1647 1648 1648 1649 /* 1649 1650 * Lock the inodes against other IO, page faults and truncate to ··· 1757 1756 * process that the file was not changed out from 1758 1757 * under it. 1759 1758 */ 1760 - if ((sbp->bs_ctime.tv_sec != VFS_I(ip)->i_ctime.tv_sec) || 1761 - (sbp->bs_ctime.tv_nsec != VFS_I(ip)->i_ctime.tv_nsec) || 1759 + ctime = inode_get_ctime(VFS_I(ip)); 1760 + if ((sbp->bs_ctime.tv_sec != ctime.tv_sec) || 1761 + (sbp->bs_ctime.tv_nsec != ctime.tv_nsec) || 1762 1762 (sbp->bs_mtime.tv_sec != VFS_I(ip)->i_mtime.tv_sec) || 1763 1763 (sbp->bs_mtime.tv_nsec != VFS_I(ip)->i_mtime.tv_nsec)) { 1764 1764 error = -EBUSY;
+1 -2
fs/xfs/xfs_inode.c
··· 843 843 ip->i_df.if_nextents = 0; 844 844 ASSERT(ip->i_nblocks == 0); 845 845 846 - tv = current_time(inode); 846 + tv = inode_set_ctime_current(inode); 847 847 inode->i_mtime = tv; 848 848 inode->i_atime = tv; 849 - inode->i_ctime = tv; 850 849 851 850 ip->i_extsize = 0; 852 851 ip->i_diflags = 0;
+1 -1
fs/xfs/xfs_inode_item.c
··· 528 528 memset(to->di_pad3, 0, sizeof(to->di_pad3)); 529 529 to->di_atime = xfs_inode_to_log_dinode_ts(ip, inode->i_atime); 530 530 to->di_mtime = xfs_inode_to_log_dinode_ts(ip, inode->i_mtime); 531 - to->di_ctime = xfs_inode_to_log_dinode_ts(ip, inode->i_ctime); 531 + to->di_ctime = xfs_inode_to_log_dinode_ts(ip, inode_get_ctime(inode)); 532 532 to->di_nlink = inode->i_nlink; 533 533 to->di_gen = inode->i_generation; 534 534 to->di_mode = inode->i_mode;
+15 -10
fs/xfs/xfs_iops.c
··· 573 573 stat->gid = vfsgid_into_kgid(vfsgid); 574 574 stat->ino = ip->i_ino; 575 575 stat->atime = inode->i_atime; 576 - stat->mtime = inode->i_mtime; 577 - stat->ctime = inode->i_ctime; 578 576 stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks); 577 + 578 + fill_mg_cmtime(stat, request_mask, inode); 579 579 580 580 if (xfs_has_v3inodes(mp)) { 581 581 if (request_mask & STATX_BTIME) { ··· 917 917 if (newsize != oldsize && 918 918 !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) { 919 919 iattr->ia_ctime = iattr->ia_mtime = 920 - current_time(inode); 920 + current_mgtime(inode); 921 921 iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME; 922 922 } 923 923 ··· 1029 1029 STATIC int 1030 1030 xfs_vn_update_time( 1031 1031 struct inode *inode, 1032 - struct timespec64 *now, 1033 1032 int flags) 1034 1033 { 1035 1034 struct xfs_inode *ip = XFS_I(inode); ··· 1036 1037 int log_flags = XFS_ILOG_TIMESTAMP; 1037 1038 struct xfs_trans *tp; 1038 1039 int error; 1040 + struct timespec64 now; 1039 1041 1040 1042 trace_xfs_update_time(ip); 1041 1043 1042 1044 if (inode->i_sb->s_flags & SB_LAZYTIME) { 1043 1045 if (!((flags & S_VERSION) && 1044 - inode_maybe_inc_iversion(inode, false))) 1045 - return generic_update_time(inode, now, flags); 1046 + inode_maybe_inc_iversion(inode, false))) { 1047 + generic_update_time(inode, flags); 1048 + return 0; 1049 + } 1046 1050 1047 1051 /* Capture the iversion update that just occurred */ 1048 1052 log_flags |= XFS_ILOG_CORE; ··· 1056 1054 return error; 1057 1055 1058 1056 xfs_ilock(ip, XFS_ILOCK_EXCL); 1059 - if (flags & S_CTIME) 1060 - inode->i_ctime = *now; 1057 + if (flags & (S_CTIME|S_MTIME)) 1058 + now = inode_set_ctime_current(inode); 1059 + else 1060 + now = current_time(inode); 1061 + 1061 1062 if (flags & S_MTIME) 1062 - inode->i_mtime = *now; 1063 + inode->i_mtime = now; 1063 1064 if (flags & S_ATIME) 1064 - inode->i_atime = *now; 1065 + inode->i_atime = now; 1065 1066 1066 1067 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); 1067 1068 xfs_trans_log_inode(tp, ip, log_flags);
+2 -2
fs/xfs/xfs_itable.c
··· 100 100 buf->bs_atime_nsec = inode->i_atime.tv_nsec; 101 101 buf->bs_mtime = inode->i_mtime.tv_sec; 102 102 buf->bs_mtime_nsec = inode->i_mtime.tv_nsec; 103 - buf->bs_ctime = inode->i_ctime.tv_sec; 104 - buf->bs_ctime_nsec = inode->i_ctime.tv_nsec; 103 + buf->bs_ctime = inode_get_ctime(inode).tv_sec; 104 + buf->bs_ctime_nsec = inode_get_ctime(inode).tv_nsec; 105 105 buf->bs_gen = inode->i_generation; 106 106 buf->bs_mode = inode->i_mode; 107 107
+1 -1
fs/xfs/xfs_super.c
··· 2009 2009 .init_fs_context = xfs_init_fs_context, 2010 2010 .parameters = xfs_fs_parameters, 2011 2011 .kill_sb = kill_block_super, 2012 - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, 2012 + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME, 2013 2013 }; 2014 2014 MODULE_ALIAS_FS("xfs"); 2015 2015
+5 -3
fs/zonefs/super.c
··· 658 658 659 659 inode->i_ino = ino; 660 660 inode->i_mode = z->z_mode; 661 - inode->i_ctime = inode->i_mtime = inode->i_atime = dir->i_ctime; 661 + inode->i_mtime = inode->i_atime = inode_set_ctime_to_ts(inode, 662 + inode_get_ctime(dir)); 662 663 inode->i_uid = z->z_uid; 663 664 inode->i_gid = z->z_gid; 664 665 inode->i_size = z->z_wpoffset; ··· 695 694 inode->i_ino = ino; 696 695 inode_init_owner(&nop_mnt_idmap, inode, root, S_IFDIR | 0555); 697 696 inode->i_size = sbi->s_zgroup[ztype].g_nr_zones; 698 - inode->i_ctime = inode->i_mtime = inode->i_atime = root->i_ctime; 697 + inode->i_mtime = inode->i_atime = inode_set_ctime_to_ts(inode, 698 + inode_get_ctime(root)); 699 699 inode->i_private = &sbi->s_zgroup[ztype]; 700 700 set_nlink(inode, 2); 701 701 ··· 1319 1317 1320 1318 inode->i_ino = bdev_nr_zones(sb->s_bdev); 1321 1319 inode->i_mode = S_IFDIR | 0555; 1322 - inode->i_ctime = inode->i_mtime = inode->i_atime = current_time(inode); 1320 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 1323 1321 inode->i_op = &zonefs_dir_inode_operations; 1324 1322 inode->i_fop = &zonefs_dir_operations; 1325 1323 inode->i_size = 2;
+94 -6
include/linux/fs.h
··· 642 642 loff_t i_size; 643 643 struct timespec64 i_atime; 644 644 struct timespec64 i_mtime; 645 - struct timespec64 i_ctime; 645 + struct timespec64 __i_ctime; /* use inode_*_ctime accessors! */ 646 646 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 647 647 unsigned short i_bytes; 648 648 u8 i_blkbits; ··· 1474 1474 kgid_has_mapping(fs_userns, kgid); 1475 1475 } 1476 1476 1477 - extern struct timespec64 current_time(struct inode *inode); 1477 + struct timespec64 current_mgtime(struct inode *inode); 1478 + struct timespec64 current_time(struct inode *inode); 1479 + struct timespec64 inode_set_ctime_current(struct inode *inode); 1480 + 1481 + /* 1482 + * Multigrain timestamps 1483 + * 1484 + * Conditionally use fine-grained ctime and mtime timestamps when there 1485 + * are users actively observing them via getattr. The primary use-case 1486 + * for this is NFS clients that use the ctime to distinguish between 1487 + * different states of the file, and that are often fooled by multiple 1488 + * operations that occur in the same coarse-grained timer tick. 1489 + * 1490 + * The kernel always keeps normalized struct timespec64 values in the ctime, 1491 + * which means that only the first 30 bits of the value are used. Use the 1492 + * 31st bit of the ctime's tv_nsec field as a flag to indicate that the value 1493 + * has been queried since it was last updated. 1494 + */ 1495 + #define I_CTIME_QUERIED (1L<<30) 1496 + 1497 + /** 1498 + * inode_get_ctime - fetch the current ctime from the inode 1499 + * @inode: inode from which to fetch ctime 1500 + * 1501 + * Grab the current ctime tv_nsec field from the inode, mask off the 1502 + * I_CTIME_QUERIED flag and return it. This is mostly intended for use by 1503 + * internal consumers of the ctime that aren't concerned with ensuring a 1504 + * fine-grained update on the next change (e.g. when preparing to store 1505 + * the value in the backing store for later retrieval). 1506 + * 1507 + * This is safe to call regardless of whether the underlying filesystem 1508 + * is using multigrain timestamps. 1509 + */ 1510 + static inline struct timespec64 inode_get_ctime(const struct inode *inode) 1511 + { 1512 + struct timespec64 ctime; 1513 + 1514 + ctime.tv_sec = inode->__i_ctime.tv_sec; 1515 + ctime.tv_nsec = inode->__i_ctime.tv_nsec & ~I_CTIME_QUERIED; 1516 + 1517 + return ctime; 1518 + } 1519 + 1520 + /** 1521 + * inode_set_ctime_to_ts - set the ctime in the inode 1522 + * @inode: inode in which to set the ctime 1523 + * @ts: value to set in the ctime field 1524 + * 1525 + * Set the ctime in @inode to @ts 1526 + */ 1527 + static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode, 1528 + struct timespec64 ts) 1529 + { 1530 + inode->__i_ctime = ts; 1531 + return ts; 1532 + } 1533 + 1534 + /** 1535 + * inode_set_ctime - set the ctime in the inode 1536 + * @inode: inode in which to set the ctime 1537 + * @sec: tv_sec value to set 1538 + * @nsec: tv_nsec value to set 1539 + * 1540 + * Set the ctime in @inode to { @sec, @nsec } 1541 + */ 1542 + static inline struct timespec64 inode_set_ctime(struct inode *inode, 1543 + time64_t sec, long nsec) 1544 + { 1545 + struct timespec64 ts = { .tv_sec = sec, 1546 + .tv_nsec = nsec }; 1547 + 1548 + return inode_set_ctime_to_ts(inode, ts); 1549 + } 1478 1550 1479 1551 /* 1480 1552 * Snapshotting support. ··· 1922 1850 ssize_t (*listxattr) (struct dentry *, char *, size_t); 1923 1851 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, 1924 1852 u64 len); 1925 - int (*update_time)(struct inode *, struct timespec64 *, int); 1853 + int (*update_time)(struct inode *, int); 1926 1854 int (*atomic_open)(struct inode *, struct dentry *, 1927 1855 struct file *, unsigned open_flag, 1928 1856 umode_t create_mode); ··· 2272 2200 2273 2201 extern bool atime_needs_update(const struct path *, struct inode *); 2274 2202 extern void touch_atime(const struct path *); 2275 - int inode_update_time(struct inode *inode, struct timespec64 *time, int flags); 2203 + int inode_update_time(struct inode *inode, int flags); 2276 2204 2277 2205 static inline void file_accessed(struct file *file) 2278 2206 { ··· 2294 2222 #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ 2295 2223 #define FS_DISALLOW_NOTIFY_PERM 16 /* Disable fanotify permission events */ 2296 2224 #define FS_ALLOW_IDMAP 32 /* FS has been updated to handle vfs idmappings. */ 2225 + #define FS_MGTIME 64 /* FS uses multigrain timestamps */ 2297 2226 #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ 2298 2227 int (*init_fs_context)(struct fs_context *); 2299 2228 const struct fs_parameter_spec *parameters; ··· 2317 2244 }; 2318 2245 2319 2246 #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME) 2247 + 2248 + /** 2249 + * is_mgtime: is this inode using multigrain timestamps 2250 + * @inode: inode to test for multigrain timestamps 2251 + * 2252 + * Return true if the inode uses multigrain timestamps, false otherwise. 2253 + */ 2254 + static inline bool is_mgtime(const struct inode *inode) 2255 + { 2256 + return inode->i_sb->s_type->fs_flags & FS_MGTIME; 2257 + } 2320 2258 2321 2259 extern struct dentry *mount_bdev(struct file_system_type *fs_type, 2322 2260 int flags, const char *dev_name, void *data, ··· 2390 2306 2391 2307 extern void ihold(struct inode * inode); 2392 2308 extern void iput(struct inode *); 2393 - extern int generic_update_time(struct inode *, struct timespec64 *, int); 2309 + int inode_update_timestamps(struct inode *inode, int flags); 2310 + int generic_update_time(struct inode *, int); 2394 2311 2395 2312 /* /sys/fs */ 2396 2313 extern struct kobject *fs_kobj; ··· 2965 2880 extern int page_symlink(struct inode *inode, const char *symname, int len); 2966 2881 extern const struct inode_operations page_symlink_inode_operations; 2967 2882 extern void kfree_link(void *); 2968 - void generic_fillattr(struct mnt_idmap *, struct inode *, struct kstat *); 2883 + void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode); 2884 + void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *); 2969 2885 void generic_fill_statx_attr(struct inode *inode, struct kstat *stat); 2970 2886 extern int vfs_getattr_nosec(const struct path *, struct kstat *, u32, unsigned int); 2971 2887 extern int vfs_getattr(const struct path *, struct kstat *, u32, unsigned int); ··· 3026 2940 extern int simple_link(struct dentry *, struct inode *, struct dentry *); 3027 2941 extern int simple_unlink(struct inode *, struct dentry *); 3028 2942 extern int simple_rmdir(struct inode *, struct dentry *); 2943 + void simple_rename_timestamp(struct inode *old_dir, struct dentry *old_dentry, 2944 + struct inode *new_dir, struct dentry *new_dentry); 3029 2945 extern int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry, 3030 2946 struct inode *new_dir, struct dentry *new_dentry); 3031 2947 extern int simple_rename(struct mnt_idmap *, struct inode *,
+1 -1
include/linux/fs_stack.h
··· 24 24 { 25 25 dest->i_atime = src->i_atime; 26 26 dest->i_mtime = src->i_mtime; 27 - dest->i_ctime = src->i_ctime; 27 + inode_set_ctime_to_ts(dest, inode_get_ctime(src)); 28 28 } 29 29 30 30 #endif /* _LINUX_FS_STACK_H */
+11 -12
ipc/mqueue.c
··· 302 302 inode->i_mode = mode; 303 303 inode->i_uid = current_fsuid(); 304 304 inode->i_gid = current_fsgid(); 305 - inode->i_mtime = inode->i_ctime = inode->i_atime = current_time(inode); 305 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 306 306 307 307 if (S_ISREG(mode)) { 308 308 struct mqueue_inode_info *info; ··· 596 596 597 597 put_ipc_ns(ipc_ns); 598 598 dir->i_size += DIRENT_SIZE; 599 - dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir); 599 + dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir); 600 600 601 601 d_instantiate(dentry, inode); 602 602 dget(dentry); ··· 618 618 { 619 619 struct inode *inode = d_inode(dentry); 620 620 621 - dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir); 621 + dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir); 622 622 dir->i_size -= DIRENT_SIZE; 623 623 drop_nlink(inode); 624 624 dput(dentry); ··· 635 635 static ssize_t mqueue_read_file(struct file *filp, char __user *u_data, 636 636 size_t count, loff_t *off) 637 637 { 638 - struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); 638 + struct inode *inode = file_inode(filp); 639 + struct mqueue_inode_info *info = MQUEUE_I(inode); 639 640 char buffer[FILENT_SIZE]; 640 641 ssize_t ret; 641 642 ··· 657 656 if (ret <= 0) 658 657 return ret; 659 658 660 - file_inode(filp)->i_atime = file_inode(filp)->i_ctime = current_time(file_inode(filp)); 659 + inode->i_atime = inode_set_ctime_current(inode); 661 660 return ret; 662 661 } 663 662 ··· 1163 1162 goto out_unlock; 1164 1163 __do_notify(info); 1165 1164 } 1166 - inode->i_atime = inode->i_mtime = inode->i_ctime = 1167 - current_time(inode); 1165 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 1168 1166 } 1169 1167 out_unlock: 1170 1168 spin_unlock(&info->lock); ··· 1257 1257 1258 1258 msg_ptr = msg_get(info); 1259 1259 1260 - inode->i_atime = inode->i_mtime = inode->i_ctime = 1261 - current_time(inode); 1260 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 1262 1261 1263 1262 /* There is now free space in queue. */ 1264 1263 pipelined_receive(&wake_q, info); ··· 1395 1396 if (notification == NULL) { 1396 1397 if (info->notify_owner == task_tgid(current)) { 1397 1398 remove_notification(info); 1398 - inode->i_atime = inode->i_ctime = current_time(inode); 1399 + inode->i_atime = inode_set_ctime_current(inode); 1399 1400 } 1400 1401 } else if (info->notify_owner != NULL) { 1401 1402 ret = -EBUSY; ··· 1421 1422 1422 1423 info->notify_owner = get_pid(task_tgid(current)); 1423 1424 info->notify_user_ns = get_user_ns(current_user_ns()); 1424 - inode->i_atime = inode->i_ctime = current_time(inode); 1425 + inode->i_atime = inode_set_ctime_current(inode); 1425 1426 } 1426 1427 spin_unlock(&info->lock); 1427 1428 out_fput: ··· 1484 1485 f.file->f_flags &= ~O_NONBLOCK; 1485 1486 spin_unlock(&f.file->f_lock); 1486 1487 1487 - inode->i_atime = inode->i_ctime = current_time(inode); 1488 + inode->i_atime = inode_set_ctime_current(inode); 1488 1489 } 1489 1490 1490 1491 spin_unlock(&info->lock);
+2 -4
kernel/bpf/inode.c
··· 118 118 return ERR_PTR(-ENOSPC); 119 119 120 120 inode->i_ino = get_next_ino(); 121 - inode->i_atime = current_time(inode); 121 + inode->i_atime = inode_set_ctime_current(inode); 122 122 inode->i_mtime = inode->i_atime; 123 - inode->i_ctime = inode->i_atime; 124 123 125 124 inode_init_owner(&nop_mnt_idmap, inode, dir, mode); 126 125 ··· 147 148 d_instantiate(dentry, inode); 148 149 dget(dentry); 149 150 150 - dir->i_mtime = current_time(dir); 151 - dir->i_ctime = dir->i_mtime; 151 + dir->i_mtime = inode_set_ctime_current(dir); 152 152 } 153 153 154 154 static int bpf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+15 -15
mm/shmem.c
··· 1049 1049 void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend) 1050 1050 { 1051 1051 shmem_undo_range(inode, lstart, lend, false); 1052 - inode->i_ctime = inode->i_mtime = current_time(inode); 1052 + inode->i_mtime = inode_set_ctime_current(inode); 1053 1053 inode_inc_iversion(inode); 1054 1054 } 1055 1055 EXPORT_SYMBOL_GPL(shmem_truncate_range); ··· 1075 1075 stat->attributes_mask |= (STATX_ATTR_APPEND | 1076 1076 STATX_ATTR_IMMUTABLE | 1077 1077 STATX_ATTR_NODUMP); 1078 - generic_fillattr(idmap, inode, stat); 1078 + generic_fillattr(idmap, request_mask, inode, stat); 1079 1079 1080 1080 if (shmem_is_huge(inode, 0, false, NULL, 0)) 1081 1081 stat->blksize = HPAGE_PMD_SIZE; ··· 1146 1146 if (attr->ia_valid & ATTR_MODE) 1147 1147 error = posix_acl_chmod(idmap, dentry, inode->i_mode); 1148 1148 if (!error && update_ctime) { 1149 - inode->i_ctime = current_time(inode); 1149 + inode_set_ctime_current(inode); 1150 1150 if (update_mtime) 1151 - inode->i_mtime = inode->i_ctime; 1151 + inode->i_mtime = inode_get_ctime(inode); 1152 1152 inode_inc_iversion(inode); 1153 1153 } 1154 1154 return error; ··· 2374 2374 inode->i_ino = ino; 2375 2375 inode_init_owner(idmap, inode, dir, mode); 2376 2376 inode->i_blocks = 0; 2377 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 2377 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 2378 2378 inode->i_generation = get_random_u32(); 2379 2379 info = SHMEM_I(inode); 2380 2380 memset(info, 0, (char *)inode - (char *)info); ··· 3089 3089 3090 3090 error = 0; 3091 3091 dir->i_size += BOGO_DIRENT_SIZE; 3092 - dir->i_ctime = dir->i_mtime = current_time(dir); 3092 + dir->i_mtime = inode_set_ctime_current(dir); 3093 3093 inode_inc_iversion(dir); 3094 3094 d_instantiate(dentry, inode); 3095 3095 dget(dentry); /* Extra count - pin the dentry in core */ ··· 3165 3165 } 3166 3166 3167 3167 dir->i_size += BOGO_DIRENT_SIZE; 3168 - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); 3168 + dir->i_mtime = inode_set_ctime_to_ts(dir, 3169 + inode_set_ctime_current(inode)); 3169 3170 inode_inc_iversion(dir); 3170 3171 inc_nlink(inode); 3171 3172 ihold(inode); /* New dentry reference */ ··· 3184 3183 shmem_free_inode(inode->i_sb); 3185 3184 3186 3185 dir->i_size -= BOGO_DIRENT_SIZE; 3187 - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); 3186 + dir->i_mtime = inode_set_ctime_to_ts(dir, 3187 + inode_set_ctime_current(inode)); 3188 3188 inode_inc_iversion(dir); 3189 3189 drop_nlink(inode); 3190 3190 dput(dentry); /* Undo the count from "create" - this does all the work */ ··· 3273 3271 3274 3272 old_dir->i_size -= BOGO_DIRENT_SIZE; 3275 3273 new_dir->i_size += BOGO_DIRENT_SIZE; 3276 - old_dir->i_ctime = old_dir->i_mtime = 3277 - new_dir->i_ctime = new_dir->i_mtime = 3278 - inode->i_ctime = current_time(old_dir); 3274 + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry); 3279 3275 inode_inc_iversion(old_dir); 3280 3276 inode_inc_iversion(new_dir); 3281 3277 return 0; ··· 3327 3327 folio_put(folio); 3328 3328 } 3329 3329 dir->i_size += BOGO_DIRENT_SIZE; 3330 - dir->i_ctime = dir->i_mtime = current_time(dir); 3330 + dir->i_mtime = inode_set_ctime_current(dir); 3331 3331 inode_inc_iversion(dir); 3332 3332 d_instantiate(dentry, inode); 3333 3333 dget(dentry); ··· 3399 3399 (fa->flags & SHMEM_FL_USER_MODIFIABLE); 3400 3400 3401 3401 shmem_set_inode_flags(inode, info->fsflags); 3402 - inode->i_ctime = current_time(inode); 3402 + inode_set_ctime_current(inode); 3403 3403 inode_inc_iversion(inode); 3404 3404 return 0; 3405 3405 } ··· 3469 3469 name = xattr_full_name(handler, name); 3470 3470 err = simple_xattr_set(&info->xattrs, name, value, size, flags, NULL); 3471 3471 if (!err) { 3472 - inode->i_ctime = current_time(inode); 3472 + inode_set_ctime_current(inode); 3473 3473 inode_inc_iversion(inode); 3474 3474 } 3475 3475 return err; ··· 4225 4225 #endif 4226 4226 .kill_sb = kill_litter_super, 4227 4227 #ifdef CONFIG_SHMEM 4228 - .fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP, 4228 + .fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP | FS_MGTIME, 4229 4229 #else 4230 4230 .fs_flags = FS_USERNS_MOUNT, 4231 4231 #endif
+1 -1
net/sunrpc/rpc_pipe.c
··· 472 472 return NULL; 473 473 inode->i_ino = get_next_ino(); 474 474 inode->i_mode = mode; 475 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 475 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 476 476 switch (mode & S_IFMT) { 477 477 case S_IFDIR: 478 478 inode->i_fop = &simple_dir_operations;
+7 -4
security/apparmor/apparmorfs.c
··· 226 226 227 227 inode->i_ino = get_next_ino(); 228 228 inode->i_mode = mode; 229 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 229 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 230 230 inode->i_private = data; 231 231 if (S_ISDIR(mode)) { 232 232 inode->i_op = iops ? iops : &simple_dir_inode_operations; ··· 1554 1554 1555 1555 for (i = 0; i < AAFS_PROF_SIZEOF; i++) { 1556 1556 new->dents[i] = old->dents[i]; 1557 - if (new->dents[i]) 1558 - new->dents[i]->d_inode->i_mtime = current_time(new->dents[i]->d_inode); 1557 + if (new->dents[i]) { 1558 + struct inode *inode = d_inode(new->dents[i]); 1559 + 1560 + inode->i_mtime = inode_set_ctime_current(inode); 1561 + } 1559 1562 old->dents[i] = NULL; 1560 1563 } 1561 1564 } ··· 2543 2540 2544 2541 inode->i_ino = get_next_ino(); 2545 2542 inode->i_mode = S_IFCHR | S_IRUGO | S_IWUGO; 2546 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 2543 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 2547 2544 init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO, 2548 2545 MKDEV(MEM_MAJOR, 3)); 2549 2546 d_instantiate(dentry, inode);
+7 -4
security/apparmor/policy_unpack.c
··· 86 86 87 87 data->revision = revision; 88 88 if ((data->dents[AAFS_LOADDATA_REVISION])) { 89 - d_inode(data->dents[AAFS_LOADDATA_DIR])->i_mtime = 90 - current_time(d_inode(data->dents[AAFS_LOADDATA_DIR])); 91 - d_inode(data->dents[AAFS_LOADDATA_REVISION])->i_mtime = 92 - current_time(d_inode(data->dents[AAFS_LOADDATA_REVISION])); 89 + struct inode *inode; 90 + 91 + inode = d_inode(data->dents[AAFS_LOADDATA_DIR]); 92 + inode->i_mtime = inode_set_ctime_current(inode); 93 + 94 + inode = d_inode(data->dents[AAFS_LOADDATA_REVISION]); 95 + inode->i_mtime = inode_set_ctime_current(inode); 93 96 } 94 97 } 95 98
+1 -1
security/inode.c
··· 145 145 146 146 inode->i_ino = get_next_ino(); 147 147 inode->i_mode = mode; 148 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 148 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 149 149 inode->i_private = data; 150 150 if (S_ISDIR(mode)) { 151 151 inode->i_op = &simple_dir_inode_operations;
+1 -1
security/selinux/selinuxfs.c
··· 1197 1197 1198 1198 if (ret) { 1199 1199 ret->i_mode = mode; 1200 - ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret); 1200 + ret->i_atime = ret->i_mtime = inode_set_ctime_current(ret); 1201 1201 } 1202 1202 return ret; 1203 1203 }