vfs/y2038: inode timestamps conversion to timespec64

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.
 
 There were no conflicts between this and the contents of linux-next
 until just before the merge window, when we saw multiple problems:
 
 - A minor conflict with my own y2038 fixes, which I could address
   by adding another patch on top here.
 - One semantic conflict with late changes to the NFS tree. I addressed
   this by merging Deepa's original branch on top of the changes that
   now got merged into mainline and making sure the merge commit includes
   the necessary changes as produced by coccinelle.
 - A trivial conflict against the removal of staging/lustre.
 - Multiple conflicts against the VFS changes in the overlayfs tree.
   These are still part of linux-next, but apparently this is no longer
   intended for 4.18 [1], so I am ignoring that part.
 
 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.
 
 [1] https://www.spinics.net/lists/linux-fsdevel/msg128294.html
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJbInZAAAoJEGCrR//JCVInReoQAIlVIIMt5ZX6wmaKbrjy9Itf
 MfgbFihQ/djLnuSPVQ3nztcxF0d66BKHZ9puVjz6+mIHqfDvJTRwZs9nU+sOF/T1
 g78fRkM1cxq6ZCkGYAbzyjyo5aC4PnSMP/NQLmwqvi0MXqqrbDoq5ZdP9DHJw39h
 L9lD8FM/P7T29Fgp9tq/pT5l9X8VU8+s5KQG1uhB5hii4VL6pD6JyLElDita7rg+
 Z7/V7jkxIGEUWF7vGaiR1QTFzEtpUA/exDf9cnsf51OGtK/LJfQ0oiZPPuq3oA/E
 LSbt8YQQObc+dvfnGxwgxEg1k5WP5ekj/Wdibv/+rQKgGyLOTz6Q4xK6r8F2ahxs
 nyZQBdXqHhJYyKr1H1reUH3mrSgQbE5U5R1i3My0xV2dSn+vtK5vgF21v2Ku3A1G
 wJratdtF/kVBzSEQUhsYTw14Un+xhBLRWzcq0cELonqxaKvRQK9r92KHLIWNE7/v
 c0TmhFbkZA+zR8HdsaL3iYf1+0W/eYy8PcvepyldKNeW2pVk3CyvdTfY2Z87G2XK
 tIkK+BUWbG3drEGG3hxZ3757Ln3a9qWyC5ruD3mBVkuug/wekbI8PykYJS7Mx4s/
 WNXl0dAL0Eeu1M8uEJejRAe1Q3eXoMWZbvCYZc+wAm92pATfHVcKwPOh8P7NHlfy
 A3HkjIBrKW5AgQDxfgvm
 =CZX2
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Linus Torvalds 2018-06-15 07:31:07 +09:00
commit 7a932516f5
85 changed files with 539 additions and 424 deletions

View File

@ -28,10 +28,9 @@ static int efi_pstore_close(struct pstore_info *psi)
return 0; return 0;
} }
static inline u64 generic_id(unsigned long timestamp, static inline u64 generic_id(u64 timestamp, unsigned int part, int count)
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, 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 i;
int cnt; int cnt;
unsigned int part; unsigned int part;
unsigned long time, size; unsigned long size;
u64 time;
if (efi_guidcmp(entry->var.VendorGuid, vendor)) if (efi_guidcmp(entry->var.VendorGuid, vendor))
return 0; return 0;
@ -50,7 +50,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
for (i = 0; i < DUMP_NAME_LEN; i++) for (i = 0; i < DUMP_NAME_LEN; i++)
name[i] = entry->var.VariableName[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->type, &part, &cnt, &time, &data_type) == 5) {
record->id = generic_id(time, part, cnt); record->id = generic_id(time, part, cnt);
record->part = part; record->part = part;
@ -62,7 +62,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
else else
record->compressed = false; record->compressed = false;
record->ecc_notice_size = 0; 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->type, &part, &cnt, &time) == 4) {
record->id = generic_id(time, part, cnt); record->id = generic_id(time, part, cnt);
record->part = part; record->part = part;
@ -71,7 +71,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
record->time.tv_nsec = 0; record->time.tv_nsec = 0;
record->compressed = false; record->compressed = false;
record->ecc_notice_size = 0; 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) { &record->type, &part, &time) == 3) {
/* /*
* Check if an old format, * 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. */ /* Since we copy the entire length of name, make sure it is wiped. */
memset(name, 0, sizeof(name)); 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->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++) for (i = 0; i < DUMP_NAME_LEN; i++)
efi_name[i] = name[i]; efi_name[i] = name[i];
@ -327,15 +328,15 @@ static int efi_pstore_erase(struct pstore_record *record)
char name[DUMP_NAME_LEN]; char name[DUMP_NAME_LEN];
int ret; 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->type, record->part, record->count,
record->time.tv_sec); (long long)record->time.tv_sec);
ret = efi_pstore_erase_name(name); ret = efi_pstore_erase_name(name);
if (ret != -ENOENT) if (ret != -ENOENT)
return ret; return ret;
snprintf(name, sizeof(name), "dump-type%u-%u-%lu", snprintf(name, sizeof(name), "dump-type%u-%u-%lld",
record->type, record->part, record->time.tv_sec); record->type, record->part, (long long)record->time.tv_sec);
ret = efi_pstore_erase_name(name); ret = efi_pstore_erase_name(name);
return ret; return ret;

View File

@ -867,8 +867,13 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count,
i = -EIO; i = -EIO;
tty_ldisc_deref(ld); tty_ldisc_deref(ld);
if (i > 0) if (i > 0) {
tty_update_time(&inode->i_atime); struct timespec ts;
ts = timespec64_to_timespec(inode->i_atime);
tty_update_time(&ts);
inode->i_atime = timespec_to_timespec64(ts);
}
return i; return i;
} }
@ -969,7 +974,11 @@ static inline ssize_t do_tty_write(
cond_resched(); cond_resched();
} }
if (written) { 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; ret = written;
} }
out: out:

View File

