Skip to content

Commit 14ab6d4

Browse files
committed
Merge tag 'vfs-6.7.ctime' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs
Pull vfs inode time accessor updates from Christian Brauner: "This finishes the conversion of all inode time fields to accessor functions as discussed on list. Changing timestamps manually as we used to do before is error prone. Using accessors function makes this robust. It does not contain the switch of the time fields to discrete 64 bit integers to replace struct timespec and free up space in struct inode. But after this, the switch can be trivially made and the patch should only affect the vfs if we decide to do it" * tag 'vfs-6.7.ctime' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs: (86 commits) fs: rename inode i_atime and i_mtime fields security: convert to new timestamp accessors selinux: convert to new timestamp accessors apparmor: convert to new timestamp accessors sunrpc: convert to new timestamp accessors mm: convert to new timestamp accessors bpf: convert to new timestamp accessors ipc: convert to new timestamp accessors linux: convert to new timestamp accessors zonefs: convert to new timestamp accessors xfs: convert to new timestamp accessors vboxsf: convert to new timestamp accessors ufs: convert to new timestamp accessors udf: convert to new timestamp accessors ubifs: convert to new timestamp accessors tracefs: convert to new timestamp accessors sysv: convert to new timestamp accessors squashfs: convert to new timestamp accessors server: convert to new timestamp accessors client: convert to new timestamp accessors ...
2 parents 7352a67 + 12cd440 commit 14ab6d4

File tree

215 files changed

+1194
-983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+1194
-983
lines changed

arch/powerpc/platforms/cell/spufs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
8686
inode->i_mode = mode;
8787
inode->i_uid = current_fsuid();
8888
inode->i_gid = current_fsgid();
89-
inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
89+
simple_inode_init_ts(inode);
9090
out:
9191
return inode;
9292
}

arch/s390/hypfs/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static void hypfs_update_update(struct super_block *sb)
5353
struct inode *inode = d_inode(sb_info->update_file);
5454

5555
sb_info->last_update = ktime_get_seconds();
56-
inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
56+
simple_inode_init_ts(inode);
5757
}
5858

5959
/* directory tree removal functions */
@@ -101,7 +101,7 @@ static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode)
101101
ret->i_mode = mode;
102102
ret->i_uid = hypfs_info->uid;
103103
ret->i_gid = hypfs_info->gid;
104-
ret->i_atime = ret->i_mtime = inode_set_ctime_current(ret);
104+
simple_inode_init_ts(ret);
105105
if (S_ISDIR(mode))
106106
set_nlink(ret, 2);
107107
}

drivers/android/binderfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static int binderfs_binder_device_create(struct inode *ref_inode,
152152
goto err;
153153

154154
inode->i_ino = minor + INODE_OFFSET;
155-
inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
155+
simple_inode_init_ts(inode);
156156
init_special_inode(inode, S_IFCHR | 0600,
157157
MKDEV(MAJOR(binderfs_dev), minor));
158158
inode->i_fop = &binder_fops;
@@ -431,7 +431,7 @@ static int binderfs_binder_ctl_create(struct super_block *sb)
431431
}
432432

433433
inode->i_ino = SECOND_INODE;
434-
inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
434+
simple_inode_init_ts(inode);
435435
init_special_inode(inode, S_IFCHR | 0600,
436436
MKDEV(MAJOR(binderfs_dev), minor));
437437
inode->i_fop = &binder_ctl_fops;
@@ -473,7 +473,7 @@ static struct inode *binderfs_make_inode(struct super_block *sb, int mode)
473473
if (ret) {
474474
ret->i_ino = iunique(sb, BINDERFS_MAX_MINOR + INODE_OFFSET);
475475
ret->i_mode = mode;
476-
ret->i_atime = ret->i_mtime = inode_set_ctime_current(ret);
476+
simple_inode_init_ts(ret);
477477
}
478478
return ret;
479479
}
@@ -702,7 +702,7 @@ static int binderfs_fill_super(struct super_block *sb, struct fs_context *fc)
702702
inode->i_ino = FIRST_INODE;
703703
inode->i_fop = &simple_dir_operations;
704704
inode->i_mode = S_IFDIR | 0755;
705-
inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
705+
simple_inode_init_ts(inode);
706706
inode->i_op = &binderfs_dir_inode_operations;
707707
set_nlink(inode, 2);
708708

drivers/char/sonypi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
920920

921921
if (ret > 0) {
922922
struct inode *inode = file_inode(file);
923-
inode->i_atime = current_time(inode);
923+
inode_set_atime_to_ts(inode, current_time(inode));
924924
}
925925

926926
return ret;

drivers/infiniband/hw/qib/qib_fs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
6464
inode->i_uid = GLOBAL_ROOT_UID;
6565
inode->i_gid = GLOBAL_ROOT_GID;
6666
inode->i_blocks = 0;
67-
inode->i_atime = inode_set_ctime_current(inode);
68-
inode->i_mtime = inode->i_atime;
67+
simple_inode_init_ts(inode);
68+
6969
inode->i_private = data;
7070
if (S_ISDIR(mode)) {
7171
inode->i_op = &simple_dir_inode_operations;

drivers/misc/ibmasm/ibmasmfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
139139
if (ret) {
140140
ret->i_ino = get_next_ino();
141141
ret->i_mode = mode;
142-
ret->i_atime = ret->i_mtime = inode_set_ctime_current(ret);
142+
simple_inode_init_ts(ret);
143143
}
144144
return ret;
145145
}

