Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a932516 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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()
parents dc594c39 e264abea
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -28,10 +28,9 @@ static int efi_pstore_close(struct pstore_info *psi)
	return 0;
}

static inline u64 generic_id(unsigned long timestamp,
			     unsigned int part, int count)
static inline u64 generic_id(u64 timestamp, unsigned int part, int count)
{
	return ((u64) timestamp * 100 + part) * 1000 + count;
	return (timestamp * 100 + part) * 1000 + count;
}

static int efi_pstore_read_func(struct efivar_entry *entry,
@@ -42,7 +41,8 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
	int i;
	int cnt;
	unsigned int part;
	unsigned long time, size;
	unsigned long size;
	u64 time;

	if (efi_guidcmp(entry->var.VendorGuid, vendor))
		return 0;
@@ -50,7 +50,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
	for (i = 0; i < DUMP_NAME_LEN; i++)
		name[i] = entry->var.VariableName[i];

	if (sscanf(name, "dump-type%u-%u-%d-%lu-%c",
	if (sscanf(name, "dump-type%u-%u-%d-%llu-%c",
		   &record->type, &part, &cnt, &time, &data_type) == 5) {
		record->id = generic_id(time, part, cnt);
		record->part = part;
@@ -62,7 +62,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
		else
			record->compressed = false;
		record->ecc_notice_size = 0;
	} else if (sscanf(name, "dump-type%u-%u-%d-%lu",
	} else if (sscanf(name, "dump-type%u-%u-%d-%llu",
		   &record->type, &part, &cnt, &time) == 4) {
		record->id = generic_id(time, part, cnt);
		record->part = part;
@@ -71,7 +71,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
		record->time.tv_nsec = 0;
		record->compressed = false;
		record->ecc_notice_size = 0;
	} else if (sscanf(name, "dump-type%u-%u-%lu",
	} else if (sscanf(name, "dump-type%u-%u-%llu",
			  &record->type, &part, &time) == 3) {
		/*
		 * Check if an old format,
@@ -250,9 +250,10 @@ static int efi_pstore_write(struct pstore_record *record)
	/* Since we copy the entire length of name, make sure it is wiped. */
	memset(name, 0, sizeof(name));

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

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

	snprintf(name, sizeof(name), "dump-type%u-%u-%d-%lu",
	snprintf(name, sizeof(name), "dump-type%u-%u-%d-%lld",
		 record->type, record->part, record->count,
		 record->time.tv_sec);
		 (long long)record->time.tv_sec);
	ret = efi_pstore_erase_name(name);
	if (ret != -ENOENT)
		return ret;

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

	return ret;
+12 −3
Original line number Diff line number Diff line
@@ -867,8 +867,13 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count,
		i = -EIO;
	tty_ldisc_deref(ld);

	if (i > 0)
		tty_update_time(&inode->i_atime);
	if (i > 0) {
		struct timespec ts;

		ts = timespec64_to_timespec(inode->i_atime);
		tty_update_time(&ts);
		inode->i_atime = timespec_to_timespec64(ts);
	}

	return i;
}
@@ -969,7 +974,11 @@ static inline ssize_t do_tty_write(
		cond_resched();
	}
	if (written) {
		tty_update_time(&file_inode(file)->i_mtime);
		struct timespec ts;

		ts = timespec64_to_timespec(file_inode(file)->i_mtime);
		tty_update_time(&ts);
		file_inode(file)->i_mtime = timespec_to_timespec64(ts);
		ret = written;
	}
out:
+1 −1
Original line number Diff line number Diff line
@@ -1308,7 +1308,7 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
	inode = new_inode(sb);

	if (likely(inode)) {
		struct timespec ts = current_time(inode);
		struct timespec64 ts = current_time(inode);

		inode->i_ino	 = get_next_ino();
		inode->i_mode    = perms->mode;
+5 −2
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ adfs_adfs2unix_time(struct timespec *tv, struct inode *inode)
	return;

 cur_time:
	*tv = current_time(inode);
	*tv = timespec64_to_timespec(current_time(inode));
	return;

 too_early:
@@ -242,6 +242,7 @@ adfs_unix2adfs_time(struct inode *inode, unsigned int secs)
struct inode *
adfs_iget(struct super_block *sb, struct object_info *obj)
{
	struct timespec ts;
	struct inode *inode;

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

	inode->i_mode	 = adfs_atts2mode(sb, inode);
	adfs_adfs2unix_time(&inode->i_mtime, inode);
	ts = timespec64_to_timespec(inode->i_mtime);
	adfs_adfs2unix_time(&ts, inode);
	inode->i_mtime = timespec_to_timespec64(ts);
	inode->i_atime = inode->i_mtime;
	inode->i_ctime = inode->i_mtime;

+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ void afs_update_inode_from_status(struct afs_vnode *vnode,
				  const afs_dataversion_t *expected_version,
				  u8 flags)
{
	struct timespec t;
	struct timespec64 t;
	umode_t mode;

	t.tv_sec = status->mtime_client;
Loading