@ -1308,7 +1308,7 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
inode = new_inode(sb); inode = new_inode(sb);
if (likely(inode)) { if (likely(inode)) {
struct timespec ts = current_time(inode); struct timespec64 ts = current_time(inode);
inode->i_ino = get_next_ino(); inode->i_ino = get_next_ino();
inode->i_mode = perms->mode; inode->i_mode = perms->mode;

View File

@ -199,7 +199,7 @@ adfs_adfs2unix_time(struct timespec *tv, struct inode *inode)
return; return;
cur_time: cur_time:
*tv = current_time(inode); *tv = timespec64_to_timespec(current_time(inode));
return; return;
too_early: too_early:
@ -242,6 +242,7 @@ adfs_unix2adfs_time(struct inode *inode, unsigned int secs)
struct inode * struct inode *
adfs_iget(struct super_block *sb, struct object_info *obj) adfs_iget(struct super_block *sb, struct object_info *obj)
{ {
struct timespec ts;
struct inode *inode; struct inode *inode;
inode = new_inode(sb); 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); ADFS_I(inode)->stamped = ((obj->loadaddr & 0xfff00000) == 0xfff00000);
inode->i_mode = adfs_atts2mode(sb, inode); 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_atime = inode->i_mtime;
inode->i_ctime = inode->i_mtime; inode->i_ctime = inode->i_mtime;

View File

@ -72,7 +72,7 @@ void afs_update_inode_from_status(struct afs_vnode *vnode,
const afs_dataversion_t *expected_version, const afs_dataversion_t *expected_version,
u8 flags) u8 flags)
{ {
struct timespec t; struct timespec64 t;
umode_t mode; umode_t mode;
t.tv_sec = status->mtime_client; t.tv_sec = status->mtime_client;

View File

@ -183,13 +183,13 @@ void setattr_copy(struct inode *inode, const struct iattr *attr)
if (ia_valid & ATTR_GID) if (ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid; inode->i_gid = attr->ia_gid;
if (ia_valid & ATTR_ATIME) if (ia_valid & ATTR_ATIME)
inode->i_atime = timespec_trunc(attr->ia_atime, inode->i_atime = timespec64_trunc(attr->ia_atime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (ia_valid & ATTR_MTIME) if (ia_valid & ATTR_MTIME)
inode->i_mtime = timespec_trunc(attr->ia_mtime, inode->i_mtime = timespec64_trunc(attr->ia_mtime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (ia_valid & ATTR_CTIME) if (ia_valid & ATTR_CTIME)
inode->i_ctime = timespec_trunc(attr->ia_ctime, inode->i_ctime = timespec64_trunc(attr->ia_ctime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (ia_valid & ATTR_MODE) { if (ia_valid & ATTR_MODE) {
umode_t mode = attr->ia_mode; umode_t mode = attr->ia_mode;
@ -227,7 +227,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
umode_t mode = inode->i_mode; umode_t mode = inode->i_mode;
int error; int error;
struct timespec now; struct timespec64 now;
unsigned int ia_valid = attr->ia_valid; unsigned int ia_valid = attr->ia_valid;
WARN_ON_ONCE(!inode_is_locked(inode)); WARN_ON_ONCE(!inode_is_locked(inode));

View File

@ -126,7 +126,7 @@ static int bad_inode_fiemap(struct inode *inode,
return -EIO; return -EIO;
} }
static int bad_inode_update_time(struct inode *inode, struct timespec *time, static int bad_inode_update_time(struct inode *inode, struct timespec64 *time,
int flags) int flags)
{ {
return -EIO; return -EIO;

View File

@ -1842,16 +1842,16 @@ out:
static void update_time_for_write(struct inode *inode) static void update_time_for_write(struct inode *inode)
{ {
struct timespec now; struct timespec64 now;
if (IS_NOCMTIME(inode)) if (IS_NOCMTIME(inode))
return; return;
now = current_time(inode); now = current_time(inode);
if (!timespec_equal(&inode->i_mtime, &now)) if (!timespec64_equal(&inode->i_mtime, &now))
inode->i_mtime = now; inode->i_mtime = now;
if (!timespec_equal(&inode->i_ctime, &now)) if (!timespec64_equal(&inode->i_ctime, &now))
inode->i_ctime = now; inode->i_ctime = now;
if (IS_I_VERSION(inode)) if (IS_I_VERSION(inode))

View File

@ -5745,7 +5745,7 @@ static struct inode *new_simple_dir(struct super_block *s,
inode->i_mtime = current_time(inode); inode->i_mtime = current_time(inode);
inode->i_atime = inode->i_mtime; inode->i_atime = inode->i_mtime;
inode->i_ctime = inode->i_mtime; inode->i_ctime = inode->i_mtime;
BTRFS_I(inode)->i_otime = inode->i_mtime; BTRFS_I(inode)->i_otime = timespec64_to_timespec(inode->i_mtime);
return inode; return inode;
} }
@ -6094,7 +6094,7 @@ static int btrfs_dirty_inode(struct inode *inode)
* This is a copy of file_update_time. We need this so we can return error on * This is a copy of file_update_time. We need this so we can return error on
* ENOSPC for updating the inode in the case of file write and mmap writes. * ENOSPC for updating the inode in the case of file write and mmap writes.
*/ */
static int btrfs_update_time(struct inode *inode, struct timespec *now, static int btrfs_update_time(struct inode *inode, struct timespec64 *now,
int flags) int flags)
{ {
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
@ -6349,7 +6349,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
inode->i_mtime = current_time(inode); inode->i_mtime = current_time(inode);
inode->i_atime = inode->i_mtime; inode->i_atime = inode->i_mtime;
inode->i_ctime = inode->i_mtime; inode->i_ctime = inode->i_mtime;
BTRFS_I(inode)->i_otime = inode->i_mtime; BTRFS_I(inode)->i_otime = timespec64_to_timespec(inode->i_mtime);
inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0], inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_inode_item); struct btrfs_inode_item);
@ -9435,7 +9435,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
struct btrfs_root *dest = BTRFS_I(new_dir)->root; struct btrfs_root *dest = BTRFS_I(new_dir)->root;
struct inode *new_inode = new_dentry->d_inode; struct inode *new_inode = new_dentry->d_inode;
struct inode *old_inode = old_dentry->d_inode; struct inode *old_inode = old_dentry->d_inode;
struct timespec ctime = current_time(old_inode); struct timespec64 ctime = current_time(old_inode);
struct dentry *parent; struct dentry *parent;
u64 old_ino = btrfs_ino(BTRFS_I(old_inode)); u64 old_ino = btrfs_ino(BTRFS_I(old_inode));
u64 new_ino = btrfs_ino(BTRFS_I(new_inode)); u64 new_ino = btrfs_ino(BTRFS_I(new_inode));

View File

@ -562,7 +562,7 @@ static noinline int create_subvol(struct inode *dir,
struct btrfs_root *root = BTRFS_I(dir)->root; struct btrfs_root *root = BTRFS_I(dir)->root;
struct btrfs_root *new_root; struct btrfs_root *new_root;
struct btrfs_block_rsv block_rsv; struct btrfs_block_rsv block_rsv;
struct timespec cur_time = current_time(dir); struct timespec64 cur_time = current_time(dir);
struct inode *inode; struct inode *inode;
int ret; int ret;
int err; int err;
@ -5395,7 +5395,7 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file,
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_root_item *root_item = &root->root_item; struct btrfs_root_item *root_item = &root->root_item;
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
struct timespec ct = current_time(inode); struct timespec64 ct = current_time(inode);
int ret = 0; int ret = 0;
int received_uuid_changed; int received_uuid_changed;

View File

@ -485,9 +485,9 @@ void btrfs_update_root_times(struct btrfs_trans_handle *trans,
struct btrfs_root *root) struct btrfs_root *root)
{ {
struct btrfs_root_item *item = &root->root_item; struct btrfs_root_item *item = &root->root_item;
struct timespec ct; struct timespec64 ct;
ktime_get_real_ts(&ct); ktime_get_real_ts64(&ct);
spin_lock(&root->root_item_lock); spin_lock(&root->root_item_lock);
btrfs_set_root_ctransid(item, trans->transid); btrfs_set_root_ctransid(item, trans->transid);
btrfs_set_stack_timespec_sec(&item->ctime, ct.tv_sec); btrfs_set_stack_timespec_sec(&item->ctime, ct.tv_sec);

View File

@ -1422,7 +1422,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
struct dentry *dentry; struct dentry *dentry;
struct extent_buffer *tmp; struct extent_buffer *tmp;
struct extent_buffer *old; struct extent_buffer *old;
struct timespec cur_time; struct timespec64 cur_time;
int ret = 0; int ret = 0;
u64 to_reserve = 0; u64 to_reserve = 0;
u64 index = 0; u64 index = 0;

View File

@ -574,6 +574,7 @@ static u64 get_writepages_data_length(struct inode *inode,
*/ */
static int writepage_nounlock(struct page *page, struct writeback_control *wbc) static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
{ {
struct timespec ts;
struct inode *inode; struct inode *inode;
struct ceph_inode_info *ci; struct ceph_inode_info *ci;
struct ceph_fs_client *fsc; struct ceph_fs_client *fsc;
@ -624,11 +625,12 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
set_bdi_congested(inode_to_bdi(inode), BLK_RW_ASYNC); set_bdi_congested(inode_to_bdi(inode), BLK_RW_ASYNC);
set_page_writeback(page); set_page_writeback(page);
ts = timespec64_to_timespec(inode->i_mtime);
err = ceph_osdc_writepages(&fsc->client->osdc, ceph_vino(inode), err = ceph_osdc_writepages(&fsc->client->osdc, ceph_vino(inode),
&ci->i_layout, snapc, page_off, len, &ci->i_layout, snapc, page_off, len,
ceph_wbc.truncate_seq, ceph_wbc.truncate_seq,
ceph_wbc.truncate_size, ceph_wbc.truncate_size,
&inode->i_mtime, &page, 1); &ts, &page, 1);
if (err < 0) { if (err < 0) {
struct writeback_control tmp_wbc; struct writeback_control tmp_wbc;
if (!wbc) if (!wbc)
@ -1132,7 +1134,7 @@ new_request:
pages = NULL; pages = NULL;
} }
req->r_mtime = inode->i_mtime; req->r_mtime = timespec64_to_timespec(inode->i_mtime);
rc = ceph_osdc_start_request(&fsc->client->osdc, req, true); rc = ceph_osdc_start_request(&fsc->client->osdc, req, true);
BUG_ON(rc); BUG_ON(rc);
req = NULL; req = NULL;
@ -1732,7 +1734,7 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page)
goto out; goto out;
} }
req->r_mtime = inode->i_mtime; req->r_mtime = timespec64_to_timespec(inode->i_mtime);
err = ceph_osdc_start_request(&fsc->client->osdc, req, false); err = ceph_osdc_start_request(&fsc->client->osdc, req, false);
if (!err) if (!err)
err = ceph_osdc_wait_request(&fsc->client->osdc, req); err = ceph_osdc_wait_request(&fsc->client->osdc, req);
@ -1774,7 +1776,7 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page)
goto out_put; goto out_put;
} }
req->r_mtime = inode->i_mtime; req->r_mtime = timespec64_to_timespec(inode->i_mtime);
err = ceph_osdc_start_request(&fsc->client->osdc, req, false); err = ceph_osdc_start_request(&fsc->client->osdc, req, false);
if (!err) if (!err)
err = ceph_osdc_wait_request(&fsc->client->osdc, req); err = ceph_osdc_wait_request(&fsc->client->osdc, req);
@ -1935,7 +1937,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
0, false, true); 0, false, true);
err = ceph_osdc_start_request(&fsc->client->osdc, rd_req, false); err = ceph_osdc_start_request(&fsc->client->osdc, rd_req, false);
wr_req->r_mtime = ci->vfs_inode.i_mtime; wr_req->r_mtime = timespec64_to_timespec(ci->vfs_inode.i_mtime);
err2 = ceph_osdc_start_request(&fsc->client->osdc, wr_req, false); err2 = ceph_osdc_start_request(&fsc->client->osdc, wr_req, false);
if (!err) if (!err)

View File

@ -130,7 +130,7 @@ static enum fscache_checkaux ceph_fscache_inode_check_aux(
memset(&aux, 0, sizeof(aux)); memset(&aux, 0, sizeof(aux));
aux.version = ci->i_version; aux.version = ci->i_version;
aux.mtime = inode->i_mtime; aux.mtime = timespec64_to_timespec(inode->i_mtime);
if (memcmp(data, &aux, sizeof(aux)) != 0) if (memcmp(data, &aux, sizeof(aux)) != 0)
return FSCACHE_CHECKAUX_OBSOLETE; return FSCACHE_CHECKAUX_OBSOLETE;
@ -163,7 +163,7 @@ void ceph_fscache_register_inode_cookie(struct inode *inode)
if (!ci->fscache) { if (!ci->fscache) {
memset(&aux, 0, sizeof(aux)); memset(&aux, 0, sizeof(aux));
aux.version = ci->i_version; aux.version = ci->i_version;
aux.mtime = inode->i_mtime; aux.mtime = timespec64_to_timespec(inode->i_mtime);
ci->fscache = fscache_acquire_cookie(fsc->fscache, ci->fscache = fscache_acquire_cookie(fsc->fscache,
&ceph_fscache_inode_object_def, &ceph_fscache_inode_object_def,
&ci->i_vino, sizeof(ci->i_vino), &ci->i_vino, sizeof(ci->i_vino),

View File

@ -1360,9 +1360,9 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
arg.xattr_buf = NULL; arg.xattr_buf = NULL;
} }
arg.mtime = inode->i_mtime; arg.mtime = timespec64_to_timespec(inode->i_mtime);
arg.atime = inode->i_atime; arg.atime = timespec64_to_timespec(inode->i_atime);
arg.ctime = inode->i_ctime; arg.ctime = timespec64_to_timespec(inode->i_ctime);
arg.op = op; arg.op = op;
arg.caps = cap->implemented; arg.caps = cap->implemented;

View File

@ -923,7 +923,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
int num_pages = 0; int num_pages = 0;
int flags; int flags;
int ret; int ret;
struct timespec mtime = current_time(inode); struct timespec mtime = timespec64_to_timespec(current_time(inode));
size_t count = iov_iter_count(iter); size_t count = iov_iter_count(iter);
loff_t pos = iocb->ki_pos; loff_t pos = iocb->ki_pos;
bool write = iov_iter_rw(iter) == WRITE; bool write = iov_iter_rw(iter) == WRITE;
@ -1131,7 +1131,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
int flags; int flags;
int ret; int ret;
bool check_caps = false; bool check_caps = false;
struct timespec mtime = current_time(inode); struct timespec mtime = timespec64_to_timespec(current_time(inode));
size_t count = iov_iter_count(from); size_t count = iov_iter_count(from);
if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
@ -1663,7 +1663,7 @@ static int ceph_zero_partial_object(struct inode *inode,
goto out; goto out;
} }
req->r_mtime = inode->i_mtime; req->r_mtime = timespec64_to_timespec(inode->i_mtime);
ret = ceph_osdc_start_request(&fsc->client->osdc, req, false); ret = ceph_osdc_start_request(&fsc->client->osdc, req, false);
if (!ret) { if (!ret) {
ret = ceph_osdc_wait_request(&fsc->client->osdc, req); ret = ceph_osdc_wait_request(&fsc->client->osdc, req);

View File

@ -662,6 +662,9 @@ void ceph_fill_file_time(struct inode *inode, int issued,
struct timespec *mtime, struct timespec *atime) struct timespec *mtime, struct timespec *atime)
{ {
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct timespec64 ctime64 = timespec_to_timespec64(*ctime);
struct timespec64 mtime64 = timespec_to_timespec64(*mtime);
struct timespec64 atime64 = timespec_to_timespec64(*atime);
int warn = 0; int warn = 0;
if (issued & (CEPH_CAP_FILE_EXCL| if (issued & (CEPH_CAP_FILE_EXCL|
@ -670,39 +673,39 @@ void ceph_fill_file_time(struct inode *inode, int issued,
CEPH_CAP_AUTH_EXCL| CEPH_CAP_AUTH_EXCL|
CEPH_CAP_XATTR_EXCL)) { CEPH_CAP_XATTR_EXCL)) {
if (ci->i_version == 0 || if (ci->i_version == 0 ||
timespec_compare(ctime, &inode->i_ctime) > 0) { timespec64_compare(&ctime64, &inode->i_ctime) > 0) {
dout("ctime %ld.%09ld -> %ld.%09ld inc w/ cap\n", dout("ctime %lld.%09ld -> %lld.%09ld inc w/ cap\n",
inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, (long long)inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
ctime->tv_sec, ctime->tv_nsec); (long long)ctime->tv_sec, ctime->tv_nsec);
inode->i_ctime = *ctime; inode->i_ctime = ctime64;
} }
if (ci->i_version == 0 || if (ci->i_version == 0 ||
ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) { ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) {
/* the MDS did a utimes() */ /* the MDS did a utimes() */
dout("mtime %ld.%09ld -> %ld.%09ld " dout("mtime %lld.%09ld -> %lld.%09ld "
"tw %d -> %d\n", "tw %d -> %d\n",
inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, (long long)inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
mtime->tv_sec, mtime->tv_nsec, (long long)mtime->tv_sec, mtime->tv_nsec,
ci->i_time_warp_seq, (int)time_warp_seq); ci->i_time_warp_seq, (int)time_warp_seq);
inode->i_mtime = *mtime; inode->i_mtime = mtime64;
inode->i_atime = *atime; inode->i_atime = atime64;
ci->i_time_warp_seq = time_warp_seq; ci->i_time_warp_seq = time_warp_seq;
} else if (time_warp_seq == ci->i_time_warp_seq) { } else if (time_warp_seq == ci->i_time_warp_seq) {
/* nobody did utimes(); take the max */ /* nobody did utimes(); take the max */
if (timespec_compare(mtime, &inode->i_mtime) > 0) { if (timespec64_compare(&mtime64, &inode->i_mtime) > 0) {
dout("mtime %ld.%09ld -> %ld.%09ld inc\n", dout("mtime %lld.%09ld -> %lld.%09ld inc\n",
inode->i_mtime.tv_sec, (long long)inode->i_mtime.tv_sec,
inode->i_mtime.tv_nsec, inode->i_mtime.tv_nsec,
mtime->tv_sec, mtime->tv_nsec); (long long)mtime->tv_sec, mtime->tv_nsec);
inode->i_mtime = *mtime; inode->i_mtime = mtime64;
} }
if (timespec_compare(atime, &inode->i_atime) > 0) { if (timespec64_compare(&atime64, &inode->i_atime) > 0) {
dout("atime %ld.%09ld -> %ld.%09ld inc\n", dout("atime %lld.%09ld -> %lld.%09ld inc\n",
inode->i_atime.tv_sec, (long long)inode->i_atime.tv_sec,
inode->i_atime.tv_nsec, inode->i_atime.tv_nsec,
atime->tv_sec, atime->tv_nsec); (long long)atime->tv_sec, atime->tv_nsec);
inode->i_atime = *atime; inode->i_atime = atime64;
} }
} else if (issued & CEPH_CAP_FILE_EXCL) { } else if (issued & CEPH_CAP_FILE_EXCL) {
/* we did a utimes(); ignore mds values */ /* we did a utimes(); ignore mds values */
@ -712,9 +715,9 @@ void ceph_fill_file_time(struct inode *inode, int issued,
} else { } else {
/* we have no write|excl caps; whatever the MDS says is true */ /* we have no write|excl caps; whatever the MDS says is true */
if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) { if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) {
inode->i_ctime = *ctime; inode->i_ctime = ctime64;
inode->i_mtime = *mtime; inode->i_mtime = mtime64;
inode->i_atime = *atime; inode->i_atime = atime64;
ci->i_time_warp_seq = time_warp_seq; ci->i_time_warp_seq = time_warp_seq;
} else { } else {
warn = 1; warn = 1;
@ -1950,6 +1953,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
int err = 0; int err = 0;
int inode_dirty_flags = 0; int inode_dirty_flags = 0;
bool lock_snap_rwsem = false; bool lock_snap_rwsem = false;
struct timespec ts;
prealloc_cf = ceph_alloc_cap_flush(); prealloc_cf = ceph_alloc_cap_flush();
if (!prealloc_cf) if (!prealloc_cf)
@ -2024,44 +2028,44 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
} }
if (ia_valid & ATTR_ATIME) { if (ia_valid & ATTR_ATIME) {
dout("setattr %p atime %ld.%ld -> %ld.%ld\n", inode, dout("setattr %p atime %lld.%ld -> %lld.%ld\n", inode,
inode->i_atime.tv_sec, inode->i_atime.tv_nsec, (long long)inode->i_atime.tv_sec, inode->i_atime.tv_nsec,
attr->ia_atime.tv_sec, attr->ia_atime.tv_nsec); (long long)attr->ia_atime.tv_sec, attr->ia_atime.tv_nsec);
if (issued & CEPH_CAP_FILE_EXCL) { if (issued & CEPH_CAP_FILE_EXCL) {
ci->i_time_warp_seq++; ci->i_time_warp_seq++;
inode->i_atime = attr->ia_atime; inode->i_atime = attr->ia_atime;
dirtied |= CEPH_CAP_FILE_EXCL; dirtied |= CEPH_CAP_FILE_EXCL;
} else if ((issued & CEPH_CAP_FILE_WR) && } else if ((issued & CEPH_CAP_FILE_WR) &&
timespec_compare(&inode->i_atime, timespec64_compare(&inode->i_atime,
&attr->ia_atime) < 0) { &attr->ia_atime) < 0) {
inode->i_atime = attr->ia_atime; inode->i_atime = attr->ia_atime;
dirtied |= CEPH_CAP_FILE_WR; dirtied |= CEPH_CAP_FILE_WR;
} else if ((issued & CEPH_CAP_FILE_SHARED) == 0 || } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 ||
!timespec_equal(&inode->i_atime, &attr->ia_atime)) { !timespec64_equal(&inode->i_atime, &attr->ia_atime)) {
ceph_encode_timespec(&req->r_args.setattr.atime, ts = timespec64_to_timespec(attr->ia_atime);
&attr->ia_atime); ceph_encode_timespec(&req->r_args.setattr.atime, &ts);
mask |= CEPH_SETATTR_ATIME; mask |= CEPH_SETATTR_ATIME;
release |= CEPH_CAP_FILE_SHARED | release |= CEPH_CAP_FILE_SHARED |
CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR; CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR;
} }
} }
if (ia_valid & ATTR_MTIME) { if (ia_valid & ATTR_MTIME) {
dout("setattr %p mtime %ld.%ld -> %ld.%ld\n", inode, dout("setattr %p mtime %lld.%ld -> %lld.%ld\n", inode,
inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, (long long)inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec); (long long)attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec);
if (issued & CEPH_CAP_FILE_EXCL) { if (issued & CEPH_CAP_FILE_EXCL) {
ci->i_time_warp_seq++; ci->i_time_warp_seq++;
inode->i_mtime = attr->ia_mtime; inode->i_mtime = attr->ia_mtime;
dirtied |= CEPH_CAP_FILE_EXCL; dirtied |= CEPH_CAP_FILE_EXCL;
} else if ((issued & CEPH_CAP_FILE_WR) && } else if ((issued & CEPH_CAP_FILE_WR) &&
timespec_compare(&inode->i_mtime, timespec64_compare(&inode->i_mtime,
&attr->ia_mtime) < 0) { &attr->ia_mtime) < 0) {
inode->i_mtime = attr->ia_mtime; inode->i_mtime = attr->ia_mtime;
dirtied |= CEPH_CAP_FILE_WR; dirtied |= CEPH_CAP_FILE_WR;
} else if ((issued & CEPH_CAP_FILE_SHARED) == 0 || } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 ||
!timespec_equal(&inode->i_mtime, &attr->ia_mtime)) { !timespec64_equal(&inode->i_mtime, &attr->ia_mtime)) {
ceph_encode_timespec(&req->r_args.setattr.mtime, ts = timespec64_to_timespec(attr->ia_mtime);
&attr->ia_mtime); ceph_encode_timespec(&req->r_args.setattr.mtime, &ts);
mask |= CEPH_SETATTR_MTIME; mask |= CEPH_SETATTR_MTIME;
release |= CEPH_CAP_FILE_SHARED | release |= CEPH_CAP_FILE_SHARED |
CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR; CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR;
@ -2091,9 +2095,9 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
if (ia_valid & ATTR_CTIME) { if (ia_valid & ATTR_CTIME) {
bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME| bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME|
ATTR_MODE|ATTR_UID|ATTR_GID)) == 0; ATTR_MODE|ATTR_UID|ATTR_GID)) == 0;
dout("setattr %p ctime %ld.%ld -> %ld.%ld (%s)\n", inode, dout("setattr %p ctime %lld.%ld -> %lld.%ld (%s)\n", inode,
inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, (long long)inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec, (long long)attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec,
only ? "ctime only" : "ignored"); only ? "ctime only" : "ignored");
if (only) { if (only) {
/* /*
@ -2135,7 +2139,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
req->r_inode_drop = release; req->r_inode_drop = release;
req->r_args.setattr.mask = cpu_to_le32(mask); req->r_args.setattr.mask = cpu_to_le32(mask);
req->r_num_caps = 1; req->r_num_caps = 1;
req->r_stamp = attr->ia_ctime; req->r_stamp = timespec64_to_timespec(attr->ia_ctime);
err = ceph_mdsc_do_request(mdsc, NULL, req); err = ceph_mdsc_do_request(mdsc, NULL, req);
} }
dout("setattr %p result=%d (%s locally, %d remote)\n", inode, err, dout("setattr %p result=%d (%s locally, %d remote)\n", inode, err,

View File

@ -2958,12 +2958,15 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap,
rec.v2.flock_len = (__force __le32) rec.v2.flock_len = (__force __le32)
((ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) ? 0 : 1); ((ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) ? 0 : 1);
} else { } else {
struct timespec ts;
rec.v1.cap_id = cpu_to_le64(cap->cap_id); rec.v1.cap_id = cpu_to_le64(cap->cap_id);
rec.v1.wanted = cpu_to_le32(__ceph_caps_wanted(ci)); rec.v1.wanted = cpu_to_le32(__ceph_caps_wanted(ci));
rec.v1.issued = cpu_to_le32(cap->issued); rec.v1.issued = cpu_to_le32(cap->issued);
rec.v1.size = cpu_to_le64(inode->i_size); rec.v1.size = cpu_to_le64(inode->i_size);
ceph_encode_timespec(&rec.v1.mtime, &inode->i_mtime); ts = timespec64_to_timespec(inode->i_mtime);
ceph_encode_timespec(&rec.v1.atime, &inode->i_atime); ceph_encode_timespec(&rec.v1.mtime, &ts);
ts = timespec64_to_timespec(inode->i_atime);
ceph_encode_timespec(&rec.v1.atime, &ts);
rec.v1.snaprealm = cpu_to_le64(ci->i_snap_realm->ino); rec.v1.snaprealm = cpu_to_le64(ci->i_snap_realm->ino);
rec.v1.pathbase = cpu_to_le64(pathbase); rec.v1.pathbase = cpu_to_le64(pathbase);
} }

View File

@ -594,9 +594,9 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
BUG_ON(capsnap->writing); BUG_ON(capsnap->writing);
capsnap->size = inode->i_size; capsnap->size = inode->i_size;
capsnap->mtime = inode->i_mtime; capsnap->mtime = timespec64_to_timespec(inode->i_mtime);
capsnap->atime = inode->i_atime; capsnap->atime = timespec64_to_timespec(inode->i_atime);
capsnap->ctime = inode->i_ctime; capsnap->ctime = timespec64_to_timespec(inode->i_ctime);
capsnap->time_warp_seq = ci->i_time_warp_seq; capsnap->time_warp_seq = ci->i_time_warp_seq;
capsnap->truncate_size = ci->i_truncate_size; capsnap->truncate_size = ci->i_truncate_size;
capsnap->truncate_seq = ci->i_truncate_seq; capsnap->truncate_seq = ci->i_truncate_seq;

View File

@ -128,8 +128,8 @@ fscache_checkaux cifs_fscache_inode_check_aux(void *cookie_netfs_data,
memset(&auxdata, 0, sizeof(auxdata)); memset(&auxdata, 0, sizeof(auxdata));
auxdata.eof = cifsi->server_eof; auxdata.eof = cifsi->server_eof;
auxdata.last_write_time = cifsi->vfs_inode.i_mtime; auxdata.last_write_time = timespec64_to_timespec(cifsi->vfs_inode.i_mtime);
auxdata.last_change_time = cifsi->vfs_inode.i_ctime; auxdata.last_change_time = timespec64_to_timespec(cifsi->vfs_inode.i_ctime);
if (memcmp(data, &auxdata, datalen) != 0) if (memcmp(data, &auxdata, datalen) != 0)
return FSCACHE_CHECKAUX_OBSOLETE; return FSCACHE_CHECKAUX_OBSOLETE;

View File

@ -129,8 +129,8 @@ static void cifs_fscache_acquire_inode_cookie(struct cifsInodeInfo *cifsi,
memset(&auxdata, 0, sizeof(auxdata)); memset(&auxdata, 0, sizeof(auxdata));
auxdata.eof = cifsi->server_eof; auxdata.eof = cifsi->server_eof;
auxdata.last_write_time = cifsi->vfs_inode.i_mtime; auxdata.last_write_time = timespec64_to_timespec(cifsi->vfs_inode.i_mtime);
auxdata.last_change_time = cifsi->vfs_inode.i_ctime; auxdata.last_change_time = timespec64_to_timespec(cifsi->vfs_inode.i_ctime);
cifsi->fscache = cifsi->fscache =
fscache_acquire_cookie(tcon->fscache, fscache_acquire_cookie(tcon->fscache,
@ -166,8 +166,8 @@ void cifs_fscache_release_inode_cookie(struct inode *inode)
if (cifsi->fscache) { if (cifsi->fscache) {
memset(&auxdata, 0, sizeof(auxdata)); memset(&auxdata, 0, sizeof(auxdata));
auxdata.eof = cifsi->server_eof; auxdata.eof = cifsi->server_eof;
auxdata.last_write_time = cifsi->vfs_inode.i_mtime; auxdata.last_write_time = timespec64_to_timespec(cifsi->vfs_inode.i_mtime);
auxdata.last_change_time = cifsi->vfs_inode.i_ctime; auxdata.last_change_time = timespec64_to_timespec(cifsi->vfs_inode.i_ctime);
cifs_dbg(FYI, "%s: (0x%p)\n", __func__, cifsi->fscache); cifs_dbg(FYI, "%s: (0x%p)\n", __func__, cifsi->fscache);
fscache_relinquish_cookie(cifsi->fscache, &auxdata, false); fscache_relinquish_cookie(cifsi->fscache, &auxdata, false);

View File

@ -95,6 +95,7 @@ static void
cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr) cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)
{ {
struct cifsInodeInfo *cifs_i = CIFS_I(inode); struct cifsInodeInfo *cifs_i = CIFS_I(inode);
struct timespec ts;
cifs_dbg(FYI, "%s: revalidating inode %llu\n", cifs_dbg(FYI, "%s: revalidating inode %llu\n",
__func__, cifs_i->uniqueid); __func__, cifs_i->uniqueid);
@ -113,7 +114,8 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)
} }
/* revalidate if mtime or size have changed */ /* revalidate if mtime or size have changed */
if (timespec_equal(&inode->i_mtime, &fattr->cf_mtime) && ts = timespec64_to_timespec(inode->i_mtime);
if (timespec_equal(&ts, &fattr->cf_mtime) &&
cifs_i->server_eof == fattr->cf_eof) { cifs_i->server_eof == fattr->cf_eof) {
cifs_dbg(FYI, "%s: inode %llu is unchanged\n", cifs_dbg(FYI, "%s: inode %llu is unchanged\n",
__func__, cifs_i->uniqueid); __func__, cifs_i->uniqueid);
@ -162,9 +164,9 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr)
cifs_revalidate_cache(inode, fattr); cifs_revalidate_cache(inode, fattr);
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
inode->i_atime = fattr->cf_atime; inode->i_atime = timespec_to_timespec64(fattr->cf_atime);
inode->i_mtime = fattr->cf_mtime; inode->i_mtime = timespec_to_timespec64(fattr->cf_mtime);
inode->i_ctime = fattr->cf_ctime; inode->i_ctime = timespec_to_timespec64(fattr->cf_ctime);
inode->i_rdev = fattr->cf_rdev; inode->i_rdev = fattr->cf_rdev;
cifs_nlink_fattr_to_inode(inode, fattr); cifs_nlink_fattr_to_inode(inode, fattr);
inode->i_uid = fattr->cf_uid; inode->i_uid = fattr->cf_uid;
@ -1123,14 +1125,14 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid,
if (attrs->ia_valid & ATTR_ATIME) { if (attrs->ia_valid & ATTR_ATIME) {
set_time = true; set_time = true;
info_buf.LastAccessTime = info_buf.LastAccessTime =
cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_atime)); cpu_to_le64(cifs_UnixTimeToNT(timespec64_to_timespec(attrs->ia_atime)));
} else } else
info_buf.LastAccessTime = 0; info_buf.LastAccessTime = 0;
if (attrs->ia_valid & ATTR_MTIME) { if (attrs->ia_valid & ATTR_MTIME) {
set_time = true; set_time = true;
info_buf.LastWriteTime = info_buf.LastWriteTime =
cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_mtime)); cpu_to_le64(cifs_UnixTimeToNT(timespec64_to_timespec(attrs->ia_mtime)));
} else } else
info_buf.LastWriteTime = 0; info_buf.LastWriteTime = 0;
@ -1143,7 +1145,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid,
if (set_time && (attrs->ia_valid & ATTR_CTIME)) { if (set_time && (attrs->ia_valid & ATTR_CTIME)) {
cifs_dbg(FYI, "CIFS - CTIME changed\n"); cifs_dbg(FYI, "CIFS - CTIME changed\n");
info_buf.ChangeTime = info_buf.ChangeTime =
cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_ctime)); cpu_to_le64(cifs_UnixTimeToNT(timespec64_to_timespec(attrs->ia_ctime)));
} else } else
info_buf.ChangeTime = 0; info_buf.ChangeTime = 0;
@ -2060,8 +2062,8 @@ int cifs_getattr(const struct path *path, struct kstat *stat,
/* old CIFS Unix Extensions doesn't return create time */ /* old CIFS Unix Extensions doesn't return create time */
if (CIFS_I(inode)->createtime) { if (CIFS_I(inode)->createtime) {
stat->result_mask |= STATX_BTIME; stat->result_mask |= STATX_BTIME;
stat->btime = stat->btime = timespec_to_timespec64(
cifs_NTtimeToUnix(cpu_to_le64(CIFS_I(inode)->createtime)); cifs_NTtimeToUnix(cpu_to_le64(CIFS_I(inode)->createtime)));
} }
stat->attributes_mask |= (STATX_ATTR_COMPRESSED | STATX_ATTR_ENCRYPTED); stat->attributes_mask |= (STATX_ATTR_COMPRESSED | STATX_ATTR_ENCRYPTED);
@ -2267,17 +2269,17 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
args->gid = INVALID_GID; /* no change */ args->gid = INVALID_GID; /* no change */
if (attrs->ia_valid & ATTR_ATIME) if (attrs->ia_valid & ATTR_ATIME)
args->atime = cifs_UnixTimeToNT(attrs->ia_atime); args->atime = cifs_UnixTimeToNT(timespec64_to_timespec(attrs->ia_atime));
else else
args->atime = NO_CHANGE_64; args->atime = NO_CHANGE_64;
if (attrs->ia_valid & ATTR_MTIME) if (attrs->ia_valid & ATTR_MTIME)
args->mtime = cifs_UnixTimeToNT(attrs->ia_mtime); args->mtime = cifs_UnixTimeToNT(timespec64_to_timespec(attrs->ia_mtime));
else else
args->mtime = NO_CHANGE_64; args->mtime = NO_CHANGE_64;
if (attrs->ia_valid & ATTR_CTIME) if (attrs->ia_valid & ATTR_CTIME)
args->ctime = cifs_UnixTimeToNT(attrs->ia_ctime); args->ctime = cifs_UnixTimeToNT(timespec64_to_timespec(attrs->ia_ctime));
else else
args->ctime = NO_CHANGE_64; args->ctime = NO_CHANGE_64;

View File

@ -105,11 +105,11 @@ void coda_vattr_to_iattr(struct inode *inode, struct coda_vattr *attr)
if (attr->va_size != -1) if (attr->va_size != -1)
inode->i_blocks = (attr->va_size + 511) >> 9; inode->i_blocks = (attr->va_size + 511) >> 9;
if (attr->va_atime.tv_sec != -1) if (attr->va_atime.tv_sec != -1)
inode->i_atime = attr->va_atime; inode->i_atime = timespec_to_timespec64(attr->va_atime);
if (attr->va_mtime.tv_sec != -1) if (attr->va_mtime.tv_sec != -1)
inode->i_mtime = attr->va_mtime; inode->i_mtime = timespec_to_timespec64(attr->va_mtime);
if (attr->va_ctime.tv_sec != -1) if (attr->va_ctime.tv_sec != -1)
inode->i_ctime = attr->va_ctime; inode->i_ctime = timespec_to_timespec64(attr->va_ctime);
} }
@ -175,13 +175,13 @@ void coda_iattr_to_vattr(struct iattr *iattr, struct coda_vattr *vattr)
vattr->va_size = iattr->ia_size; vattr->va_size = iattr->ia_size;
} }
if ( valid & ATTR_ATIME ) { if ( valid & ATTR_ATIME ) {
vattr->va_atime = iattr->ia_atime; vattr->va_atime = timespec64_to_timespec(iattr->ia_atime);
} }
if ( valid & ATTR_MTIME ) { if ( valid & ATTR_MTIME ) {
vattr->va_mtime = iattr->ia_mtime; vattr->va_mtime = timespec64_to_timespec(iattr->ia_mtime);
} }
if ( valid & ATTR_CTIME ) { if ( valid & ATTR_CTIME ) {
vattr->va_ctime = iattr->ia_ctime; vattr->va_ctime = timespec64_to_timespec(iattr->ia_ctime);
} }
} }

View File

@ -90,13 +90,13 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
if (ia_valid & ATTR_GID) if (ia_valid & ATTR_GID)
sd_iattr->ia_gid = iattr->ia_gid; sd_iattr->ia_gid = iattr->ia_gid;
if (ia_valid & ATTR_ATIME) if (ia_valid & ATTR_ATIME)
sd_iattr->ia_atime = timespec_trunc(iattr->ia_atime, sd_iattr->ia_atime = timespec64_trunc(iattr->ia_atime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (ia_valid & ATTR_MTIME) if (ia_valid & ATTR_MTIME)
sd_iattr->ia_mtime = timespec_trunc(iattr->ia_mtime, sd_iattr->ia_mtime = timespec64_trunc(iattr->ia_mtime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (ia_valid & ATTR_CTIME) if (ia_valid & ATTR_CTIME)
sd_iattr->ia_ctime = timespec_trunc(iattr->ia_ctime, sd_iattr->ia_ctime = timespec64_trunc(iattr->ia_ctime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (ia_valid & ATTR_MODE) { if (ia_valid & ATTR_MODE) {
umode_t mode = iattr->ia_mode; umode_t mode = iattr->ia_mode;

View File

@ -90,7 +90,7 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
const struct cramfs_inode *cramfs_inode, unsigned int offset) const struct cramfs_inode *cramfs_inode, unsigned int offset)
{ {
struct inode *inode; struct inode *inode;
static struct timespec zerotime; static struct timespec64 zerotime;
inode = iget_locked(sb, cramino(cramfs_inode, offset)); inode = iget_locked(sb, cramino(cramfs_inode, offset));
if (!inode) if (!inode)

View File

@ -820,9 +820,11 @@ static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \
do { \ do { \
(raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \ (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \ if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) {\
struct timespec ts = timespec64_to_timespec((inode)->xtime); \
(raw_inode)->xtime ## _extra = \ (raw_inode)->xtime ## _extra = \
ext4_encode_extra_time(&(inode)->xtime); \ ext4_encode_extra_time(&ts); \
} \
} while (0) } while (0)
#define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \ #define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \
@ -837,13 +839,17 @@ do { \
#define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode) \ #define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode) \
do { \ do { \
(inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \ (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \
if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \ if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) { \
ext4_decode_extra_time(&(inode)->xtime, \ struct timespec ts = timespec64_to_timespec((inode)->xtime); \
ext4_decode_extra_time(&ts, \
raw_inode->xtime ## _extra); \ raw_inode->xtime ## _extra); \
(inode)->xtime = timespec_to_timespec64(ts); \
} \
else \ else \
(inode)->xtime.tv_nsec = 0; \ (inode)->xtime.tv_nsec = 0; \
} while (0) } while (0)
#define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \ #define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \
do { \ do { \
if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \ if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \

View File

@ -1072,8 +1072,8 @@ got:
inode->i_ino = ino + group * EXT4_INODES_PER_GROUP(sb); inode->i_ino = ino + group * EXT4_INODES_PER_GROUP(sb);
/* This is the optimal IO size (for stat), not the fs block size */ /* This is the optimal IO size (for stat), not the fs block size */
inode->i_blocks = 0; inode->i_blocks = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime = inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
current_time(inode); ei->i_crtime = timespec64_to_timespec(inode->i_mtime);
memset(ei->i_data, 0, sizeof(ei->i_data)); memset(ei->i_data, 0, sizeof(ei->i_data));
ei->i_dir_start_lookup = 0; ei->i_dir_start_lookup = 0;

View File

@ -3673,7 +3673,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
}; };
u8 new_file_type; u8 new_file_type;
int retval; int retval;
struct timespec ctime; struct timespec64 ctime;
if ((ext4_test_inode_flag(new_dir, EXT4_INODE_PROJINHERIT) && if ((ext4_test_inode_flag(new_dir, EXT4_INODE_PROJINHERIT) &&
!projid_eq(EXT4_I(new_dir)->i_projid, !projid_eq(EXT4_I(new_dir)->i_projid,

View File

@ -2518,6 +2518,7 @@ static inline void clear_file(struct inode *inode, int type)
static inline bool f2fs_skip_inode_update(struct inode *inode, int dsync) static inline bool f2fs_skip_inode_update(struct inode *inode, int dsync)
{ {
struct timespec ts;
bool ret; bool ret;
if (dsync) { if (dsync) {
@ -2533,11 +2534,14 @@ static inline bool f2fs_skip_inode_update(struct inode *inode, int dsync)
i_size_read(inode) & ~PAGE_MASK) i_size_read(inode) & ~PAGE_MASK)
return false; return false;
if (!timespec_equal(F2FS_I(inode)->i_disk_time, &inode->i_atime)) ts = timespec64_to_timespec(inode->i_atime);
if (!timespec_equal(F2FS_I(inode)->i_disk_time, &ts))
return false; return false;
if (!timespec_equal(F2FS_I(inode)->i_disk_time + 1, &inode->i_ctime)) ts = timespec64_to_timespec(inode->i_ctime);
if (!timespec_equal(F2FS_I(inode)->i_disk_time + 1, &ts))
return false; return false;
if (!timespec_equal(F2FS_I(inode)->i_disk_time + 2, &inode->i_mtime)) ts = timespec64_to_timespec(inode->i_mtime);
if (!timespec_equal(F2FS_I(inode)->i_disk_time + 2, &ts))
return false; return false;
if (!timespec_equal(F2FS_I(inode)->i_disk_time + 3, if (!timespec_equal(F2FS_I(inode)->i_disk_time + 3,
&F2FS_I(inode)->i_crtime)) &F2FS_I(inode)->i_crtime))

View File

@ -730,13 +730,13 @@ static void __setattr_copy(struct inode *inode, const struct iattr *attr)
if (ia_valid & ATTR_GID) if (ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid; inode->i_gid = attr->ia_gid;
if (ia_valid & ATTR_ATIME) if (ia_valid & ATTR_ATIME)
inode->i_atime = timespec_trunc(attr->ia_atime, inode->i_atime = timespec64_trunc(attr->ia_atime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (ia_valid & ATTR_MTIME) if (ia_valid & ATTR_MTIME)
inode->i_mtime = timespec_trunc(attr->ia_mtime, inode->i_mtime = timespec64_trunc(attr->ia_mtime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (ia_valid & ATTR_CTIME) if (ia_valid & ATTR_CTIME)
inode->i_ctime = timespec_trunc(attr->ia_ctime, inode->i_ctime = timespec64_trunc(attr->ia_ctime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (ia_valid & ATTR_MODE) { if (ia_valid & ATTR_MODE) {
umode_t mode = attr->ia_mode; umode_t mode = attr->ia_mode;

View File

@ -297,9 +297,9 @@ static int do_read_inode(struct inode *inode)
fi->i_crtime.tv_nsec = le32_to_cpu(ri->i_crtime_nsec); fi->i_crtime.tv_nsec = le32_to_cpu(ri->i_crtime_nsec);
} }
F2FS_I(inode)->i_disk_time[0] = inode->i_atime; F2FS_I(inode)->i_disk_time[0] = timespec64_to_timespec(inode->i_atime);
F2FS_I(inode)->i_disk_time[1] = inode->i_ctime; F2FS_I(inode)->i_disk_time[1] = timespec64_to_timespec(inode->i_ctime);
F2FS_I(inode)->i_disk_time[2] = inode->i_mtime; F2FS_I(inode)->i_disk_time[2] = timespec64_to_timespec(inode->i_mtime);
F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime; F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime;
f2fs_put_page(node_page, 1); f2fs_put_page(node_page, 1);
@ -470,9 +470,9 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page)
if (inode->i_nlink == 0) if (inode->i_nlink == 0)
clear_inline_node(node_page); clear_inline_node(node_page);
F2FS_I(inode)->i_disk_time[0] = inode->i_atime; F2FS_I(inode)->i_disk_time[0] = timespec64_to_timespec(inode->i_atime);
F2FS_I(inode)->i_disk_time[1] = inode->i_ctime; F2FS_I(inode)->i_disk_time[1] = timespec64_to_timespec(inode->i_ctime);
F2FS_I(inode)->i_disk_time[2] = inode->i_mtime; F2FS_I(inode)->i_disk_time[2] = timespec64_to_timespec(inode->i_mtime);
F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime; F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime;
} }

View File

@ -50,8 +50,8 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
inode->i_ino = ino; inode->i_ino = ino;
inode->i_blocks = 0; inode->i_blocks = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
F2FS_I(inode)->i_crtime = current_time(inode); F2FS_I(inode)->i_crtime = timespec64_to_timespec(inode->i_mtime);
inode->i_generation = sbi->s_next_generation++; inode->i_generation = sbi->s_next_generation++;
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))

View File

@ -502,6 +502,7 @@ static int fat_validate_dir(struct inode *dir)
/* doesn't deal with root inode */ /* doesn't deal with root inode */
int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
{ {
struct timespec ts;
struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
int error; int error;
@ -552,11 +553,14 @@ int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1)) inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1))
& ~((loff_t)sbi->cluster_size - 1)) >> 9; & ~((loff_t)sbi->cluster_size - 1)) >> 9;
fat_time_fat2unix(sbi, &inode->i_mtime, de->time, de->date, 0); fat_time_fat2unix(sbi, &ts, de->time, de->date, 0);
inode->i_mtime = timespec_to_timespec64(ts);
if (sbi->options.isvfat) { if (sbi->options.isvfat) {
fat_time_fat2unix(sbi, &inode->i_ctime, de->ctime, fat_time_fat2unix(sbi, &ts, de->ctime,
de->cdate, de->ctime_cs); de->cdate, de->ctime_cs);
fat_time_fat2unix(sbi, &inode->i_atime, 0, de->adate, 0); inode->i_ctime = timespec_to_timespec64(ts);
fat_time_fat2unix(sbi, &ts, 0, de->adate, 0);
inode->i_atime = timespec_to_timespec64(ts);
} else } else
inode->i_ctime = inode->i_atime = inode->i_mtime; inode->i_ctime = inode->i_atime = inode->i_mtime;
@ -825,6 +829,7 @@ static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
static int __fat_write_inode(struct inode *inode, int wait) static int __fat_write_inode(struct inode *inode, int wait)
{ {
struct timespec ts;
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct msdos_sb_info *sbi = MSDOS_SB(sb); struct msdos_sb_info *sbi = MSDOS_SB(sb);
struct buffer_head *bh; struct buffer_head *bh;
@ -862,13 +867,16 @@ retry:
raw_entry->size = cpu_to_le32(inode->i_size); raw_entry->size = cpu_to_le32(inode->i_size);
raw_entry->attr = fat_make_attrs(inode); raw_entry->attr = fat_make_attrs(inode);
fat_set_start(raw_entry, MSDOS_I(inode)->i_logstart); fat_set_start(raw_entry, MSDOS_I(inode)->i_logstart);
fat_time_unix2fat(sbi, &inode->i_mtime, &raw_entry->time, ts = timespec64_to_timespec(inode->i_mtime);
fat_time_unix2fat(sbi, &ts, &raw_entry->time,
&raw_entry->date, NULL); &raw_entry->date, NULL);
if (sbi->options.isvfat) { if (sbi->options.isvfat) {
__le16 atime; __le16 atime;
fat_time_unix2fat(sbi, &inode->i_ctime, &raw_entry->ctime, ts = timespec64_to_timespec(inode->i_ctime);
fat_time_unix2fat(sbi, &ts, &raw_entry->ctime,
&raw_entry->cdate, &raw_entry->ctime_cs); &raw_entry->cdate, &raw_entry->ctime_cs);
fat_time_unix2fat(sbi, &inode->i_atime, &atime, ts = timespec64_to_timespec(inode->i_atime);
fat_time_unix2fat(sbi, &ts, &atime,
&raw_entry->adate, NULL); &raw_entry->adate, NULL);
} }
spin_unlock(&sbi->inode_hash_lock); spin_unlock(&sbi->inode_hash_lock);

View File

@ -250,7 +250,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,
if (err) if (err)
return err; return err;
dir->i_ctime = dir->i_mtime = *ts; dir->i_ctime = dir->i_mtime = timespec_to_timespec64(*ts);
if (IS_DIRSYNC(dir)) if (IS_DIRSYNC(dir))
(void)fat_sync_inode(dir); (void)fat_sync_inode(dir);
else else
@ -266,7 +266,8 @@ static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode,
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct inode *inode = NULL; struct inode *inode = NULL;
struct fat_slot_info sinfo; struct fat_slot_info sinfo;
struct timespec ts; struct timespec64 ts;
struct timespec t;
unsigned char msdos_name[MSDOS_NAME]; unsigned char msdos_name[MSDOS_NAME];
int err, is_hid; int err, is_hid;
@ -285,7 +286,8 @@ static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode,
} }
ts = current_time(dir); ts = current_time(dir);
err = msdos_add_entry(dir, msdos_name, 0, is_hid, 0, &ts, &sinfo); t = timespec64_to_timespec(ts);
err = msdos_add_entry(dir, msdos_name, 0, is_hid, 0, &t, &sinfo);
if (err) if (err)
goto out; goto out;
inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
@ -344,7 +346,8 @@ static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
struct fat_slot_info sinfo; struct fat_slot_info sinfo;
struct inode *inode; struct inode *inode;
unsigned char msdos_name[MSDOS_NAME]; unsigned char msdos_name[MSDOS_NAME];
struct timespec ts; struct timespec64 ts;
struct timespec t;
int err, is_hid, cluster; int err, is_hid, cluster;
mutex_lock(&MSDOS_SB(sb)->s_lock); mutex_lock(&MSDOS_SB(sb)->s_lock);
@ -362,12 +365,13 @@ static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
} }
ts = current_time(dir); ts = current_time(dir);
cluster = fat_alloc_new_dir(dir, &ts); t = timespec64_to_timespec(ts);
cluster = fat_alloc_new_dir(dir, &t);
if (cluster < 0) { if (cluster < 0) {
err = cluster; err = cluster;
goto out; goto out;
} }
err = msdos_add_entry(dir, msdos_name, 1, is_hid, cluster, &ts, &sinfo); err = msdos_add_entry(dir, msdos_name, 1, is_hid, cluster, &t, &sinfo);
if (err) if (err)
goto out_free; goto out_free;
inc_nlink(dir); inc_nlink(dir);
@ -432,7 +436,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
struct msdos_dir_entry *dotdot_de; struct msdos_dir_entry *dotdot_de;
struct inode *old_inode, *new_inode; struct inode *old_inode, *new_inode;
struct fat_slot_info old_sinfo, sinfo; struct fat_slot_info old_sinfo, sinfo;
struct timespec ts; struct timespec64 ts;
loff_t new_i_pos; loff_t new_i_pos;
int err, old_attrs, is_dir, update_dotdot, corrupt = 0; int err, old_attrs, is_dir, update_dotdot, corrupt = 0;
@ -499,8 +503,9 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
new_i_pos = MSDOS_I(new_inode)->i_pos; new_i_pos = MSDOS_I(new_inode)->i_pos;
fat_detach(new_inode); fat_detach(new_inode);
} else { } else {
struct timespec t = timespec64_to_timespec(ts);
err = msdos_add_entry(new_dir, new_name, is_dir, is_hid, 0, err = msdos_add_entry(new_dir, new_name, is_dir, is_hid, 0,
&ts, &sinfo); &t, &sinfo);
if (err) if (err)
goto out; goto out;
new_i_pos = sinfo.i_pos; new_i_pos = sinfo.i_pos;

View File

@ -678,7 +678,7 @@ static int vfat_add_entry(struct inode *dir, const struct qstr *qname,
goto cleanup; goto cleanup;
/* update timestamp */ /* update timestamp */
dir->i_ctime = dir->i_mtime = dir->i_atime = *ts; dir->i_ctime = dir->i_mtime = dir->i_atime = timespec_to_timespec64(*ts);
if (IS_DIRSYNC(dir)) if (IS_DIRSYNC(dir))
(void)fat_sync_inode(dir); (void)fat_sync_inode(dir);
else else
@ -761,13 +761,15 @@ static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct inode *inode; struct inode *inode;
struct fat_slot_info sinfo; struct fat_slot_info sinfo;
struct timespec ts; struct timespec64 ts;
struct timespec t;
int err; int err;
mutex_lock(&MSDOS_SB(sb)->s_lock); mutex_lock(&MSDOS_SB(sb)->s_lock);
ts = current_time(dir); ts = current_time(dir);
err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &ts, &sinfo); t = timespec64_to_timespec(ts);
err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &t, &sinfo);
if (err) if (err)
goto out; goto out;
inode_inc_iversion(dir); inode_inc_iversion(dir);
@ -850,18 +852,20 @@ static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct inode *inode; struct inode *inode;
struct fat_slot_info sinfo; struct fat_slot_info sinfo;
struct timespec ts; struct timespec64 ts;
struct timespec t;
int err, cluster; int err, cluster;
mutex_lock(&MSDOS_SB(sb)->s_lock); mutex_lock(&MSDOS_SB(sb)->s_lock);
ts = current_time(dir); ts = current_time(dir);
cluster = fat_alloc_new_dir(dir, &ts); t = timespec64_to_timespec(ts);
cluster = fat_alloc_new_dir(dir, &t);
if (cluster < 0) { if (cluster < 0) {
err = cluster; err = cluster;
goto out; goto out;
} }
err = vfat_add_entry(dir, &dentry->d_name, 1, cluster, &ts, &sinfo); err = vfat_add_entry(dir, &dentry->d_name, 1, cluster, &t, &sinfo);
if (err) if (err)
goto out_free; goto out_free;
inode_inc_iversion(dir); inode_inc_iversion(dir);
@ -899,7 +903,8 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
struct msdos_dir_entry *dotdot_de; struct msdos_dir_entry *dotdot_de;
struct inode *old_inode, *new_inode; struct inode *old_inode, *new_inode;
struct fat_slot_info old_sinfo, sinfo; struct fat_slot_info old_sinfo, sinfo;
struct timespec ts; struct timespec64 ts;
struct timespec t;
loff_t new_i_pos; loff_t new_i_pos;
int err, is_dir, update_dotdot, corrupt = 0; int err, is_dir, update_dotdot, corrupt = 0;
struct super_block *sb = old_dir->i_sb; struct super_block *sb = old_dir->i_sb;
@ -934,8 +939,9 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
new_i_pos = MSDOS_I(new_inode)->i_pos; new_i_pos = MSDOS_I(new_inode)->i_pos;
fat_detach(new_inode); fat_detach(new_inode);
} else { } else {
t = timespec64_to_timespec(ts);
err = vfat_add_entry(new_dir, &new_dentry->d_name, is_dir, 0, err = vfat_add_entry(new_dir, &new_dentry->d_name, is_dir, 0,
&ts, &sinfo); &t, &sinfo);
if (err) if (err)
goto out; goto out;
new_i_pos = sinfo.i_pos; new_i_pos = sinfo.i_pos;

View File

@ -217,7 +217,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
return; return;
} }
old_mtime = inode->i_mtime; old_mtime = timespec64_to_timespec(inode->i_mtime);
fuse_change_attributes_common(inode, attr, attr_valid); fuse_change_attributes_common(inode, attr, attr_valid);
oldsize = inode->i_size; oldsize = inode->i_size;

View File

@ -871,7 +871,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
struct buffer_head *bh; struct buffer_head *bh;
struct gfs2_leaf *leaf; struct gfs2_leaf *leaf;
struct gfs2_dirent *dent; struct gfs2_dirent *dent;
struct timespec tv = current_time(inode); struct timespec64 tv = current_time(inode);
error = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL); error = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL);
if (error) if (error)
@ -1802,7 +1802,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct buffer_head *bh = da->bh; struct buffer_head *bh = da->bh;
struct gfs2_dirent *dent = da->dent; struct gfs2_dirent *dent = da->dent;
struct timespec tv; struct timespec64 tv;
struct gfs2_leaf *leaf; struct gfs2_leaf *leaf;
int error; int error;
@ -1880,7 +1880,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry)
const struct qstr *name = &dentry->d_name; const struct qstr *name = &dentry->d_name;
struct gfs2_dirent *dent, *prev = NULL; struct gfs2_dirent *dent, *prev = NULL;
struct buffer_head *bh; struct buffer_head *bh;
struct timespec tv = current_time(&dip->i_inode); struct timespec64 tv = current_time(&dip->i_inode);
/* Returns _either_ the entry (if its first in block) or the /* Returns _either_ the entry (if its first in block) or the
previous entry otherwise */ previous entry otherwise */

View File

@ -338,7 +338,7 @@ static int inode_go_demote_ok(const struct gfs2_glock *gl)
static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
{ {
const struct gfs2_dinode *str = buf; const struct gfs2_dinode *str = buf;
struct timespec atime; struct timespec64 atime;
u16 height, depth; u16 height, depth;
if (unlikely(ip->i_no_addr != be64_to_cpu(str->di_num.no_addr))) if (unlikely(ip->i_no_addr != be64_to_cpu(str->di_num.no_addr)))
@ -361,7 +361,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
gfs2_set_inode_blocks(&ip->i_inode, be64_to_cpu(str->di_blocks)); gfs2_set_inode_blocks(&ip->i_inode, be64_to_cpu(str->di_blocks));
atime.tv_sec = be64_to_cpu(str->di_atime); atime.tv_sec = be64_to_cpu(str->di_atime);
atime.tv_nsec = be32_to_cpu(str->di_atime_nsec); atime.tv_nsec = be32_to_cpu(str->di_atime_nsec);
if (timespec_compare(&ip->i_inode.i_atime, &atime) < 0) if (timespec64_compare(&ip->i_inode.i_atime, &atime) < 0)
ip->i_inode.i_atime = atime; ip->i_inode.i_atime = atime;
ip->i_inode.i_mtime.tv_sec = be64_to_cpu(str->di_mtime); ip->i_inode.i_mtime.tv_sec = be64_to_cpu(str->di_mtime);
ip->i_inode.i_mtime.tv_nsec = be32_to_cpu(str->di_mtime_nsec); ip->i_inode.i_mtime.tv_nsec = be32_to_cpu(str->di_mtime_nsec);

View File

@ -351,7 +351,7 @@ static int hfs_read_inode(struct inode *inode, void *data)
inode->i_mode &= ~hsb->s_file_umask; inode->i_mode &= ~hsb->s_file_umask;
inode->i_mode |= S_IFREG; inode->i_mode |= S_IFREG;
inode->i_ctime = inode->i_atime = inode->i_mtime = inode->i_ctime = inode->i_atime = inode->i_mtime =
hfs_m_to_utime(rec->file.MdDat); timespec_to_timespec64(hfs_m_to_utime(rec->file.MdDat));
inode->i_op = &hfs_file_inode_operations; inode->i_op = &hfs_file_inode_operations;
inode->i_fop = &hfs_file_operations; inode->i_fop = &hfs_file_operations;
inode->i_mapping->a_ops = &hfs_aops; inode->i_mapping->a_ops = &hfs_aops;
@ -362,7 +362,7 @@ static int hfs_read_inode(struct inode *inode, void *data)
HFS_I(inode)->fs_blocks = 0; HFS_I(inode)->fs_blocks = 0;
inode->i_mode = S_IFDIR | (S_IRWXUGO & ~hsb->s_dir_umask); inode->i_mode = S_IFDIR | (S_IRWXUGO & ~hsb->s_dir_umask);
inode->i_ctime = inode->i_atime = inode->i_mtime = inode->i_ctime = inode->i_atime = inode->i_mtime =
hfs_m_to_utime(rec->dir.MdDat); timespec_to_timespec64(hfs_m_to_utime(rec->dir.MdDat));
inode->i_op = &hfs_dir_inode_operations; inode->i_op = &hfs_dir_inode_operations;
inode->i_fop = &hfs_dir_operations; inode->i_fop = &hfs_dir_operations;
break; break;

View File

@ -493,9 +493,9 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
hfsplus_get_perms(inode, &folder->permissions, 1); hfsplus_get_perms(inode, &folder->permissions, 1);
set_nlink(inode, 1); set_nlink(inode, 1);
inode->i_size = 2 + be32_to_cpu(folder->valence); inode->i_size = 2 + be32_to_cpu(folder->valence);
inode->i_atime = hfsp_mt2ut(folder->access_date); inode->i_atime = timespec_to_timespec64(hfsp_mt2ut(folder->access_date));
inode->i_mtime = hfsp_mt2ut(folder->content_mod_date); inode->i_mtime = timespec_to_timespec64(hfsp_mt2ut(folder->content_mod_date));
inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date); inode->i_ctime = timespec_to_timespec64(hfsp_mt2ut(folder->attribute_mod_date));
HFSPLUS_I(inode)->create_date = folder->create_date; HFSPLUS_I(inode)->create_date = folder->create_date;
HFSPLUS_I(inode)->fs_blocks = 0; HFSPLUS_I(inode)->fs_blocks = 0;
if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) { if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) {
@ -531,9 +531,9 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
init_special_inode(inode, inode->i_mode, init_special_inode(inode, inode->i_mode,
be32_to_cpu(file->permissions.dev)); be32_to_cpu(file->permissions.dev));
} }
inode->i_atime = hfsp_mt2ut(file->access_date); inode->i_atime = timespec_to_timespec64(hfsp_mt2ut(file->access_date));
inode->i_mtime = hfsp_mt2ut(file->content_mod_date); inode->i_mtime = timespec_to_timespec64(hfsp_mt2ut(file->content_mod_date));
inode->i_ctime = hfsp_mt2ut(file->attribute_mod_date); inode->i_ctime = timespec_to_timespec64(hfsp_mt2ut(file->attribute_mod_date));
HFSPLUS_I(inode)->create_date = file->create_date; HFSPLUS_I(inode)->create_date = file->create_date;
} else { } else {
pr_err("bad catalog entry used to create inode\n"); pr_err("bad catalog entry used to create inode\n");

View File

@ -555,9 +555,9 @@ static int read_name(struct inode *ino, char *name)
set_nlink(ino, st.nlink); set_nlink(ino, st.nlink);
i_uid_write(ino, st.uid); i_uid_write(ino, st.uid);
i_gid_write(ino, st.gid); i_gid_write(ino, st.gid);
ino->i_atime = st.atime; ino->i_atime = timespec_to_timespec64(st.atime);
ino->i_mtime = st.mtime; ino->i_mtime = timespec_to_timespec64(st.mtime);
ino->i_ctime = st.ctime; ino->i_ctime = timespec_to_timespec64(st.ctime);
ino->i_size = st.size; ino->i_size = st.size;
ino->i_blocks = st.blocks; ino->i_blocks = st.blocks;
return 0; return 0;
@ -838,15 +838,15 @@ static int hostfs_setattr(struct dentry *dentry, struct iattr *attr)
} }
if (attr->ia_valid & ATTR_ATIME) { if (attr->ia_valid & ATTR_ATIME) {
attrs.ia_valid |= HOSTFS_ATTR_ATIME; attrs.ia_valid |= HOSTFS_ATTR_ATIME;
attrs.ia_atime = attr->ia_atime; attrs.ia_atime = timespec64_to_timespec(attr->ia_atime);
} }
if (attr->ia_valid & ATTR_MTIME) { if (attr->ia_valid & ATTR_MTIME) {
attrs.ia_valid |= HOSTFS_ATTR_MTIME; attrs.ia_valid |= HOSTFS_ATTR_MTIME;
attrs.ia_mtime = attr->ia_mtime; attrs.ia_mtime = timespec64_to_timespec(attr->ia_mtime);
} }
if (attr->ia_valid & ATTR_CTIME) { if (attr->ia_valid & ATTR_CTIME) {
attrs.ia_valid |= HOSTFS_ATTR_CTIME; attrs.ia_valid |= HOSTFS_ATTR_CTIME;
attrs.ia_ctime = attr->ia_ctime; attrs.ia_ctime = timespec64_to_timespec(attr->ia_ctime);
} }
if (attr->ia_valid & ATTR_ATIME_SET) { if (attr->ia_valid & ATTR_ATIME_SET) {
attrs.ia_valid |= HOSTFS_ATTR_ATIME_SET; attrs.ia_valid |= HOSTFS_ATTR_ATIME_SET;

View File

@ -1577,8 +1577,8 @@ static void update_ovl_inode_times(struct dentry *dentry, struct inode *inode,
if (upperdentry) { if (upperdentry) {
struct inode *realinode = d_inode(upperdentry); struct inode *realinode = d_inode(upperdentry);
if ((!timespec_equal(&inode->i_mtime, &realinode->i_mtime) || if ((!timespec64_equal(&inode->i_mtime, &realinode->i_mtime) ||
!timespec_equal(&inode->i_ctime, &realinode->i_ctime))) { !timespec64_equal(&inode->i_ctime, &realinode->i_ctime))) {
inode->i_mtime = realinode->i_mtime; inode->i_mtime = realinode->i_mtime;
inode->i_ctime = realinode->i_ctime; inode->i_ctime = realinode->i_ctime;
} }
@ -1601,12 +1601,12 @@ static int relatime_need_update(const struct path *path, struct inode *inode,
/* /*
* Is mtime younger than atime? If yes, update atime: * Is mtime younger than atime? If yes, update atime:
*/ */
if (timespec_compare(&inode->i_mtime, &inode->i_atime) >= 0) if (timespec64_compare(&inode->i_mtime, &inode->i_atime) >= 0)
return 1; return 1;
/* /*
* Is ctime younger than atime? If yes, update atime: * Is ctime younger than atime? If yes, update atime:
*/ */
if (timespec_compare(&inode->i_ctime, &inode->i_atime) >= 0) if (timespec64_compare(&inode->i_ctime, &inode->i_atime) >= 0)
return 1; return 1;
/* /*
@ -1621,7 +1621,7 @@ static int relatime_need_update(const struct path *path, struct inode *inode,
return 0; return 0;
} }
int generic_update_time(struct inode *inode, struct timespec *time, int flags) int generic_update_time(struct inode *inode, struct timespec64 *time, int flags)
{ {
int iflags = I_DIRTY_TIME; int iflags = I_DIRTY_TIME;
bool dirty = false; bool dirty = false;
@ -1649,9 +1649,9 @@ EXPORT_SYMBOL(generic_update_time);
* This does the actual work of updating an inodes time or version. Must have * This does the actual work of updating an inodes time or version. Must have
* had called mnt_want_write() before calling this. * had called mnt_want_write() before calling this.
*/ */
static int update_time(struct inode *inode, struct timespec *time, int flags) static int update_time(struct inode *inode, struct timespec64 *time, int flags)
{ {
int (*update_time)(struct inode *, struct timespec *, int); int (*update_time)(struct inode *, struct timespec64 *, int);
update_time = inode->i_op->update_time ? inode->i_op->update_time : update_time = inode->i_op->update_time ? inode->i_op->update_time :
generic_update_time; generic_update_time;
@ -1672,7 +1672,7 @@ bool __atime_needs_update(const struct path *path, struct inode *inode,
bool rcu) bool rcu)
{ {
struct vfsmount *mnt = path->mnt; struct vfsmount *mnt = path->mnt;
struct timespec now; struct timespec64 now;
if (inode->i_flags & S_NOATIME) if (inode->i_flags & S_NOATIME)
return false; return false;
@ -1695,10 +1695,10 @@ bool __atime_needs_update(const struct path *path, struct inode *inode,
now = current_time(inode); now = current_time(inode);
if (!relatime_need_update(path, inode, now, rcu)) if (!relatime_need_update(path, inode, timespec64_to_timespec(now), rcu))
return false; return false;
if (timespec_equal(&inode->i_atime, &now)) if (timespec64_equal(&inode->i_atime, &now))
return false; return false;
return true; return true;
@ -1708,7 +1708,7 @@ void touch_atime(const struct path *path)
{ {
struct vfsmount *mnt = path->mnt; struct vfsmount *mnt = path->mnt;
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
struct timespec now; struct timespec64 now;
if (!__atime_needs_update(path, inode, false)) if (!__atime_needs_update(path, inode, false))
return; return;
@ -1842,7 +1842,7 @@ EXPORT_SYMBOL(file_remove_privs);
int file_update_time(struct file *file) int file_update_time(struct file *file)
{ {
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct timespec now; struct timespec64 now;
int sync_it = 0; int sync_it = 0;
int ret; int ret;
@ -1851,10 +1851,10 @@ int file_update_time(struct file *file)
return 0; return 0;
now = current_time(inode); now = current_time(inode);
if (!timespec_equal(&inode->i_mtime, &now)) if (!timespec64_equal(&inode->i_mtime, &now))
sync_it = S_MTIME; sync_it = S_MTIME;
if (!timespec_equal(&inode->i_ctime, &now)) if (!timespec64_equal(&inode->i_ctime, &now))
sync_it |= S_CTIME; sync_it |= S_CTIME;
if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode)) if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode))
@ -2097,6 +2097,30 @@ void inode_nohighmem(struct inode *inode)
} }
EXPORT_SYMBOL(inode_nohighmem); EXPORT_SYMBOL(inode_nohighmem);
/**
* timespec64_trunc - Truncate timespec64 to a granularity
* @t: Timespec64
* @gran: Granularity in ns.
*
* Truncate a timespec64 to a granularity. Always rounds down. gran must
* not be 0 nor greater than a second (NSEC_PER_SEC, or 10^9 ns).
*/
struct timespec64 timespec64_trunc(struct timespec64 t, unsigned gran)
{
/* Avoid division in the common cases 1 ns and 1 s. */
if (gran == 1) {
/* nothing */
} else if (gran == NSEC_PER_SEC) {
t.tv_nsec = 0;
} else if (gran > 1 && gran < NSEC_PER_SEC) {
t.tv_nsec -= t.tv_nsec % gran;
} else {
WARN(1, "illegal file time granularity: %u", gran);
}
return t;
}
EXPORT_SYMBOL(timespec64_trunc);
/** /**
* current_time - Return FS time * current_time - Return FS time
* @inode: inode. * @inode: inode.
@ -2107,15 +2131,15 @@ EXPORT_SYMBOL(inode_nohighmem);
* Note that inode and inode->sb cannot be NULL. * Note that inode and inode->sb cannot be NULL.
* Otherwise, the function warns and returns time without truncation. * Otherwise, the function warns and returns time without truncation.
*/ */
struct timespec current_time(struct inode *inode) struct timespec64 current_time(struct inode *inode)
{ {
struct timespec now = current_kernel_time(); struct timespec64 now = current_kernel_time64();
if (unlikely(!inode->i_sb)) { if (unlikely(!inode->i_sb)) {
WARN(1, "current_time() called with uninitialized super_block in the inode"); WARN(1, "current_time() called with uninitialized super_block in the inode");
return now; return now;
} }
return timespec_trunc(now, inode->i_sb->s_time_gran); return timespec64_trunc(now, inode->i_sb->s_time_gran);
} }
EXPORT_SYMBOL(current_time); EXPORT_SYMBOL(current_time);

View File

@ -201,7 +201,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry,
if (ret) if (ret)
goto fail; goto fail;
dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(ri->ctime)); dir_i->i_mtime = dir_i->i_ctime = timespec_to_timespec64(ITIME(je32_to_cpu(ri->ctime)));
jffs2_free_raw_inode(ri); jffs2_free_raw_inode(ri);
@ -234,7 +234,7 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry)
if (dead_f->inocache) if (dead_f->inocache)
set_nlink(d_inode(dentry), dead_f->inocache->pino_nlink); set_nlink(d_inode(dentry), dead_f->inocache->pino_nlink);
if (!ret) if (!ret)
dir_i->i_mtime = dir_i->i_ctime = ITIME(now); dir_i->i_mtime = dir_i->i_ctime = timespec_to_timespec64(ITIME(now));
return ret; return ret;
} }
/***********************************************************************/ /***********************************************************************/
@ -268,7 +268,7 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de
set_nlink(d_inode(old_dentry), ++f->inocache->pino_nlink); set_nlink(d_inode(old_dentry), ++f->inocache->pino_nlink);
mutex_unlock(&f->sem); mutex_unlock(&f->sem);
d_instantiate(dentry, d_inode(old_dentry)); d_instantiate(dentry, d_inode(old_dentry));
dir_i->i_mtime = dir_i->i_ctime = ITIME(now); dir_i->i_mtime = dir_i->i_ctime = timespec_to_timespec64(ITIME(now));
ihold(d_inode(old_dentry)); ihold(d_inode(old_dentry));
} }
return ret; return ret;
@ -418,7 +418,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
goto fail; goto fail;
} }
dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); dir_i->i_mtime = dir_i->i_ctime = timespec_to_timespec64(ITIME(je32_to_cpu(rd->mctime)));
jffs2_free_raw_dirent(rd); jffs2_free_raw_dirent(rd);
@ -561,7 +561,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode
goto fail; goto fail;
} }
dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); dir_i->i_mtime = dir_i->i_ctime = timespec_to_timespec64(ITIME(je32_to_cpu(rd->mctime)));
inc_nlink(dir_i); inc_nlink(dir_i);
jffs2_free_raw_dirent(rd); jffs2_free_raw_dirent(rd);
@ -598,7 +598,7 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name,
dentry->d_name.len, f, now); dentry->d_name.len, f, now);
if (!ret) { if (!ret) {
dir_i->i_mtime = dir_i->i_ctime = ITIME(now); dir_i->i_mtime = dir_i->i_ctime = timespec_to_timespec64(ITIME(now));
clear_nlink(d_inode(dentry)); clear_nlink(d_inode(dentry));
drop_nlink(dir_i); drop_nlink(dir_i);
} }
@ -733,7 +733,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
goto fail; goto fail;
} }
dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); dir_i->i_mtime = dir_i->i_ctime = timespec_to_timespec64(ITIME(je32_to_cpu(rd->mctime)));
jffs2_free_raw_dirent(rd); jffs2_free_raw_dirent(rd);
@ -853,14 +853,14 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
* caller won't do it on its own since we are returning an error. * caller won't do it on its own since we are returning an error.
*/ */
d_invalidate(new_dentry); d_invalidate(new_dentry);
new_dir_i->i_mtime = new_dir_i->i_ctime = ITIME(now); new_dir_i->i_mtime = new_dir_i->i_ctime = timespec_to_timespec64(ITIME(now));
return ret; return ret;
} }
if (d_is_dir(old_dentry)) if (d_is_dir(old_dentry))
drop_nlink(old_dir_i); drop_nlink(old_dir_i);
new_dir_i->i_mtime = new_dir_i->i_ctime = old_dir_i->i_mtime = old_dir_i->i_ctime = ITIME(now); new_dir_i->i_mtime = new_dir_i->i_ctime = old_dir_i->i_mtime = old_dir_i->i_ctime = timespec_to_timespec64(ITIME(now));
return 0; return 0;
} }

View File

@ -308,7 +308,7 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
inode->i_size = pos + writtenlen; inode->i_size = pos + writtenlen;
inode->i_blocks = (inode->i_size + 511) >> 9; inode->i_blocks = (inode->i_size + 511) >> 9;
inode->i_ctime = inode->i_mtime = ITIME(je32_to_cpu(ri->ctime)); inode->i_ctime = inode->i_mtime = timespec_to_timespec64(ITIME(je32_to_cpu(ri->ctime)));
} }
} }

View File

@ -146,9 +146,9 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
return PTR_ERR(new_metadata); return PTR_ERR(new_metadata);
} }
/* It worked. Update the inode */ /* It worked. Update the inode */
inode->i_atime = ITIME(je32_to_cpu(ri->atime)); inode->i_atime = timespec_to_timespec64(ITIME(je32_to_cpu(ri->atime)));
inode->i_ctime = ITIME(je32_to_cpu(ri->ctime)); inode->i_ctime = timespec_to_timespec64(ITIME(je32_to_cpu(ri->ctime)));
inode->i_mtime = ITIME(je32_to_cpu(ri->mtime)); inode->i_mtime = timespec_to_timespec64(ITIME(je32_to_cpu(ri->mtime)));
inode->i_mode = jemode_to_cpu(ri->mode); inode->i_mode = jemode_to_cpu(ri->mode);
i_uid_write(inode, je16_to_cpu(ri->uid)); i_uid_write(inode, je16_to_cpu(ri->uid));
i_gid_write(inode, je16_to_cpu(ri->gid)); i_gid_write(inode, je16_to_cpu(ri->gid));
@ -280,9 +280,9 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
i_uid_write(inode, je16_to_cpu(latest_node.uid)); i_uid_write(inode, je16_to_cpu(latest_node.uid));
i_gid_write(inode, je16_to_cpu(latest_node.gid)); i_gid_write(inode, je16_to_cpu(latest_node.gid));
inode->i_size = je32_to_cpu(latest_node.isize); inode->i_size = je32_to_cpu(latest_node.isize);
inode->i_atime = ITIME(je32_to_cpu(latest_node.atime)); inode->i_atime = timespec_to_timespec64(ITIME(je32_to_cpu(latest_node.atime)));
inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime)); inode->i_mtime = timespec_to_timespec64(ITIME(je32_to_cpu(latest_node.mtime)));
inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime)); inode->i_ctime = timespec_to_timespec64(ITIME(je32_to_cpu(latest_node.ctime)));
set_nlink(inode, f->inocache->pino_nlink); set_nlink(inode, f->inocache->pino_nlink);

