Skip to content

Commit 7a93251

Browse files
committed
Merge tag 'vfs-timespec64' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground
Pull inode timestamps conversion to timespec64 from Arnd Bergmann: "This is a late set of changes from Deepa Dinamani doing an automated treewide conversion of the inode and iattr structures from 'timespec' to 'timespec64', to push the conversion from the VFS layer into the individual file systems. As Deepa writes: 'The series aims to switch vfs timestamps to use struct timespec64. Currently vfs uses struct timespec, which is not y2038 safe. The series involves the following: 1. Add vfs helper functions for supporting struct timepec64 timestamps. 2. Cast prints of vfs timestamps to avoid warnings after the switch. 3. Simplify code using vfs timestamps so that the actual replacement becomes easy. 4. Convert vfs timestamps to use struct timespec64 using a script. This is a flag day patch. Next steps: 1. Convert APIs that can handle timespec64, instead of converting timestamps at the boundaries. 2. Update internal data structures to avoid timestamp conversions' Thomas Gleixner adds: 'I think there is no point to drag that out for the next merge window. The whole thing needs to be done in one go for the core changes which means that you're going to play that catchup game forever. Let's get over with it towards the end of the merge window'" * tag 'vfs-timespec64' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground: pstore: Remove bogus format string definition vfs: change inode times to use struct timespec64 pstore: Convert internal records to timespec64 udf: Simplify calls to udf_disk_stamp_to_time fs: nfs: get rid of memcpys for inode times ceph: make inode time prints to be long long lustre: Use long long type to print inode time fs: add timespec64_truncate()
2 parents dc594c3 + e264abe commit 7a93251

85 files changed

Lines changed: 539 additions & 424 deletions

Some content is hidden

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

‎drivers/firmware/efi/efi-pstore.c‎

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ static int efi_pstore_close(struct pstore_info *psi)
2828
return 0;
2929
}
3030

31-
static inline u64 generic_id(unsigned long timestamp,
32-
unsigned int part, int count)
31+
static inline u64 generic_id(u64 timestamp, unsigned int part, int count)
3332
{
34-
return ((u64) timestamp * 100 + part) * 1000 + count;
33+
return (timestamp * 100 + part) * 1000 + count;
3534
}
3635