drivers/misc/ibmvmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ static ssize_t ibmvmc_write(struct file *file, const char *buffer,
11241124
goto out;
11251125

11261126
inode = file_inode(file);
1127-
inode->i_mtime = inode_set_ctime_current(inode);
1127+
inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
11281128
mark_inode_dirty(inode);
11291129

11301130
dev_dbg(adapter->dev, "write: file = 0x%lx, count = 0x%lx\n",

drivers/platform/x86/sony-laptop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4092,7 +4092,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
40924092

40934093
if (ret > 0) {
40944094
struct inode *inode = file_inode(file);
4095-
inode->i_atime = current_time(inode);
4095+
inode_set_atime_to_ts(inode, current_time(inode));
40964096
}
40974097

40984098
return ret;

drivers/tty/tty_io.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,16 +818,20 @@ static void tty_update_time(struct tty_struct *tty, bool mtime)
818818
spin_lock(&tty->files_lock);
819819
list_for_each_entry(priv, &tty->tty_files, list) {
820820
struct inode *inode = file_inode(priv->file);
821-
struct timespec64 *time = mtime ? &inode->i_mtime : &inode->i_atime;
821+
struct timespec64 time = mtime ? inode_get_mtime(inode) : inode_get_atime(inode);
822822

823823
/*
824824
* We only care if the two values differ in anything other than the
825825
* lower three bits (i.e every 8 seconds). If so, then we can update
826826
* the time of the tty device, otherwise it could be construded as a
827827
* security leak to let userspace know the exact timing of the tty.
828828
*/
829-
if ((sec ^ time->tv_sec) & ~7)
830-
time->tv_sec = sec;
829+
if ((sec ^ time.tv_sec) & ~7) {
830+
if (mtime)
831+
inode_set_mtime(inode, sec, 0);
832+
else
833+
inode_set_atime(inode, sec, 0);
834+
}
831835
}
832836
spin_unlock(&tty->files_lock);
833837
}

drivers/usb/core/devio.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,21 +2642,24 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
26422642
snoop(&dev->dev, "%s: CONTROL\n", __func__);
26432643
ret = proc_control(ps, p);
26442644
if (ret >= 0)
2645-
inode->i_mtime = inode_set_ctime_current(inode);
2645+
inode_set_mtime_to_ts(inode,
2646+
inode_set_ctime_current(inode));
26462647
break;
26472648

26482649
case USBDEVFS_BULK:
26492650
snoop(&dev->dev, "%s: BULK\n", __func__);
26502651
ret = proc_bulk(ps, p);
26512652
if (ret >= 0)
2652-
inode->i_mtime = inode_set_ctime_current(inode);
2653+
inode_set_mtime_to_ts(inode,
2654+
inode_set_ctime_current(inode));
26532655
break;
26542656

26552657
case USBDEVFS_RESETEP:
26562658
snoop(&dev->dev, "%s: RESETEP\n", __func__);
26572659
ret = proc_resetep(ps, p);
26582660
if (ret >= 0)
2659-
inode->i_mtime = inode_set_ctime_current(inode);
2661+
inode_set_mtime_to_ts(inode,
2662+
inode_set_ctime_current(inode));
26602663
break;
26612664

26622665
case USBDEVFS_RESET:
@@ -2668,7 +2671,8 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
26682671
snoop(&dev->dev, "%s: CLEAR_HALT\n", __func__);
26692672
ret = proc_clearhalt(ps, p);
26702673
if (ret >= 0)
2671-
inode->i_mtime = inode_set_ctime_current(inode);
2674+
inode_set_mtime_to_ts(inode,
2675+
inode_set_ctime_current(inode));
26722676
break;
26732677

26742678
case USBDEVFS_GETDRIVER:
@@ -2695,22 +2699,25 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
26952699
snoop(&dev->dev, "%s: SUBMITURB\n", __func__);
26962700
ret = proc_submiturb(ps, p);
26972701
if (ret >= 0)
2698-
inode->i_mtime = inode_set_ctime_current(inode);
2702+
inode_set_mtime_to_ts(inode,
2703+
inode_set_ctime_current(inode));
26992704
break;
27002705

27012706
#ifdef CONFIG_COMPAT
27022707
case USBDEVFS_CONTROL32:
27032708
snoop(&dev->dev, "%s: CONTROL32\n", __func__);
27042709
ret = proc_control_compat(ps, p);
27052710
if (ret >= 0)
2706-
inode->i_mtime = inode_set_ctime_current(inode);
2711+
inode_set_mtime_to_ts(inode,
2712+
inode_set_ctime_current(inode));
27072713
break;
27082714

27092715
case USBDEVFS_BULK32:
27102716
snoop(&dev->dev, "%s: BULK32\n", __func__);
27112717
ret = proc_bulk_compat(ps, p);
27122718
if (ret >= 0)
2713-
inode->i_mtime = inode_set_ctime_current(inode);
2719+
inode_set_mtime_to_ts(inode,
2720+
inode_set_ctime_current(inode));
27142721
break;
27152722

27162723
case USBDEVFS_DISCSIGNAL32:
@@ -2722,7 +2729,8 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
27222729
snoop(&dev->dev, "%s: SUBMITURB32\n", __func__);
27232730
ret = proc_submiturb_compat(ps, p);
27242731
if (ret >= 0)
2725-
inode->i_mtime = inode_set_ctime_current(inode);
2732+
inode_set_mtime_to_ts(inode,
2733+
inode_set_ctime_current(inode));
27262734
break;
27272735

27282736
case USBDEVFS_IOCTL32:
@@ -2804,7 +2812,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
28042812
done:
28052813
usb_unlock_device(dev);
28062814
if (ret >= 0)
2807-
inode->i_atime = current_time(inode);
2815+
inode_set_atime_to_ts(inode, current_time(inode));
28082816
return ret;
28092817
}
28102818

0 commit comments

Comments
 (0)