View File

@ -779,7 +779,7 @@ int kernfs_add_one(struct kernfs_node *kn)
ps_iattr = parent->iattr; ps_iattr = parent->iattr;
if (ps_iattr) { if (ps_iattr) {
struct iattr *ps_iattrs = &ps_iattr->ia_iattr; struct iattr *ps_iattrs = &ps_iattr->ia_iattr;
ktime_get_real_ts(&ps_iattrs->ia_ctime); ktime_get_real_ts64(&ps_iattrs->ia_ctime);
ps_iattrs->ia_mtime = ps_iattrs->ia_ctime; ps_iattrs->ia_mtime = ps_iattrs->ia_ctime;
} }
@ -1306,7 +1306,7 @@ static void __kernfs_remove(struct kernfs_node *kn)
/* update timestamps on the parent */ /* update timestamps on the parent */
if (ps_iattr) { if (ps_iattr) {
ktime_get_real_ts(&ps_iattr->ia_iattr.ia_ctime); ktime_get_real_ts64(&ps_iattr->ia_iattr.ia_ctime);
ps_iattr->ia_iattr.ia_mtime = ps_iattr->ia_iattr.ia_mtime =
ps_iattr->ia_iattr.ia_ctime; ps_iattr->ia_iattr.ia_ctime;
} }