3736
static int efi_pstore_read_func(struct efivar_entry *entry,
@@ -42,15 +41,16 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
4241
int i;
4342
int cnt;
4443
unsigned int part;
45-
unsigned long time, size;
44+
unsigned long size;
45+
u64 time;
4646

4747
if (efi_guidcmp(entry->var.VendorGuid, vendor))
4848
return 0;
4949

5050
for (i = 0; i < DUMP_NAME_LEN; i++)
5151
name[i] = entry->var.VariableName[i];
5252

53-
if (sscanf(name, "dump-type%u-%u-%d-%lu-%c",
53+
if (sscanf(name, "dump-type%u-%u-%d-%llu-%c",
5454
&record->type, &part, &cnt, &time, &data_type) == 5) {
5555
record->id = generic_id(time, part, cnt);
5656
record->part = part;
@@ -62,7 +62,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
6262
else
6363
record->compressed = false;
6464
record->ecc_notice_size = 0;
65-
} else if (sscanf(name, "dump-type%u-%u-%d-%lu",
65+
} else if (sscanf(name, "dump-type%u-%u-%d-%llu",
6666
&record->type, &part, &cnt, &time) == 4) {
6767
record->id = generic_id(time, part, cnt);
6868
record->part = part;
@@ -71,7 +71,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
7171
record->time.tv_nsec = 0;
7272
record->compressed = false;
7373
record->ecc_notice_size = 0;
74-
} else if (sscanf(name, "dump-type%u-%u-%lu",
74+
} else if (sscanf(name, "dump-type%u-%u-%llu",
7575
&record->type, &part, &time) == 3) {
7676
/*
7777
* Check if an old format,
@@ -250,9 +250,10 @@ static int efi_pstore_write(struct pstore_record *record)
250250
/* Since we copy the entire length of name, make sure it is wiped. */
251251
memset(name, 0, sizeof(name));
252252

253-
snprintf(name, sizeof(name), "dump-type%u-%u-%d-%lu-%c",
253+
snprintf(name, sizeof(name), "dump-type%u-%u-%d-%lld-%c",
254254
record->type, record->part, record->count,
255-
record->time.tv_sec, record->compressed ? 'C' : 'D');
255+
(long long)record->time.tv_sec,
256+
record->compressed ? 'C' : 'D');
256257

257258
for (i = 0; i < DUMP_NAME_LEN; i++)
258259
efi_name[i] = name[i];
@@ -327,15 +328,15 @@ static int efi_pstore_erase(struct pstore_record *record)
327328
char name[DUMP_NAME_LEN];
328329
int ret;
329330

330-
snprintf(name, sizeof(name), "dump-type%u-%u-%d-%lu",
331+
snprintf(name, sizeof(name), "dump-type%u-%u-%d-%lld",
331332
record->type, record->part, record->count,
332-
record->time.tv_sec);
333+
(long long)record->time.tv_sec);
333334
ret = efi_pstore_erase_name(name);
334335
if (ret != -ENOENT)
335336
return ret;
336337

337-
snprintf(name, sizeof(name), "dump-type%u-%u-%lu",
338-
record->type, record->part, record->time.tv_sec);
338+
snprintf(name, sizeof(name), "dump-type%u-%u-%lld",
339+
record->type, record->part, (long long)record->time.tv_sec);
339340
ret = efi_pstore_erase_name(name);
340341

341342
return ret;

‎drivers/tty/tty_io.c‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,13 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count,
867867
i = -EIO;
868868
tty_ldisc_deref(ld);
869869

870-
if (i > 0)
871-
tty_update_time(&inode->i_atime);
870+
if (i > 0) {
871+
struct timespec ts;
872+
873+
ts = timespec64_to_timespec(inode->i_atime);
874+
tty_update_time(&ts);
875+
inode->i_atime = timespec_to_timespec64(ts);
876+
}
872877

873878
return i;
874879
}
@@ -969,7 +974,11 @@ static inline ssize_t do_tty_write(
969974
cond_resched();
970975
}
971976
if (written) {
972-
tty_update_time(&file_inode(file)->i_mtime);
977+
struct timespec ts;
978+
979+
ts = timespec64_to_timespec(file_inode(file)->i_mtime);
980+
tty_update_time(&ts);
981+
file_inode(file)->i_mtime = timespec_to_timespec64(ts);
973982
ret = written;
974983
}
975984
out:

‎drivers/usb/gadget/function/f_fs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
13081308
inode = new_inode(sb);
13091309

13101310
if (likely(inode)) {
1311-
struct timespec ts = current_time(inode);
1311+
struct timespec64 ts = current_time(inode);
13121312

13131313
inode->i_ino = get_next_ino();
13141314
inode->i_mode = perms->mode;

‎fs/adfs/inode.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ adfs_adfs2unix_time(struct timespec *tv, struct inode *inode)
199199
return;
200200

201201
cur_time:
202-
*tv = current_time(inode);
202+
*tv = timespec64_to_timespec(current_time(inode));
203203
return;
204204

205205
too_early:
@@ -242,6 +242,7 @@ adfs_unix2adfs_time(struct inode *inode, unsigned int secs)
242242
struct inode *
243243
adfs_iget(struct super_block *sb, struct object_info *obj)
244244
{
245+
struct timespec ts;
245246
struct inode *inode;
246247

247248
inode = new_inode(sb);
@@ -270,7 +271,9 @@ adfs_iget(struct super_block *sb, struct object_info *obj)
270271
ADFS_I(inode)->stamped = ((obj->loadaddr & 0xfff00000) == 0xfff00000);
271272

272273
inode->i_mode = adfs_atts2mode(sb, inode);
273-
adfs_adfs2unix_time(&inode->i_mtime, inode);
274+
ts = timespec64_to_timespec(inode->i_mtime);
275+
adfs_adfs2unix_time(&ts, inode);
276+
inode->i_mtime = timespec_to_timespec64(ts);
274277
inode->i_atime = inode->i_mtime;
275278
inode->i_ctime = inode->i_mtime;
276279

‎fs/afs/fsclient.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void afs_update_inode_from_status(struct afs_vnode *vnode,
7272
const afs_dataversion_t *expected_version,
7373
u8 flags)
7474
{
75-
struct timespec t;
75+
struct timespec64 t;
7676
umode_t mode;
7777

7878
t.tv_sec = status->mtime_client;

‎fs/attr.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ void setattr_copy(struct inode *inode, const struct iattr *attr)
183183
if (ia_valid & ATTR_GID)
184184
inode->i_gid = attr->ia_gid;
185185
if (ia_valid & ATTR_ATIME)
186-
inode->i_atime = timespec_trunc(attr->ia_atime,
187-
inode->i_sb->s_time_gran);
186+
inode->i_atime = timespec64_trunc(attr->ia_atime,
187+
inode->i_sb->s_time_gran);
188188
if (ia_valid & ATTR_MTIME)
189-
inode->i_mtime = timespec_trunc(attr->ia_mtime,
190-
inode->i_sb->s_time_gran);
189+
inode->i_mtime = timespec64_trunc(attr->ia_mtime,
190+
inode->i_sb->s_time_gran);
191191
if (ia_valid & ATTR_CTIME)
192-
inode->i_ctime = timespec_trunc(attr->ia_ctime,
193-
inode->i_sb->s_time_gran);
192+
inode->i_ctime = timespec64_trunc(attr->ia_ctime,
193+
inode->i_sb->s_time_gran);
194194
if (ia_valid & ATTR_MODE) {
195195
umode_t mode = attr->ia_mode;
196196

@@ -227,7 +227,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
227227
struct inode *inode = dentry->d_inode;
228228
umode_t mode = inode->i_mode;
229229
int error;
230-
struct timespec now;
230+
struct timespec64 now;
231231
unsigned int ia_valid = attr->ia_valid;
232232

233233
WARN_ON_ONCE(!inode_is_locked(inode));

‎fs/bad_inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static int bad_inode_fiemap(struct inode *inode,
126126
return -EIO;
127127
}
128128

129-
static int bad_inode_update_time(struct inode *inode, struct timespec *time,
129+
static int bad_inode_update_time(struct inode *inode, struct timespec64 *time,
130130
int flags)
131131
{
132132
return -EIO;

‎fs/btrfs/file.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,16 +1842,16 @@ static ssize_t __btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from)
18421842

18431843
static void update_time_for_write(struct inode *inode)
18441844
{
1845-
struct timespec now;
1845+
struct timespec64 now;
18461846

18471847
if (IS_NOCMTIME(inode))
18481848
return;
18491849

18501850
now = current_time(inode);
1851-
if (!timespec_equal(&inode->i_mtime, &now))
1851+
if (!timespec64_equal(&inode->i_mtime, &now))
18521852
inode->i_mtime = now;
18531853

1854-
if (!timespec_equal(&inode->i_ctime, &now))
1854+
if (!timespec64_equal(&inode->i_ctime, &now))
18551855
inode->i_ctime = now;
18561856

18571857
if (IS_I_VERSION(inode))

‎fs/btrfs/inode.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5745,7 +5745,7 @@ static struct inode *new_simple_dir(struct super_block *s,
57455745
inode->i_mtime = current_time(inode);
57465746
inode->i_atime = inode->i_mtime;
57475747
inode->i_ctime = inode->i_mtime;
5748-
BTRFS_I(inode)->i_otime = inode->i_mtime;
5748+
BTRFS_I(inode)->i_otime = timespec64_to_timespec(inode->i_mtime);
57495749

57505750
return inode;
57515751
}
@@ -6094,7 +6094,7 @@ static int btrfs_dirty_inode(struct inode *inode)
60946094
* This is a copy of file_update_time. We need this so we can return error on
60956095
* ENOSPC for updating the inode in the case of file write and mmap writes.
60966096
*/
6097-
static int btrfs_update_time(struct inode *inode, struct timespec *now,
6097+
static int btrfs_update_time(struct inode *inode, struct timespec64 *now,
60986098
int flags)
60996099
{
61006100
struct btrfs_root *root = BTRFS_I(inode)->root;
@@ -6349,7 +6349,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
63496349
inode->i_mtime = current_time(inode);
63506350
inode->i_atime = inode->i_mtime;
63516351
inode->i_ctime = inode->i_mtime;
6352-
BTRFS_I(inode)->i_otime = inode->i_mtime;
6352+
BTRFS_I(inode)->i_otime = timespec64_to_timespec(inode->i_mtime);
63536353

63546354
inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
63556355
struct btrfs_inode_item);
@@ -9435,7 +9435,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
94359435
struct btrfs_root *dest = BTRFS_I(new_dir)->root;
94369436
struct inode *new_inode = new_dentry->d_inode;
94379437
struct inode *old_inode = old_dentry->d_inode;
9438-
struct timespec ctime = current_time(old_inode);
9438+
struct timespec64 ctime = current_time(old_inode);
94399439
struct dentry *parent;
94409440
u64 old_ino = btrfs_ino(BTRFS_I(old_inode));
94419441
u64 new_ino = btrfs_ino(BTRFS_I(new_inode));

‎fs/btrfs/ioctl.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ static noinline int create_subvol(struct inode *dir,
562562
struct btrfs_root *root = BTRFS_I(dir)->root;
563563
struct btrfs_root *new_root;
564564
struct btrfs_block_rsv block_rsv;
565-
struct timespec cur_time = current_time(dir);
565+
struct timespec64 cur_time = current_time(dir);
566566
struct inode *inode;
567567
int ret;
568568
int err;
@@ -5395,7 +5395,7 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file,
53955395
struct btrfs_root *root = BTRFS_I(inode)->root;
53965396
struct btrfs_root_item *root_item = &root->root_item;
53975397
struct btrfs_trans_handle *trans;
5398-
struct timespec ct = current_time(inode);
5398+
struct timespec64 ct = current_time(inode);
53995399
int ret = 0;
54005400
int received_uuid_changed;
54015401

0 commit comments

Comments
 (0)