View File

@ -52,7 +52,7 @@ static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn)
iattrs->ia_uid = GLOBAL_ROOT_UID; iattrs->ia_uid = GLOBAL_ROOT_UID;
iattrs->ia_gid = GLOBAL_ROOT_GID; iattrs->ia_gid = GLOBAL_ROOT_GID;
ktime_get_real_ts(&iattrs->ia_atime); ktime_get_real_ts64(&iattrs->ia_atime);
iattrs->ia_mtime = iattrs->ia_atime; iattrs->ia_mtime = iattrs->ia_atime;
iattrs->ia_ctime = iattrs->ia_atime; iattrs->ia_ctime = iattrs->ia_atime;
@ -176,9 +176,9 @@ static inline void set_inode_attr(struct inode *inode, struct iattr *iattr)
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
inode->i_uid = iattr->ia_uid; inode->i_uid = iattr->ia_uid;
inode->i_gid = iattr->ia_gid; inode->i_gid = iattr->ia_gid;
inode->i_atime = timespec_trunc(iattr->ia_atime, sb->s_time_gran); inode->i_atime = timespec64_trunc(iattr->ia_atime, sb->s_time_gran);
inode->i_mtime = timespec_trunc(iattr->ia_mtime, sb->s_time_gran); inode->i_mtime = timespec64_trunc(iattr->ia_mtime, sb->s_time_gran);
inode->i_ctime = timespec_trunc(iattr->ia_ctime, sb->s_time_gran); inode->i_ctime = timespec64_trunc(iattr->ia_ctime, sb->s_time_gran);
} }
static void kernfs_refresh_inode(struct kernfs_node *kn, struct inode *inode) static void kernfs_refresh_inode(struct kernfs_node *kn, struct inode *inode)

View File

@ -1562,7 +1562,7 @@ EXPORT_SYMBOL(__break_lease);
* exclusive leases. The justification is that if someone has an * exclusive leases. The justification is that if someone has an
* exclusive lease, then they could be modifying it. * exclusive lease, then they could be modifying it.
*/ */
void lease_get_mtime(struct inode *inode, struct timespec *time) void lease_get_mtime(struct inode *inode, struct timespec64 *time)
{ {
bool has_lease = false; bool has_lease = false;
struct file_lock_context *ctx; struct file_lock_context *ctx;

View File

@ -56,8 +56,8 @@ __be32 nfs4_callback_getattr(void *argp, void *resp,
res->change_attr = delegation->change_attr; res->change_attr = delegation->change_attr;
if (nfs_have_writebacks(inode)) if (nfs_have_writebacks(inode))
res->change_attr++; res->change_attr++;
res->ctime = inode->i_ctime; res->ctime = timespec64_to_timespec(inode->i_ctime);
res->mtime = inode->i_mtime; res->mtime = timespec64_to_timespec(inode->i_mtime);
res->bitmap[0] = (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) & res->bitmap[0] = (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) &
args->bitmap[0]; args->bitmap[0];
res->bitmap[1] = (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) & res->bitmap[1] = (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) &

View File

@ -88,8 +88,8 @@ enum fscache_checkaux nfs_fscache_inode_check_aux(void *cookie_netfs_data,
return FSCACHE_CHECKAUX_OBSOLETE; return FSCACHE_CHECKAUX_OBSOLETE;
memset(&auxdata, 0, sizeof(auxdata)); memset(&auxdata, 0, sizeof(auxdata));
auxdata.mtime = nfsi->vfs_inode.i_mtime; auxdata.mtime = timespec64_to_timespec(nfsi->vfs_inode.i_mtime);
auxdata.ctime = nfsi->vfs_inode.i_ctime; auxdata.ctime = timespec64_to_timespec(nfsi->vfs_inode.i_ctime);
if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4) if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4)
auxdata.change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode); auxdata.change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode);

View File

@ -237,8 +237,8 @@ void nfs_fscache_init_inode(struct inode *inode)
return; return;
memset(&auxdata, 0, sizeof(auxdata)); memset(&auxdata, 0, sizeof(auxdata));
auxdata.mtime = nfsi->vfs_inode.i_mtime; auxdata.mtime = timespec64_to_timespec(nfsi->vfs_inode.i_mtime);
auxdata.ctime = nfsi->vfs_inode.i_ctime; auxdata.ctime = timespec64_to_timespec(nfsi->vfs_inode.i_ctime);
if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4) if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4)
auxdata.change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode); auxdata.change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode);
@ -262,8 +262,8 @@ void nfs_fscache_clear_inode(struct inode *inode)
dfprintk(FSCACHE, "NFS: clear cookie (0x%p/0x%p)\n", nfsi, cookie); dfprintk(FSCACHE, "NFS: clear cookie (0x%p/0x%p)\n", nfsi, cookie);
memset(&auxdata, 0, sizeof(auxdata)); memset(&auxdata, 0, sizeof(auxdata));
auxdata.mtime = nfsi->vfs_inode.i_mtime; auxdata.mtime = timespec64_to_timespec(nfsi->vfs_inode.i_mtime);
auxdata.ctime = nfsi->vfs_inode.i_ctime; auxdata.ctime = timespec64_to_timespec(nfsi->vfs_inode.i_ctime);
fscache_relinquish_cookie(cookie, &auxdata, false); fscache_relinquish_cookie(cookie, &auxdata, false);
nfsi->fscache = NULL; nfsi->fscache = NULL;
} }
@ -304,8 +304,8 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp)
return; return;
memset(&auxdata, 0, sizeof(auxdata)); memset(&auxdata, 0, sizeof(auxdata));
auxdata.mtime = nfsi->vfs_inode.i_mtime; auxdata.mtime = timespec64_to_timespec(nfsi->vfs_inode.i_mtime);
auxdata.ctime = nfsi->vfs_inode.i_ctime; auxdata.ctime = timespec64_to_timespec(nfsi->vfs_inode.i_ctime);
if (inode_is_open_for_write(inode)) { if (inode_is_open_for_write(inode)) {
dfprintk(FSCACHE, "NFS: nfsi 0x%p disabling cache\n", nfsi); dfprintk(FSCACHE, "NFS: nfsi 0x%p disabling cache\n", nfsi);

View File

@ -501,15 +501,15 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st
nfsi->read_cache_jiffies = fattr->time_start; nfsi->read_cache_jiffies = fattr->time_start;
nfsi->attr_gencount = fattr->gencount; nfsi->attr_gencount = fattr->gencount;
if (fattr->valid & NFS_ATTR_FATTR_ATIME) if (fattr->valid & NFS_ATTR_FATTR_ATIME)
inode->i_atime = fattr->atime; inode->i_atime = timespec_to_timespec64(fattr->atime);
else if (nfs_server_capable(inode, NFS_CAP_ATIME)) else if (nfs_server_capable(inode, NFS_CAP_ATIME))
nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATIME); nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATIME);
if (fattr->valid & NFS_ATTR_FATTR_MTIME) if (fattr->valid & NFS_ATTR_FATTR_MTIME)
inode->i_mtime = fattr->mtime; inode->i_mtime = timespec_to_timespec64(fattr->mtime);
else if (nfs_server_capable(inode, NFS_CAP_MTIME)) else if (nfs_server_capable(inode, NFS_CAP_MTIME))
nfs_set_cache_invalid(inode, NFS_INO_INVALID_MTIME); nfs_set_cache_invalid(inode, NFS_INO_INVALID_MTIME);
if (fattr->valid & NFS_ATTR_FATTR_CTIME) if (fattr->valid & NFS_ATTR_FATTR_CTIME)
inode->i_ctime = fattr->ctime; inode->i_ctime = timespec_to_timespec64(fattr->ctime);
else if (nfs_server_capable(inode, NFS_CAP_CTIME)) else if (nfs_server_capable(inode, NFS_CAP_CTIME))
nfs_set_cache_invalid(inode, NFS_INO_INVALID_CTIME); nfs_set_cache_invalid(inode, NFS_INO_INVALID_CTIME);
if (fattr->valid & NFS_ATTR_FATTR_CHANGE) if (fattr->valid & NFS_ATTR_FATTR_CHANGE)
@ -694,7 +694,7 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,
if ((attr->ia_valid & ATTR_GID) != 0) if ((attr->ia_valid & ATTR_GID) != 0)
inode->i_gid = attr->ia_gid; inode->i_gid = attr->ia_gid;
if (fattr->valid & NFS_ATTR_FATTR_CTIME) if (fattr->valid & NFS_ATTR_FATTR_CTIME)
inode->i_ctime = fattr->ctime; inode->i_ctime = timespec_to_timespec64(fattr->ctime);
else else
nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE
| NFS_INO_INVALID_CTIME); | NFS_INO_INVALID_CTIME);
@ -705,14 +705,14 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,
NFS_I(inode)->cache_validity &= ~(NFS_INO_INVALID_ATIME NFS_I(inode)->cache_validity &= ~(NFS_INO_INVALID_ATIME
| NFS_INO_INVALID_CTIME); | NFS_INO_INVALID_CTIME);
if (fattr->valid & NFS_ATTR_FATTR_ATIME) if (fattr->valid & NFS_ATTR_FATTR_ATIME)
inode->i_atime = fattr->atime; inode->i_atime = timespec_to_timespec64(fattr->atime);
else if (attr->ia_valid & ATTR_ATIME_SET) else if (attr->ia_valid & ATTR_ATIME_SET)
inode->i_atime = attr->ia_atime; inode->i_atime = attr->ia_atime;
else else
nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATIME); nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATIME);
if (fattr->valid & NFS_ATTR_FATTR_CTIME) if (fattr->valid & NFS_ATTR_FATTR_CTIME)
inode->i_ctime = fattr->ctime; inode->i_ctime = timespec_to_timespec64(fattr->ctime);
else else
nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE
| NFS_INO_INVALID_CTIME); | NFS_INO_INVALID_CTIME);
@ -721,14 +721,14 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,
NFS_I(inode)->cache_validity &= ~(NFS_INO_INVALID_MTIME NFS_I(inode)->cache_validity &= ~(NFS_INO_INVALID_MTIME
| NFS_INO_INVALID_CTIME); | NFS_INO_INVALID_CTIME);
if (fattr->valid & NFS_ATTR_FATTR_MTIME) if (fattr->valid & NFS_ATTR_FATTR_MTIME)
inode->i_mtime = fattr->mtime; inode->i_mtime = timespec_to_timespec64(fattr->mtime);
else if (attr->ia_valid & ATTR_MTIME_SET) else if (attr->ia_valid & ATTR_MTIME_SET)
inode->i_mtime = attr->ia_mtime; inode->i_mtime = attr->ia_mtime;
else else
nfs_set_cache_invalid(inode, NFS_INO_INVALID_MTIME); nfs_set_cache_invalid(inode, NFS_INO_INVALID_MTIME);
if (fattr->valid & NFS_ATTR_FATTR_CTIME) if (fattr->valid & NFS_ATTR_FATTR_CTIME)
inode->i_ctime = fattr->ctime; inode->i_ctime = timespec_to_timespec64(fattr->ctime);
else else
nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE
| NFS_INO_INVALID_CTIME); | NFS_INO_INVALID_CTIME);
@ -1351,6 +1351,8 @@ static bool nfs_file_has_buffered_writers(struct nfs_inode *nfsi)
static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
{ {
struct timespec ts;
if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE) if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE)
&& (fattr->valid & NFS_ATTR_FATTR_CHANGE) && (fattr->valid & NFS_ATTR_FATTR_CHANGE)
&& inode_eq_iversion_raw(inode, fattr->pre_change_attr)) { && inode_eq_iversion_raw(inode, fattr->pre_change_attr)) {
@ -1359,16 +1361,18 @@ static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA);
} }
/* If we have atomic WCC data, we may update some attributes */ /* If we have atomic WCC data, we may update some attributes */
ts = timespec64_to_timespec(inode->i_ctime);
if ((fattr->valid & NFS_ATTR_FATTR_PRECTIME) if ((fattr->valid & NFS_ATTR_FATTR_PRECTIME)
&& (fattr->valid & NFS_ATTR_FATTR_CTIME) && (fattr->valid & NFS_ATTR_FATTR_CTIME)
&& timespec_equal(&inode->i_ctime, &fattr->pre_ctime)) { && timespec_equal(&ts, &fattr->pre_ctime)) {
memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); inode->i_ctime = timespec_to_timespec64(fattr->ctime);
} }
ts = timespec64_to_timespec(inode->i_mtime);
if ((fattr->valid & NFS_ATTR_FATTR_PREMTIME) if ((fattr->valid & NFS_ATTR_FATTR_PREMTIME)
&& (fattr->valid & NFS_ATTR_FATTR_MTIME) && (fattr->valid & NFS_ATTR_FATTR_MTIME)
&& timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) { && timespec_equal(&ts, &fattr->pre_mtime)) {
memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); inode->i_mtime = timespec_to_timespec64(fattr->mtime);
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA);
} }
@ -1394,7 +1398,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
struct nfs_inode *nfsi = NFS_I(inode); struct nfs_inode *nfsi = NFS_I(inode);
loff_t cur_size, new_isize; loff_t cur_size, new_isize;
unsigned long invalid = 0; unsigned long invalid = 0;
struct timespec ts;
if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ))
return 0; return 0;
@ -1411,10 +1415,12 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
invalid |= NFS_INO_INVALID_CHANGE invalid |= NFS_INO_INVALID_CHANGE
| NFS_INO_REVAL_PAGECACHE; | NFS_INO_REVAL_PAGECACHE;
if ((fattr->valid & NFS_ATTR_FATTR_MTIME) && !timespec_equal(&inode->i_mtime, &fattr->mtime)) ts = timespec64_to_timespec(inode->i_mtime);
if ((fattr->valid & NFS_ATTR_FATTR_MTIME) && !timespec_equal(&ts, &fattr->mtime))
invalid |= NFS_INO_INVALID_MTIME; invalid |= NFS_INO_INVALID_MTIME;
if ((fattr->valid & NFS_ATTR_FATTR_CTIME) && !timespec_equal(&inode->i_ctime, &fattr->ctime)) ts = timespec64_to_timespec(inode->i_ctime);
if ((fattr->valid & NFS_ATTR_FATTR_CTIME) && !timespec_equal(&ts, &fattr->ctime))
invalid |= NFS_INO_INVALID_CTIME; invalid |= NFS_INO_INVALID_CTIME;
if (fattr->valid & NFS_ATTR_FATTR_SIZE) { if (fattr->valid & NFS_ATTR_FATTR_SIZE) {
@ -1444,7 +1450,8 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
if ((fattr->valid & NFS_ATTR_FATTR_NLINK) && inode->i_nlink != fattr->nlink) if ((fattr->valid & NFS_ATTR_FATTR_NLINK) && inode->i_nlink != fattr->nlink)
invalid |= NFS_INO_INVALID_OTHER; invalid |= NFS_INO_INVALID_OTHER;
if ((fattr->valid & NFS_ATTR_FATTR_ATIME) && !timespec_equal(&inode->i_atime, &fattr->atime)) ts = timespec64_to_timespec(inode->i_atime);
if ((fattr->valid & NFS_ATTR_FATTR_ATIME) && !timespec_equal(&ts, &fattr->atime))
invalid |= NFS_INO_INVALID_ATIME; invalid |= NFS_INO_INVALID_ATIME;
if (invalid != 0) if (invalid != 0)
@ -1716,12 +1723,12 @@ int nfs_post_op_update_inode_force_wcc_locked(struct inode *inode, struct nfs_fa
} }
if ((fattr->valid & NFS_ATTR_FATTR_CTIME) != 0 && if ((fattr->valid & NFS_ATTR_FATTR_CTIME) != 0 &&
(fattr->valid & NFS_ATTR_FATTR_PRECTIME) == 0) { (fattr->valid & NFS_ATTR_FATTR_PRECTIME) == 0) {
memcpy(&fattr->pre_ctime, &inode->i_ctime, sizeof(fattr->pre_ctime)); fattr->pre_ctime = timespec64_to_timespec(inode->i_ctime);
fattr->valid |= NFS_ATTR_FATTR_PRECTIME; fattr->valid |= NFS_ATTR_FATTR_PRECTIME;
} }
if ((fattr->valid & NFS_ATTR_FATTR_MTIME) != 0 && if ((fattr->valid & NFS_ATTR_FATTR_MTIME) != 0 &&
(fattr->valid & NFS_ATTR_FATTR_PREMTIME) == 0) { (fattr->valid & NFS_ATTR_FATTR_PREMTIME) == 0) {
memcpy(&fattr->pre_mtime, &inode->i_mtime, sizeof(fattr->pre_mtime)); fattr->pre_mtime = timespec64_to_timespec(inode->i_mtime);
fattr->valid |= NFS_ATTR_FATTR_PREMTIME; fattr->valid |= NFS_ATTR_FATTR_PREMTIME;
} }
if ((fattr->valid & NFS_ATTR_FATTR_SIZE) != 0 && if ((fattr->valid & NFS_ATTR_FATTR_SIZE) != 0 &&
@ -1884,7 +1891,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
} }
if (fattr->valid & NFS_ATTR_FATTR_MTIME) { if (fattr->valid & NFS_ATTR_FATTR_MTIME) {
memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); inode->i_mtime = timespec_to_timespec64(fattr->mtime);
} else if (server->caps & NFS_CAP_MTIME) { } else if (server->caps & NFS_CAP_MTIME) {
nfsi->cache_validity |= save_cache_validity & nfsi->cache_validity |= save_cache_validity &
(NFS_INO_INVALID_MTIME (NFS_INO_INVALID_MTIME
@ -1893,7 +1900,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
} }
if (fattr->valid & NFS_ATTR_FATTR_CTIME) { if (fattr->valid & NFS_ATTR_FATTR_CTIME) {
memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); inode->i_ctime = timespec_to_timespec64(fattr->ctime);
} else if (server->caps & NFS_CAP_CTIME) { } else if (server->caps & NFS_CAP_CTIME) {
nfsi->cache_validity |= save_cache_validity & nfsi->cache_validity |= save_cache_validity &
(NFS_INO_INVALID_CTIME (NFS_INO_INVALID_CTIME
@ -1931,7 +1938,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
if (fattr->valid & NFS_ATTR_FATTR_ATIME) if (fattr->valid & NFS_ATTR_FATTR_ATIME)
memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); inode->i_atime = timespec_to_timespec64(fattr->atime);
else if (server->caps & NFS_CAP_ATIME) { else if (server->caps & NFS_CAP_ATIME) {
nfsi->cache_validity |= save_cache_validity & nfsi->cache_validity |= save_cache_validity &
(NFS_INO_INVALID_ATIME (NFS_INO_INVALID_ATIME

View File

@ -354,6 +354,7 @@ static __be32 *xdr_time_not_set(__be32 *p)
static void encode_sattr(struct xdr_stream *xdr, const struct iattr *attr) static void encode_sattr(struct xdr_stream *xdr, const struct iattr *attr)
{ {
struct timespec ts;
__be32 *p; __be32 *p;
p = xdr_reserve_space(xdr, NFS_sattr_sz << 2); p = xdr_reserve_space(xdr, NFS_sattr_sz << 2);
@ -375,17 +376,21 @@ static void encode_sattr(struct xdr_stream *xdr, const struct iattr *attr)
else else
*p++ = cpu_to_be32(NFS2_SATTR_NOT_SET); *p++ = cpu_to_be32(NFS2_SATTR_NOT_SET);
if (attr->ia_valid & ATTR_ATIME_SET) if (attr->ia_valid & ATTR_ATIME_SET) {
p = xdr_encode_time(p, &attr->ia_atime); ts = timespec64_to_timespec(attr->ia_atime);
else if (attr->ia_valid & ATTR_ATIME) p = xdr_encode_time(p, &ts);
p = xdr_encode_current_server_time(p, &attr->ia_atime); } else if (attr->ia_valid & ATTR_ATIME) {
else ts = timespec64_to_timespec(attr->ia_atime);
p = xdr_encode_current_server_time(p, &ts);
} else
p = xdr_time_not_set(p); p = xdr_time_not_set(p);
if (attr->ia_valid & ATTR_MTIME_SET) if (attr->ia_valid & ATTR_MTIME_SET) {
xdr_encode_time(p, &attr->ia_mtime); ts = timespec64_to_timespec(attr->ia_atime);
else if (attr->ia_valid & ATTR_MTIME) xdr_encode_time(p, &ts);
xdr_encode_current_server_time(p, &attr->ia_mtime); } else if (attr->ia_valid & ATTR_MTIME) {
else ts = timespec64_to_timespec(attr->ia_mtime);
xdr_encode_current_server_time(p, &ts);
} else
xdr_time_not_set(p); xdr_time_not_set(p);
} }

View File

@ -561,6 +561,7 @@ static __be32 *xdr_decode_nfstime3(__be32 *p, struct timespec *timep)
*/ */
static void encode_sattr3(struct xdr_stream *xdr, const struct iattr *attr) static void encode_sattr3(struct xdr_stream *xdr, const struct iattr *attr)
{ {
struct timespec ts;
u32 nbytes; u32 nbytes;
__be32 *p; __be32 *p;
@ -610,8 +611,10 @@ static void encode_sattr3(struct xdr_stream *xdr, const struct iattr *attr)
*p++ = xdr_zero; *p++ = xdr_zero;
if (attr->ia_valid & ATTR_ATIME_SET) { if (attr->ia_valid & ATTR_ATIME_SET) {
struct timespec ts;
*p++ = xdr_two; *p++ = xdr_two;
p = xdr_encode_nfstime3(p, &attr->ia_atime); ts = timespec64_to_timespec(attr->ia_atime);
p = xdr_encode_nfstime3(p, &ts);
} else if (attr->ia_valid & ATTR_ATIME) { } else if (attr->ia_valid & ATTR_ATIME) {
*p++ = xdr_one; *p++ = xdr_one;
} else } else
@ -619,7 +622,8 @@ static void encode_sattr3(struct xdr_stream *xdr, const struct iattr *attr)
if (attr->ia_valid & ATTR_MTIME_SET) { if (attr->ia_valid & ATTR_MTIME_SET) {
*p++ = xdr_two; *p++ = xdr_two;
xdr_encode_nfstime3(p, &attr->ia_mtime); ts = timespec64_to_timespec(attr->ia_mtime);
xdr_encode_nfstime3(p, &ts);
} else if (attr->ia_valid & ATTR_MTIME) { } else if (attr->ia_valid & ATTR_MTIME) {
*p = xdr_one; *p = xdr_one;
} else } else

View File

@ -1069,6 +1069,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
const struct nfs_server *server, const struct nfs_server *server,
const uint32_t attrmask[]) const uint32_t attrmask[])
{ {
struct timespec ts;
char owner_name[IDMAP_NAMESZ]; char owner_name[IDMAP_NAMESZ];
char owner_group[IDMAP_NAMESZ]; char owner_group[IDMAP_NAMESZ];
int owner_namelen = 0; int owner_namelen = 0;
@ -1157,14 +1158,16 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
if (bmval[1] & FATTR4_WORD1_TIME_ACCESS_SET) { if (bmval[1] & FATTR4_WORD1_TIME_ACCESS_SET) {
if (iap->ia_valid & ATTR_ATIME_SET) { if (iap->ia_valid & ATTR_ATIME_SET) {
*p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME);
p = xdr_encode_nfstime4(p, &iap->ia_atime); ts = timespec64_to_timespec(iap->ia_atime);
p = xdr_encode_nfstime4(p, &ts);
} else } else
*p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME); *p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME);
} }
if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) { if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) {
if (iap->ia_valid & ATTR_MTIME_SET) { if (iap->ia_valid & ATTR_MTIME_SET) {
*p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME);
p = xdr_encode_nfstime4(p, &iap->ia_mtime); ts = timespec64_to_timespec(iap->ia_mtime);
p = xdr_encode_nfstime4(p, &ts);
} else } else
*p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME); *p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME);
} }

View File

@ -121,13 +121,15 @@ nfsd4_block_commit_blocks(struct inode *inode, struct nfsd4_layoutcommit *lcp,
{ {
loff_t new_size = lcp->lc_last_wr + 1; loff_t new_size = lcp->lc_last_wr + 1;
struct iattr iattr = { .ia_valid = 0 }; struct iattr iattr = { .ia_valid = 0 };
struct timespec ts;
int error; int error;
ts = timespec64_to_timespec(inode->i_mtime);
if (lcp->lc_mtime.tv_nsec == UTIME_NOW || if (lcp->lc_mtime.tv_nsec == UTIME_NOW ||
timespec_compare(&lcp->lc_mtime, &inode->i_mtime) < 0) timespec_compare(&lcp->lc_mtime, &ts) < 0)
lcp->lc_mtime = current_time(inode); lcp->lc_mtime = timespec64_to_timespec(current_time(inode));
iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME; iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME;
iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime; iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = timespec_to_timespec64(lcp->lc_mtime);
if (new_size > i_size_read(inode)) { if (new_size > i_size_read(inode)) {
iattr.ia_valid |= ATTR_SIZE; iattr.ia_valid |= ATTR_SIZE;

View File

@ -165,6 +165,7 @@ static __be32 *
encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
struct kstat *stat) struct kstat *stat)
{ {
struct timespec ts;
*p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]); *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]);
*p++ = htonl((u32) (stat->mode & S_IALLUGO)); *p++ = htonl((u32) (stat->mode & S_IALLUGO));
*p++ = htonl((u32) stat->nlink); *p++ = htonl((u32) stat->nlink);
@ -180,9 +181,12 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
*p++ = htonl((u32) MINOR(stat->rdev)); *p++ = htonl((u32) MINOR(stat->rdev));
p = encode_fsid(p, fhp); p = encode_fsid(p, fhp);
p = xdr_encode_hyper(p, stat->ino); p = xdr_encode_hyper(p, stat->ino);
p = encode_time3(p, &stat->atime); ts = timespec64_to_timespec(stat->atime);
p = encode_time3(p, &stat->mtime); p = encode_time3(p, &ts);
p = encode_time3(p, &stat->ctime); ts = timespec64_to_timespec(stat->mtime);
p = encode_time3(p, &ts);
ts = timespec64_to_timespec(stat->ctime);
p = encode_time3(p, &ts);
return p; return p;
} }
@ -271,8 +275,8 @@ void fill_pre_wcc(struct svc_fh *fhp)
stat.size = inode->i_size; stat.size = inode->i_size;
} }
fhp->fh_pre_mtime = stat.mtime; fhp->fh_pre_mtime = timespec64_to_timespec(stat.mtime);
fhp->fh_pre_ctime = stat.ctime; fhp->fh_pre_ctime = timespec64_to_timespec(stat.ctime);
fhp->fh_pre_size = stat.size; fhp->fh_pre_size = stat.size;
fhp->fh_pre_change = nfsd4_change_attribute(&stat, inode); fhp->fh_pre_change = nfsd4_change_attribute(&stat, inode);
fhp->fh_pre_saved = true; fhp->fh_pre_saved = true;

View File

@ -320,6 +320,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
struct iattr *iattr, struct nfs4_acl **acl, struct iattr *iattr, struct nfs4_acl **acl,
struct xdr_netobj *label, int *umask) struct xdr_netobj *label, int *umask)
{ {
struct timespec ts;
int expected_len, len = 0; int expected_len, len = 0;
u32 dummy32; u32 dummy32;
char *buf; char *buf;
@ -421,7 +422,8 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
switch (dummy32) { switch (dummy32) {
case NFS4_SET_TO_CLIENT_TIME: case NFS4_SET_TO_CLIENT_TIME:
len += 12; len += 12;
status = nfsd4_decode_time(argp, &iattr->ia_atime); status = nfsd4_decode_time(argp, &ts);
iattr->ia_atime = timespec_to_timespec64(ts);
if (status) if (status)
return status; return status;
iattr->ia_valid |= (ATTR_ATIME | ATTR_ATIME_SET); iattr->ia_valid |= (ATTR_ATIME | ATTR_ATIME_SET);
@ -440,7 +442,8 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
switch (dummy32) { switch (dummy32) {
case NFS4_SET_TO_CLIENT_TIME: case NFS4_SET_TO_CLIENT_TIME:
len += 12; len += 12;
status = nfsd4_decode_time(argp, &iattr->ia_mtime); status = nfsd4_decode_time(argp, &ts);
iattr->ia_mtime = timespec_to_timespec64(ts);
if (status) if (status)
return status; return status;
iattr->ia_valid |= (ATTR_MTIME | ATTR_MTIME_SET); iattr->ia_valid |= (ATTR_MTIME | ATTR_MTIME_SET);

View File

@ -131,7 +131,7 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
{ {
struct dentry *dentry = fhp->fh_dentry; struct dentry *dentry = fhp->fh_dentry;
int type; int type;
struct timespec time; struct timespec64 time;
u32 f; u32 f;
type = (stat->mode & S_IFMT); type = (stat->mode & S_IFMT);

View File

@ -667,18 +667,18 @@ static int ntfs_read_locked_inode(struct inode *vi)
* mtime is the last change of the data within the file. Not changed * mtime is the last change of the data within the file. Not changed
* when only metadata is changed, e.g. a rename doesn't affect mtime. * when only metadata is changed, e.g. a rename doesn't affect mtime.
*/ */
vi->i_mtime = ntfs2utc(si->last_data_change_time); vi->i_mtime = timespec_to_timespec64(ntfs2utc(si->last_data_change_time));
/* /*
* ctime is the last change of the metadata of the file. This obviously * ctime is the last change of the metadata of the file. This obviously
* always changes, when mtime is changed. ctime can be changed on its * always changes, when mtime is changed. ctime can be changed on its
* own, mtime is then not changed, e.g. when a file is renamed. * own, mtime is then not changed, e.g. when a file is renamed.
*/ */
vi->i_ctime = ntfs2utc(si->last_mft_change_time); vi->i_ctime = timespec_to_timespec64(ntfs2utc(si->last_mft_change_time));
/* /*
* Last access to the data within the file. Not changed during a rename * Last access to the data within the file. Not changed during a rename
* for example but changed whenever the file is written to. * for example but changed whenever the file is written to.
*/ */
vi->i_atime = ntfs2utc(si->last_access_time); vi->i_atime = timespec_to_timespec64(ntfs2utc(si->last_access_time));
/* Find the attribute list attribute if present. */ /* Find the attribute list attribute if present. */
ntfs_attr_reinit_search_ctx(ctx); ntfs_attr_reinit_search_ctx(ctx);
@ -2804,11 +2804,11 @@ done:
* for real. * for real.
*/ */
if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) { if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) {
struct timespec now = current_time(VFS_I(base_ni)); struct timespec64 now = current_time(VFS_I(base_ni));
int sync_it = 0; int sync_it = 0;
if (!timespec_equal(&VFS_I(base_ni)->i_mtime, &now) || if (!timespec64_equal(&VFS_I(base_ni)->i_mtime, &now) ||
!timespec_equal(&VFS_I(base_ni)->i_ctime, &now)) !timespec64_equal(&VFS_I(base_ni)->i_ctime, &now))
sync_it = 1; sync_it = 1;
VFS_I(base_ni)->i_mtime = now; VFS_I(base_ni)->i_mtime = now;
VFS_I(base_ni)->i_ctime = now; VFS_I(base_ni)->i_ctime = now;
@ -2923,13 +2923,13 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
} }
} }
if (ia_valid & ATTR_ATIME) if (ia_valid & ATTR_ATIME)
vi->i_atime = timespec_trunc(attr->ia_atime, vi->i_atime = timespec64_trunc(attr->ia_atime,
vi->i_sb->s_time_gran); vi->i_sb->s_time_gran);
if (ia_valid & ATTR_MTIME) if (ia_valid & ATTR_MTIME)
vi->i_mtime = timespec_trunc(attr->ia_mtime, vi->i_mtime = timespec64_trunc(attr->ia_mtime,
vi->i_sb->s_time_gran); vi->i_sb->s_time_gran);
if (ia_valid & ATTR_CTIME) if (ia_valid & ATTR_CTIME)
vi->i_ctime = timespec_trunc(attr->ia_ctime, vi->i_ctime = timespec64_trunc(attr->ia_ctime,
vi->i_sb->s_time_gran); vi->i_sb->s_time_gran);
mark_inode_dirty(vi); mark_inode_dirty(vi);
out: out:
@ -2997,7 +2997,7 @@ int __ntfs_write_inode(struct inode *vi, int sync)
si = (STANDARD_INFORMATION*)((u8*)ctx->attr + si = (STANDARD_INFORMATION*)((u8*)ctx->attr +
le16_to_cpu(ctx->attr->data.resident.value_offset)); le16_to_cpu(ctx->attr->data.resident.value_offset));
/* Update the access times if they have changed. */ /* Update the access times if they have changed. */
nt = utc2ntfs(vi->i_mtime); nt = utc2ntfs(timespec64_to_timespec(vi->i_mtime));
if (si->last_data_change_time != nt) { if (si->last_data_change_time != nt) {
ntfs_debug("Updating mtime for inode 0x%lx: old = 0x%llx, " ntfs_debug("Updating mtime for inode 0x%lx: old = 0x%llx, "
"new = 0x%llx", vi->i_ino, (long long) "new = 0x%llx", vi->i_ino, (long long)
@ -3006,7 +3006,7 @@ int __ntfs_write_inode(struct inode *vi, int sync)
si->last_data_change_time = nt; si->last_data_change_time = nt;
modified = true; modified = true;
} }
nt = utc2ntfs(vi->i_ctime); nt = utc2ntfs(timespec64_to_timespec(vi->i_ctime));
if (si->last_mft_change_time != nt) { if (si->last_mft_change_time != nt) {
ntfs_debug("Updating ctime for inode 0x%lx: old = 0x%llx, " ntfs_debug("Updating ctime for inode 0x%lx: old = 0x%llx, "
"new = 0x%llx", vi->i_ino, (long long) "new = 0x%llx", vi->i_ino, (long long)
@ -3015,7 +3015,7 @@ int __ntfs_write_inode(struct inode *vi, int sync)
si->last_mft_change_time = nt; si->last_mft_change_time = nt;
modified = true; modified = true;
} }
nt = utc2ntfs(vi->i_atime); nt = utc2ntfs(timespec64_to_timespec(vi->i_atime));
if (si->last_access_time != nt) { if (si->last_access_time != nt) {
ntfs_debug("Updating atime for inode 0x%lx: old = 0x%llx, " ntfs_debug("Updating atime for inode 0x%lx: old = 0x%llx, "
"new = 0x%llx", vi->i_ino, "new = 0x%llx", vi->i_ino,

View File

@ -2140,6 +2140,7 @@ static void __ocfs2_stuff_meta_lvb(struct inode *inode)
struct ocfs2_inode_info *oi = OCFS2_I(inode); struct ocfs2_inode_info *oi = OCFS2_I(inode);
struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres; struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres;
struct ocfs2_meta_lvb *lvb; struct ocfs2_meta_lvb *lvb;
struct timespec ts;
lvb = ocfs2_dlm_lvb(&lockres->l_lksb); lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
@ -2160,12 +2161,15 @@ static void __ocfs2_stuff_meta_lvb(struct inode *inode)
lvb->lvb_igid = cpu_to_be32(i_gid_read(inode)); lvb->lvb_igid = cpu_to_be32(i_gid_read(inode));
lvb->lvb_imode = cpu_to_be16(inode->i_mode); lvb->lvb_imode = cpu_to_be16(inode->i_mode);
lvb->lvb_inlink = cpu_to_be16(inode->i_nlink); lvb->lvb_inlink = cpu_to_be16(inode->i_nlink);
ts = timespec64_to_timespec(inode->i_atime);
lvb->lvb_iatime_packed = lvb->lvb_iatime_packed =
cpu_to_be64(ocfs2_pack_timespec(&inode->i_atime)); cpu_to_be64(ocfs2_pack_timespec(&ts));
ts = timespec64_to_timespec(inode->i_ctime);
lvb->lvb_ictime_packed = lvb->lvb_ictime_packed =
cpu_to_be64(ocfs2_pack_timespec(&inode->i_ctime)); cpu_to_be64(ocfs2_pack_timespec(&ts));
ts = timespec64_to_timespec(inode->i_mtime);
lvb->lvb_imtime_packed = lvb->lvb_imtime_packed =
cpu_to_be64(ocfs2_pack_timespec(&inode->i_mtime)); cpu_to_be64(ocfs2_pack_timespec(&ts));
lvb->lvb_iattr = cpu_to_be32(oi->ip_attr); lvb->lvb_iattr = cpu_to_be32(oi->ip_attr);
lvb->lvb_idynfeatures = cpu_to_be16(oi->ip_dyn_features); lvb->lvb_idynfeatures = cpu_to_be16(oi->ip_dyn_features);
lvb->lvb_igeneration = cpu_to_be32(inode->i_generation); lvb->lvb_igeneration = cpu_to_be32(inode->i_generation);
@ -2183,6 +2187,7 @@ static void ocfs2_unpack_timespec(struct timespec *spec,
static void ocfs2_refresh_inode_from_lvb(struct inode *inode) static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
{ {
struct timespec ts;
struct ocfs2_inode_info *oi = OCFS2_I(inode); struct ocfs2_inode_info *oi = OCFS2_I(inode);
struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres; struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres;
struct ocfs2_meta_lvb *lvb; struct ocfs2_meta_lvb *lvb;
@ -2210,12 +2215,15 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
i_gid_write(inode, be32_to_cpu(lvb->lvb_igid)); i_gid_write(inode, be32_to_cpu(lvb->lvb_igid));
inode->i_mode = be16_to_cpu(lvb->lvb_imode); inode->i_mode = be16_to_cpu(lvb->lvb_imode);
set_nlink(inode, be16_to_cpu(lvb->lvb_inlink)); set_nlink(inode, be16_to_cpu(lvb->lvb_inlink));
ocfs2_unpack_timespec(&inode->i_atime, ocfs2_unpack_timespec(&ts,
be64_to_cpu(lvb->lvb_iatime_packed)); be64_to_cpu(lvb->lvb_iatime_packed));
ocfs2_unpack_timespec(&inode->i_mtime, inode->i_atime = timespec_to_timespec64(ts);
ocfs2_unpack_timespec(&ts,
be64_to_cpu(lvb->lvb_imtime_packed)); be64_to_cpu(lvb->lvb_imtime_packed));
ocfs2_unpack_timespec(&inode->i_ctime, inode->i_mtime = timespec_to_timespec64(ts);
ocfs2_unpack_timespec(&ts,
be64_to_cpu(lvb->lvb_ictime_packed)); be64_to_cpu(lvb->lvb_ictime_packed));
inode->i_ctime = timespec_to_timespec64(ts);
spin_unlock(&oi->ip_lock); spin_unlock(&oi->ip_lock);
} }

View File

@ -222,7 +222,7 @@ static int ocfs2_sync_file(struct file *file, loff_t start, loff_t end,
int ocfs2_should_update_atime(struct inode *inode, int ocfs2_should_update_atime(struct inode *inode,
struct vfsmount *vfsmnt) struct vfsmount *vfsmnt)
{ {
struct timespec now; struct timespec64 now;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
@ -248,8 +248,8 @@ int ocfs2_should_update_atime(struct inode *inode,
return 0; return 0;
if (vfsmnt->mnt_flags & MNT_RELATIME) { if (vfsmnt->mnt_flags & MNT_RELATIME) {
if ((timespec_compare(&inode->i_atime, &inode->i_mtime) <= 0) || if ((timespec64_compare(&inode->i_atime, &inode->i_mtime) <= 0) ||
(timespec_compare(&inode->i_atime, &inode->i_ctime) <= 0)) (timespec64_compare(&inode->i_atime, &inode->i_ctime) <= 0))
return 1; return 1;
return 0; return 0;

View File

@ -297,7 +297,7 @@ int orangefs_permission(struct inode *inode, int mask)
return generic_permission(inode, mask); return generic_permission(inode, mask);
} }
int orangefs_update_time(struct inode *inode, struct timespec *time, int flags) int orangefs_update_time(struct inode *inode, struct timespec64 *time, int flags)
{ {
struct iattr iattr; struct iattr iattr;
gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_update_time: %pU\n", gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_update_time: %pU\n",

View File

@ -342,7 +342,7 @@ int orangefs_getattr(const struct path *path, struct kstat *stat,
int orangefs_permission(struct inode *inode, int mask); int orangefs_permission(struct inode *inode, int mask);
int orangefs_update_time(struct inode *, struct timespec *, int); int orangefs_update_time(struct inode *, struct timespec64 *, int);
/* /*
* defined in xattr.c * defined in xattr.c

View File

@ -416,7 +416,7 @@ int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags)
return err; return err;
} }
int ovl_update_time(struct inode *inode, struct timespec *ts, int flags) int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags)
{ {
if (flags & S_ATIME) { if (flags & S_ATIME) {
struct ovl_fs *ofs = inode->i_sb->s_fs_info; struct ovl_fs *ofs = inode->i_sb->s_fs_info;

View File

@ -325,7 +325,7 @@ int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name,
ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size);
struct posix_acl *ovl_get_acl(struct inode *inode, int type); struct posix_acl *ovl_get_acl(struct inode *inode, int type);
int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags); int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags);
int ovl_update_time(struct inode *inode, struct timespec *ts, int flags); int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags);
bool ovl_is_private_xattr(const char *name); bool ovl_is_private_xattr(const char *name);
struct ovl_inode_params { struct ovl_inode_params {

View File

@ -10,7 +10,7 @@
static int uptime_proc_show(struct seq_file *m, void *v) static int uptime_proc_show(struct seq_file *m, void *v)
{ {
struct timespec uptime; struct timespec uptime;
struct timespec idle; struct timespec64 idle;
u64 nsec; u64 nsec;
u32 rem; u32 rem;
int i; int i;

View File

@ -328,7 +328,7 @@ void pstore_record_init(struct pstore_record *record,
record->psi = psinfo; record->psi = psinfo;
/* Report zeroed timestamp if called before timekeeping has resumed. */ /* Report zeroed timestamp if called before timekeeping has resumed. */
record->time = ns_to_timespec(ktime_get_real_fast_ns()); record->time = ns_to_timespec64(ktime_get_real_fast_ns());
} }
/* /*

View File

@ -153,20 +153,22 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max,
return prz; return prz;
} }
static int ramoops_read_kmsg_hdr(char *buffer, struct timespec *time, static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time,
bool *compressed) bool *compressed)
{ {
char data_type; char data_type;
int header_length = 0; int header_length = 0;
if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lu.%lu-%c\n%n", &time->tv_sec, if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu-%c\n%n",
&time->tv_nsec, &data_type, &header_length) == 3) { (time64_t *)&time->tv_sec, &time->tv_nsec, &data_type,
&header_length) == 3) {
if (data_type == 'C') if (data_type == 'C')
*compressed = true; *compressed = true;
else else
*compressed = false; *compressed = false;
} else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lu.%lu\n%n", } else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu\n%n",
&time->tv_sec, &time->tv_nsec, &header_length) == 2) { (time64_t *)&time->tv_sec, &time->tv_nsec,
&header_length) == 2) {
*compressed = false; *compressed = false;
} else { } else {
time->tv_sec = 0; time->tv_sec = 0;
@ -360,8 +362,8 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz,
char *hdr; char *hdr;
size_t len; size_t len;
hdr = kasprintf(GFP_ATOMIC, RAMOOPS_KERNMSG_HDR "%lu.%lu-%c\n", hdr = kasprintf(GFP_ATOMIC, RAMOOPS_KERNMSG_HDR "%lld.%06lu-%c\n",
record->time.tv_sec, (time64_t)record->time.tv_sec,
record->time.tv_nsec / 1000, record->time.tv_nsec / 1000,
record->compressed ? 'C' : 'D'); record->compressed ? 'C' : 'D');
WARN_ON_ONCE(!hdr); WARN_ON_ONCE(!hdr);

View File

@ -1316,7 +1316,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
int jbegin_count; int jbegin_count;
umode_t old_inode_mode; umode_t old_inode_mode;
unsigned long savelink = 1; unsigned long savelink = 1;
struct timespec ctime; struct timespec64 ctime;
if (flags & ~RENAME_NOREPLACE) if (flags & ~RENAME_NOREPLACE)
return -EINVAL; return -EINVAL;

View File

@ -451,10 +451,10 @@ int reiserfs_commit_write(struct file *f, struct page *page,
static void update_ctime(struct inode *inode) static void update_ctime(struct inode *inode)
{ {
struct timespec now = current_time(inode); struct timespec64 now = current_time(inode);
if (inode_unhashed(inode) || !inode->i_nlink || if (inode_unhashed(inode) || !inode->i_nlink ||
timespec_equal(&inode->i_ctime, &now)) timespec64_equal(&inode->i_ctime, &now))
return; return;
inode->i_ctime = current_time(inode); inode->i_ctime = current_time(inode);

View File

@ -1276,7 +1276,7 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,
.dirtied_ino = 3 }; .dirtied_ino = 3 };
struct ubifs_budget_req ino_req = { .dirtied_ino = 1, struct ubifs_budget_req ino_req = { .dirtied_ino = 1,
.dirtied_ino_d = ALIGN(old_inode_ui->data_len, 8) }; .dirtied_ino_d = ALIGN(old_inode_ui->data_len, 8) };
struct timespec time; struct timespec64 time;
unsigned int uninitialized_var(saved_nlink); unsigned int uninitialized_var(saved_nlink);
struct fscrypt_name old_nm, new_nm; struct fscrypt_name old_nm, new_nm;
@ -1504,7 +1504,7 @@ static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry,
int sync = IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir); int sync = IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir);
struct inode *fst_inode = d_inode(old_dentry); struct inode *fst_inode = d_inode(old_dentry);
struct inode *snd_inode = d_inode(new_dentry); struct inode *snd_inode = d_inode(new_dentry);
struct timespec time; struct timespec64 time;
int err; int err;
struct fscrypt_name fst_nm, snd_nm; struct fscrypt_name fst_nm, snd_nm;

View File

@ -1089,13 +1089,13 @@ static void do_attr_changes(struct inode *inode, const struct iattr *attr)
if (attr->ia_valid & ATTR_GID) if (attr->ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid; inode->i_gid = attr->ia_gid;
if (attr->ia_valid & ATTR_ATIME) if (attr->ia_valid & ATTR_ATIME)
inode->i_atime = timespec_trunc(attr->ia_atime, inode->i_atime = timespec64_trunc(attr->ia_atime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (attr->ia_valid & ATTR_MTIME) if (attr->ia_valid & ATTR_MTIME)
inode->i_mtime = timespec_trunc(attr->ia_mtime, inode->i_mtime = timespec64_trunc(attr->ia_mtime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (attr->ia_valid & ATTR_CTIME) if (attr->ia_valid & ATTR_CTIME)
inode->i_ctime = timespec_trunc(attr->ia_ctime, inode->i_ctime = timespec64_trunc(attr->ia_ctime,
inode->i_sb->s_time_gran); inode->i_sb->s_time_gran);
if (attr->ia_valid & ATTR_MODE) { if (attr->ia_valid & ATTR_MODE) {
umode_t mode = attr->ia_mode; umode_t mode = attr->ia_mode;
@ -1367,8 +1367,9 @@ out:
static inline int mctime_update_needed(const struct inode *inode, static inline int mctime_update_needed(const struct inode *inode,
const struct timespec *now) const struct timespec *now)
{ {
if (!timespec_equal(&inode->i_mtime, now) || struct timespec64 now64 = timespec_to_timespec64(*now);
!timespec_equal(&inode->i_ctime, now)) if (!timespec64_equal(&inode->i_mtime, &now64) ||
!timespec64_equal(&inode->i_ctime, &now64))
return 1; return 1;
return 0; return 0;
} }
@ -1380,7 +1381,7 @@ static inline int mctime_update_needed(const struct inode *inode,
* *
* This function updates time of the inode. * This function updates time of the inode.
*/ */
int ubifs_update_time(struct inode *inode, struct timespec *time, int ubifs_update_time(struct inode *inode, struct timespec64 *time,
int flags) int flags)
{ {
struct ubifs_inode *ui = ubifs_inode(inode); struct ubifs_inode *ui = ubifs_inode(inode);
@ -1424,7 +1425,7 @@ int ubifs_update_time(struct inode *inode, struct timespec *time,
*/ */
static int update_mctime(struct inode *inode) static int update_mctime(struct inode *inode)
{ {
struct timespec now = current_time(inode); struct timespec now = timespec64_to_timespec(current_time(inode));
struct ubifs_inode *ui = ubifs_inode(inode); struct ubifs_inode *ui = ubifs_inode(inode);
struct ubifs_info *c = inode->i_sb->s_fs_info; struct ubifs_info *c = inode->i_sb->s_fs_info;
@ -1518,7 +1519,7 @@ static vm_fault_t ubifs_vm_page_mkwrite(struct vm_fault *vmf)
struct page *page = vmf->page; struct page *page = vmf->page;
struct inode *inode = file_inode(vmf->vma->vm_file); struct inode *inode = file_inode(vmf->vma->vm_file);
struct ubifs_info *c = inode->i_sb->s_fs_info; struct ubifs_info *c = inode->i_sb->s_fs_info;
struct timespec now = current_time(inode); struct timespec now = timespec64_to_timespec(current_time(inode));
struct ubifs_budget_req req = { .new_page = 1 }; struct ubifs_budget_req req = { .new_page = 1 };
int err, update_time; int err, update_time;

View File

@ -1738,7 +1738,7 @@ int ubifs_calc_dark(const struct ubifs_info *c, int spc);
int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync); int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync);
int ubifs_setattr(struct dentry *dentry, struct iattr *attr); int ubifs_setattr(struct dentry *dentry, struct iattr *attr);
#ifdef CONFIG_UBIFS_ATIME_SUPPORT #ifdef CONFIG_UBIFS_ATIME_SUPPORT
int ubifs_update_time(struct inode *inode, struct timespec *time, int flags); int ubifs_update_time(struct inode *inode, struct timespec64 *time, int flags);
#endif #endif
/* dir.c */ /* dir.c */

View File

@ -124,8 +124,8 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT;
else else
iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
inode->i_mtime = inode->i_atime = inode->i_ctime = inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
iinfo->i_crtime = current_time(inode); iinfo->i_crtime = timespec64_to_timespec(inode->i_mtime);
if (unlikely(insert_inode_locked(inode) < 0)) { if (unlikely(insert_inode_locked(inode) < 0)) {
make_bad_inode(inode); make_bad_inode(inode);
iput(inode); iput(inode);

View File

@ -1271,6 +1271,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
struct udf_inode_info *iinfo = UDF_I(inode); struct udf_inode_info *iinfo = UDF_I(inode);
struct udf_sb_info *sbi = UDF_SB(inode->i_sb); struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
struct kernel_lb_addr *iloc = &iinfo->i_location; struct kernel_lb_addr *iloc = &iinfo->i_location;
struct timespec ts;
unsigned int link_count; unsigned int link_count;
unsigned int indirections = 0; unsigned int indirections = 0;
int bs = inode->i_sb->s_blocksize; int bs = inode->i_sb->s_blocksize;
@ -1443,15 +1444,12 @@ reread:
inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) <<
(inode->i_sb->s_blocksize_bits - 9); (inode->i_sb->s_blocksize_bits - 9);
if (!udf_disk_stamp_to_time(&inode->i_atime, fe->accessTime)) udf_disk_stamp_to_time(&ts, fe->accessTime);
inode->i_atime = sbi->s_record_time; inode->i_atime = timespec_to_timespec64(ts);
udf_disk_stamp_to_time(&ts, fe->modificationTime);
if (!udf_disk_stamp_to_time(&inode->i_mtime, inode->i_mtime = timespec_to_timespec64(ts);
fe->modificationTime)) udf_disk_stamp_to_time(&ts, fe->attrTime);
inode->i_mtime = sbi->s_record_time; inode->i_ctime = timespec_to_timespec64(ts);
if (!udf_disk_stamp_to_time(&inode->i_ctime, fe->attrTime))
inode->i_ctime = sbi->s_record_time;
iinfo->i_unique = le64_to_cpu(fe->uniqueID); iinfo->i_unique = le64_to_cpu(fe->uniqueID);
iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr);
@ -1461,18 +1459,13 @@ reread:
inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) <<
(inode->i_sb->s_blocksize_bits - 9); (inode->i_sb->s_blocksize_bits - 9);
if (!udf_disk_stamp_to_time(&inode->i_atime, efe->accessTime)) udf_disk_stamp_to_time(&ts, efe->accessTime);
inode->i_atime = sbi->s_record_time; inode->i_atime = timespec_to_timespec64(ts);
udf_disk_stamp_to_time(&ts, efe->modificationTime);
if (!udf_disk_stamp_to_time(&inode->i_mtime, inode->i_mtime = timespec_to_timespec64(ts);
efe->modificationTime)) udf_disk_stamp_to_time(&iinfo->i_crtime, efe->createTime);
inode->i_mtime = sbi->s_record_time; udf_disk_stamp_to_time(&ts, efe->attrTime);
inode->i_ctime = timespec_to_timespec64(ts);
if (!udf_disk_stamp_to_time(&iinfo->i_crtime, efe->createTime))
iinfo->i_crtime = sbi->s_record_time;
if (!udf_disk_stamp_to_time(&inode->i_ctime, efe->attrTime))
inode->i_ctime = sbi->s_record_time;
iinfo->i_unique = le64_to_cpu(efe->uniqueID); iinfo->i_unique = le64_to_cpu(efe->uniqueID);
iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr);
@ -1722,9 +1715,12 @@ static int udf_update_inode(struct inode *inode, int do_sync)
inode->i_sb->s_blocksize - sizeof(struct fileEntry)); inode->i_sb->s_blocksize - sizeof(struct fileEntry));
fe->logicalBlocksRecorded = cpu_to_le64(lb_recorded); fe->logicalBlocksRecorded = cpu_to_le64(lb_recorded);
udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime); udf_time_to_disk_stamp(&fe->accessTime,
udf_time_to_disk_stamp(&fe->modificationTime, inode->i_mtime); timespec64_to_timespec(inode->i_atime));
udf_time_to_disk_stamp(&fe->attrTime, inode->i_ctime); udf_time_to_disk_stamp(&fe->modificationTime,
timespec64_to_timespec(inode->i_mtime));
udf_time_to_disk_stamp(&fe->attrTime,
timespec64_to_timespec(inode->i_ctime));
memset(&(fe->impIdent), 0, sizeof(struct regid)); memset(&(fe->impIdent), 0, sizeof(struct regid));
strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER);
fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
@ -1743,14 +1739,17 @@ static int udf_update_inode(struct inode *inode, int do_sync)
efe->objectSize = cpu_to_le64(inode->i_size); efe->objectSize = cpu_to_le64(inode->i_size);
efe->logicalBlocksRecorded = cpu_to_le64(lb_recorded); efe->logicalBlocksRecorded = cpu_to_le64(lb_recorded);
udf_adjust_time(iinfo, inode->i_atime); udf_adjust_time(iinfo, timespec64_to_timespec(inode->i_atime));
udf_adjust_time(iinfo, inode->i_mtime); udf_adjust_time(iinfo, timespec64_to_timespec(inode->i_mtime));
udf_adjust_time(iinfo, inode->i_ctime); udf_adjust_time(iinfo, timespec64_to_timespec(inode->i_ctime));
udf_time_to_disk_stamp(&efe->accessTime, inode->i_atime); udf_time_to_disk_stamp(&efe->accessTime,
udf_time_to_disk_stamp(&efe->modificationTime, inode->i_mtime); timespec64_to_timespec(inode->i_atime));
udf_time_to_disk_stamp(&efe->modificationTime,
timespec64_to_timespec(inode->i_mtime));
udf_time_to_disk_stamp(&efe->createTime, iinfo->i_crtime); udf_time_to_disk_stamp(&efe->createTime, iinfo->i_crtime);
udf_time_to_disk_stamp(&efe->attrTime, inode->i_ctime); udf_time_to_disk_stamp(&efe->attrTime,
timespec64_to_timespec(inode->i_ctime));
memset(&(efe->impIdent), 0, sizeof(efe->impIdent)); memset(&(efe->impIdent), 0, sizeof(efe->impIdent));
strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER);

View File

@ -862,6 +862,9 @@ static int udf_load_pvoldesc(struct super_block *sb, sector_t block)
struct buffer_head *bh; struct buffer_head *bh;
uint16_t ident; uint16_t ident;
int ret = -ENOMEM; int ret = -ENOMEM;
#ifdef UDFFS_DEBUG
struct timestamp *ts;
#endif
outstr = kmalloc(128, GFP_NOFS); outstr = kmalloc(128, GFP_NOFS);
if (!outstr) if (!outstr)
@ -880,15 +883,15 @@ static int udf_load_pvoldesc(struct super_block *sb, sector_t block)
pvoldesc = (struct primaryVolDesc *)bh->b_data; pvoldesc = (struct primaryVolDesc *)bh->b_data;
if (udf_disk_stamp_to_time(&UDF_SB(sb)->s_record_time, udf_disk_stamp_to_time(&UDF_SB(sb)->s_record_time,
pvoldesc->recordingDateAndTime)) { pvoldesc->recordingDateAndTime);
#ifdef UDFFS_DEBUG #ifdef UDFFS_DEBUG
struct timestamp *ts = &pvoldesc->recordingDateAndTime; ts = &pvoldesc->recordingDateAndTime;
udf_debug("recording time %04u/%02u/%02u %02u:%02u (%x)\n", udf_debug("recording time %04u/%02u/%02u %02u:%02u (%x)\n",
le16_to_cpu(ts->year), ts->month, ts->day, ts->hour, le16_to_cpu(ts->year), ts->month, ts->day, ts->hour,
ts->minute, le16_to_cpu(ts->typeAndTimezone)); ts->minute, le16_to_cpu(ts->typeAndTimezone));
#endif #endif
}
ret = udf_dstrCS0toChar(sb, outstr, 31, pvoldesc->volIdent, 32); ret = udf_dstrCS0toChar(sb, outstr, 31, pvoldesc->volIdent, 32);
if (ret < 0) if (ret < 0)

View File

@ -253,8 +253,8 @@ extern struct long_ad *udf_get_filelongad(uint8_t *, int, uint32_t *, int);
extern struct short_ad *udf_get_fileshortad(uint8_t *, int, uint32_t *, int); extern struct short_ad *udf_get_fileshortad(uint8_t *, int, uint32_t *, int);
/* udftime.c */ /* udftime.c */
extern struct timespec *udf_disk_stamp_to_time(struct timespec *dest, extern void udf_disk_stamp_to_time(struct timespec *dest,
struct timestamp src); struct timestamp src);
extern struct timestamp *udf_time_to_disk_stamp(struct timestamp *dest, struct timespec src); extern void udf_time_to_disk_stamp(struct timestamp *dest, struct timespec src);
#endif /* __UDF_DECL_H */ #endif /* __UDF_DECL_H */

View File

@ -40,7 +40,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/time.h> #include <linux/time.h>
struct timespec * void
udf_disk_stamp_to_time(struct timespec *dest, struct timestamp src) udf_disk_stamp_to_time(struct timespec *dest, struct timestamp src)
{ {
u16 typeAndTimezone = le16_to_cpu(src.typeAndTimezone); u16 typeAndTimezone = le16_to_cpu(src.typeAndTimezone);
@ -67,10 +67,9 @@ udf_disk_stamp_to_time(struct timespec *dest, struct timestamp src)
* recorded with bogus sub-second values. * recorded with bogus sub-second values.
*/ */
dest->tv_nsec %= NSEC_PER_SEC; dest->tv_nsec %= NSEC_PER_SEC;
return dest;
} }
struct timestamp * void
udf_time_to_disk_stamp(struct timestamp *dest, struct timespec ts) udf_time_to_disk_stamp(struct timestamp *dest, struct timespec ts)
{ {
long seconds; long seconds;
@ -79,9 +78,6 @@ udf_time_to_disk_stamp(struct timestamp *dest, struct timespec ts)
offset = -sys_tz.tz_minuteswest; offset = -sys_tz.tz_minuteswest;
if (!dest)
return NULL;
dest->typeAndTimezone = cpu_to_le16(0x1000 | (offset & 0x0FFF)); dest->typeAndTimezone = cpu_to_le16(0x1000 | (offset & 0x0FFF));
seconds = ts.tv_sec + offset * 60; seconds = ts.tv_sec + offset * 60;
@ -97,7 +93,6 @@ udf_time_to_disk_stamp(struct timestamp *dest, struct timespec ts)
dest->centiseconds * 10000) / 100; dest->centiseconds * 10000) / 100;
dest->microseconds = (ts.tv_nsec / 1000 - dest->centiseconds * 10000 - dest->microseconds = (ts.tv_nsec / 1000 - dest->centiseconds * 10000 -
dest->hundredsOfMicroseconds * 100); dest->hundredsOfMicroseconds * 100);
return dest;
} }
/* EOF */ /* EOF */

View File

@ -761,7 +761,7 @@ xfs_ialloc(
xfs_inode_t *ip; xfs_inode_t *ip;
uint flags; uint flags;
int error; int error;
struct timespec tv; struct timespec64 tv;
struct inode *inode; struct inode *inode;
/* /*

View File

@ -1042,7 +1042,7 @@ xfs_vn_setattr(
STATIC int STATIC int
xfs_vn_update_time( xfs_vn_update_time(
struct inode *inode, struct inode *inode,
struct timespec *now, struct timespec64 *now,
int flags) int flags)
{ {
struct xfs_inode *ip = XFS_I(inode); struct xfs_inode *ip = XFS_I(inode);

View File

@ -58,7 +58,7 @@ xfs_trans_ichgtime(
int flags) int flags)
{ {
struct inode *inode = VFS_I(ip); struct inode *inode = VFS_I(ip);
struct timespec tv; struct timespec64 tv;
ASSERT(tp); ASSERT(tp);
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));

View File

@ -207,9 +207,9 @@ struct iattr {
kuid_t ia_uid; kuid_t ia_uid;
kgid_t ia_gid; kgid_t ia_gid;
loff_t ia_size; loff_t ia_size;
struct timespec ia_atime; struct timespec64 ia_atime;
struct timespec ia_mtime; struct timespec64 ia_mtime;
struct timespec ia_ctime; struct timespec64 ia_ctime;
/* /*
* Not an attribute, but an auxiliary info for filesystems wanting to * Not an attribute, but an auxiliary info for filesystems wanting to
@ -604,9 +604,9 @@ struct inode {
}; };
dev_t i_rdev; dev_t i_rdev;
loff_t i_size; loff_t i_size;
struct timespec i_atime; struct timespec64 i_atime;
struct timespec i_mtime; struct timespec64 i_mtime;
struct timespec i_ctime; struct timespec64 i_ctime;
spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
unsigned short i_bytes; unsigned short i_bytes;
unsigned int i_blkbits; unsigned int i_blkbits;
@ -1093,7 +1093,7 @@ extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct
extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
extern int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl); extern int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl);
extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
extern void lease_get_mtime(struct inode *, struct timespec *time); extern void lease_get_mtime(struct inode *, struct timespec64 *time);
extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
extern int vfs_setlease(struct file *, long, struct file_lock **, void **); extern int vfs_setlease(struct file *, long, struct file_lock **, void **);
extern int lease_modify(struct file_lock *, int, struct list_head *); extern int lease_modify(struct file_lock *, int, struct list_head *);
@ -1208,7 +1208,8 @@ static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned
return 0; return 0;
} }
static inline void lease_get_mtime(struct inode *inode, struct timespec *time) static inline void lease_get_mtime(struct inode *inode,
struct timespec64 *time)
{ {
return; return;
} }
@ -1478,7 +1479,8 @@ static inline void i_gid_write(struct inode *inode, gid_t gid)
inode->i_gid = make_kgid(inode->i_sb->s_user_ns, gid); inode->i_gid = make_kgid(inode->i_sb->s_user_ns, gid);
} }
extern struct timespec current_time(struct inode *inode); extern struct timespec64 timespec64_trunc(struct timespec64 t, unsigned gran);
extern struct timespec64 current_time(struct inode *inode);
/* /*
* Snapshotting support. * Snapshotting support.
@ -1773,7 +1775,7 @@ struct inode_operations {
ssize_t (*listxattr) (struct dentry *, char *, size_t); ssize_t (*listxattr) (struct dentry *, char *, size_t);
int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
u64 len); u64 len);
int (*update_time)(struct inode *, struct timespec *, int); int (*update_time)(struct inode *, struct timespec64 *, int);
int (*atomic_open)(struct inode *, struct dentry *, int (*atomic_open)(struct inode *, struct dentry *,
struct file *, unsigned open_flag, struct file *, unsigned open_flag,
umode_t create_mode, int *opened); umode_t create_mode, int *opened);
@ -2217,7 +2219,7 @@ extern int current_umask(void);
extern void ihold(struct inode * inode); extern void ihold(struct inode * inode);
extern void iput(struct inode *); extern void iput(struct inode *);
extern int generic_update_time(struct inode *, struct timespec *, int); extern int generic_update_time(struct inode *, struct timespec64 *, int);
/* /sys/fs */ /* /sys/fs */
extern struct kobject *fs_kobj; extern struct kobject *fs_kobj;

View File

@ -71,7 +71,7 @@ struct pstore_record {
struct pstore_info *psi; struct pstore_info *psi;
enum pstore_type_id type; enum pstore_type_id type;
u64 id; u64 id;
struct timespec time; struct timespec64 time;
char *buf; char *buf;
ssize_t size; ssize_t size;
ssize_t ecc_notice_size; ssize_t ecc_notice_size;

View File

@ -41,10 +41,10 @@ struct kstat {
kuid_t uid; kuid_t uid;
kgid_t gid; kgid_t gid;
loff_t size; loff_t size;
struct timespec atime; struct timespec64 atime;
struct timespec mtime; struct timespec64 mtime;
struct timespec ctime; struct timespec64 ctime;
struct timespec btime; /* File creation time */ struct timespec64 btime; /* File creation time */
u64 blocks; u64 blocks;
}; };