* [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
[not found] <1465448705-25055-1-git-send-email-deepa.kernel@gmail.com>
@ 2016-06-09 5:04 ` Deepa Dinamani
2016-06-09 7:35 ` Jan Kara
` (2 more replies)
2016-06-09 5:04 ` [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps Deepa Dinamani
1 sibling, 3 replies; 14+ messages in thread
From: Deepa Dinamani @ 2016-06-09 5:04 UTC (permalink / raw)
To: linux-fsdevel, linux-kernel
Cc: Jan Kara, Bob Copeland, David Howells, Andreas Dilger, linux-afs,
y2038, codalist, Christoph Hellwig, coda, linux-ext4,
Evgeniy Dushistov, Arnd Bergmann, Al Viro, Thomas Gleixner,
OGAWA Hirofumi, Jan Harkes, Theodore Ts'o, Artem Bityutskiy,
Tigran A. Aivazian, Adrian Hunter, Jan Kara, linux-mtd,
Linus Torvalds, linux-karma-devel
CURRENT_TIME_SEC is not y2038 safe. current_fs_time() will
be transitioned to use 64 bit time along with vfs in a
separate patch.
There is no plan to transistion CURRENT_TIME_SEC to use
y2038 safe time interfaces.
current_fs_time() will also be extended to use superblock
range checking parameters when range checking is introduced.
This works because alloc_super() fills in the the s_time_gran
in super block to NSEC_PER_SEC.
Also note that filesystem specific times like the birthtime,
creation time that were using same interfaces to obtain time
retain same logistics.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: linux-mtd@lists.infradead.org
Cc: Evgeniy Dushistov <dushistov@mail.ru>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Jan Kara <jack@suse.com>
Cc: linux-ext4@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>
Cc: linux-afs@lists.infradead.org
Cc: "Tigran A. Aivazian" <tigran@aivazian.fsnet.co.uk>
Cc: linux-fsdevel@vger.kernel.org
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Jan Kara <jack@suse.cz>
Cc: Jan Harkes <jaharkes@cs.cmu.edu>
Cc: coda@cs.cmu.edu
Cc: codalist@coda.cs.cmu.edu
Cc: Bob Copeland <me@bobcopeland.com>
Cc: linux-karma-devel@lists.sourceforge.net
Cc: Christoph Hellwig <hch@infradead.org>
---
fs/affs/amigaffs.c | 6 +++---
fs/affs/inode.c | 2 +-
fs/afs/inode.c | 3 +--
fs/bfs/dir.c | 18 ++++++++++--------
fs/coda/dir.c | 2 +-
fs/coda/file.c | 2 +-
fs/coda/inode.c | 2 +-
fs/ext2/acl.c | 2 +-
fs/ext2/dir.c | 6 +++---
fs/ext2/ialloc.c | 2 +-
fs/ext2/inode.c | 4 ++--
fs/ext2/ioctl.c | 5 +++--
fs/ext2/namei.c | 6 +++---
fs/ext2/super.c | 2 +-
fs/ext2/xattr.c | 2 +-
fs/fat/dir.c | 2 +-
fs/fat/file.c | 4 ++--
fs/fat/inode.c | 2 +-
fs/fat/namei_msdos.c | 13 +++++++------
fs/fat/namei_vfat.c | 10 +++++-----
fs/hfs/catalog.c | 8 ++++----
fs/hfs/dir.c | 2 +-
fs/hfs/inode.c | 2 +-
fs/hfsplus/catalog.c | 8 ++++----
fs/hfsplus/dir.c | 6 +++---
fs/hfsplus/inode.c | 2 +-
fs/hfsplus/ioctl.c | 2 +-
fs/jffs2/acl.c | 2 +-
fs/jffs2/fs.c | 2 +-
fs/minix/bitmap.c | 2 +-
fs/minix/dir.c | 12 +++++++-----
fs/minix/itree_common.c | 4 ++--
fs/minix/namei.c | 4 ++--
fs/omfs/dir.c | 4 ++--
fs/omfs/inode.c | 2 +-
fs/reiserfs/inode.c | 2 +-
fs/reiserfs/ioctl.c | 4 ++--
fs/reiserfs/namei.c | 14 +++++++-------
fs/reiserfs/stree.c | 6 ++----
fs/reiserfs/super.c | 2 +-
fs/reiserfs/xattr.c | 2 +-
fs/reiserfs/xattr_acl.c | 2 +-
fs/sysv/dir.c | 6 +++---
fs/sysv/ialloc.c | 2 +-
fs/sysv/itree.c | 4 ++--
fs/sysv/namei.c | 4 ++--
fs/ufs/dir.c | 6 +++---
fs/ufs/ialloc.c | 8 +++++---
fs/ufs/inode.c | 6 +++---
fs/ufs/namei.c | 6 +++---
50 files changed, 118 insertions(+), 113 deletions(-)
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index d6c7a51..015b62c 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -58,7 +58,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
mark_buffer_dirty_inode(dir_bh, dir);
affs_brelse(dir_bh);
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(sb);
dir->i_version++;
mark_inode_dirty(dir);
@@ -112,7 +112,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
affs_brelse(bh);
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(sb);
dir->i_version++;
mark_inode_dirty(dir);
@@ -313,7 +313,7 @@ affs_remove_header(struct dentry *dentry)
else
clear_nlink(inode);
affs_unlock_link(inode);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
done:
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 0fdb0f5..cdd6d64 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -309,7 +309,7 @@ affs_new_inode(struct inode *dir)
inode->i_gid = current_fsgid();
inode->i_ino = block;
set_nlink(inode, 1);
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
atomic_set(&AFFS_I(inode)->i_opencnt, 0);
AFFS_I(inode)->i_blkcnt = 0;
AFFS_I(inode)->i_lc = NULL;
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 86cc726..ce3374b 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -178,8 +178,7 @@ struct inode *afs_iget_autocell(struct inode *dir, const char *dev_name,
set_nlink(inode, 2);
inode->i_uid = GLOBAL_ROOT_UID;
inode->i_gid = GLOBAL_ROOT_GID;
- inode->i_ctime.tv_sec = get_seconds();
- inode->i_ctime.tv_nsec = 0;
+ inode->i_ctime = current_fs_time(sb);
inode->i_atime = inode->i_mtime = inode->i_ctime;
inode->i_blocks = 0;
inode->i_version = 0;
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 34a5bc2..fcbb2a4 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -97,7 +97,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
set_bit(ino, info->si_imap);
info->si_freei--;
inode_init_owner(inode, dir, mode);
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(s);
inode->i_blocks = 0;
inode->i_op = &bfs_file_inops;
inode->i_fop = &bfs_file_operations;
@@ -154,7 +154,8 @@ static int bfs_link(struct dentry *old, struct inode *dir,
struct dentry *new)
{
struct inode *inode = d_inode(old);
- struct bfs_sb_info *info = BFS_SB(inode->i_sb);
+ struct super_block *s = inode->i_sb;
+ struct bfs_sb_info *info = BFS_SB(s);
int err;
mutex_lock(&info->bfs_lock);
@@ -165,7 +166,7 @@ static int bfs_link(struct dentry *old, struct inode *dir,
return err;
}
inc_nlink(inode);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(s);
mark_inode_dirty(inode);
ihold(inode);
d_instantiate(new, inode);
@@ -194,7 +195,7 @@ static int bfs_unlink(struct inode *dir, struct dentry *dentry)
}
de->ino = 0;
mark_buffer_dirty_inode(bh, dir);
- dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
+ dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
mark_inode_dirty(dir);
inode->i_ctime = dir->i_ctime;
inode_dec_link_count(inode);
@@ -249,10 +250,10 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
goto end_rename;
}
old_de->ino = 0;
- old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
+ old_dir->i_ctime = old_dir->i_mtime = current_fs_time(old_dir->i_sb);
mark_inode_dirty(old_dir);
if (new_inode) {
- new_inode->i_ctime = CURRENT_TIME_SEC;
+ new_inode->i_ctime = current_fs_time(new_dir->i_sb);
inode_dec_link_count(new_inode);
}
mark_buffer_dirty_inode(old_bh, old_dir);
@@ -278,6 +279,7 @@ static int bfs_add_entry(struct inode *dir, const unsigned char *name,
{
struct buffer_head *bh;
struct bfs_dirent *de;
+ struct super_block *s = dir->i_sb;
int block, sblock, eblock, off, pos;
int i;
@@ -300,9 +302,9 @@ static int bfs_add_entry(struct inode *dir, const unsigned char *name,
pos = (block - sblock) * BFS_BSIZE + off;
if (pos >= dir->i_size) {
dir->i_size += BFS_DIRENT_SIZE;
- dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_ctime = current_fs_time(s);
}
- dir->i_mtime = CURRENT_TIME_SEC;
+ dir->i_mtime = current_fs_time(s);
mark_inode_dirty(dir);
de->ino = cpu_to_le16((u16)ino);
for (i = 0; i < BFS_NAMELEN; i++)
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 6fb8672..4f97929 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -109,7 +109,7 @@ static inline void coda_dir_update_mtime(struct inode *dir)
/* optimistically we can also act as if our nose bleeds. The
* granularity of the mtime is coarse anyways so we might actually be
* right most of the time. Note: we only do this for directories. */
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
#endif
}
diff --git a/fs/coda/file.c b/fs/coda/file.c
index f47c748..8643545 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -75,7 +75,7 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to)
ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos);
coda_inode->i_size = file_inode(host_file)->i_size;
coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9;
- coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC;
+ coda_inode->i_mtime = coda_inode->i_ctime = current_fs_time(coda_inode->i_sb);
inode_unlock(coda_inode);
file_end_write(host_file);
return ret;
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 57e81cb..3894447 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -271,7 +271,7 @@ int coda_setattr(struct dentry *de, struct iattr *iattr)
memset(&vattr, 0, sizeof(vattr));
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
coda_iattr_to_vattr(iattr, &vattr);
vattr.va_type = C_VNON; /* cannot set type */
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 42f1d18..3b1a030 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -194,7 +194,7 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
if (error < 0)
return error;
else {
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
if (error == 0)
acl = NULL;
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 19efd11..3fa63ab 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -471,7 +471,7 @@ void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
err = ext2_commit_chunk(page, pos, len);
ext2_put_page(page);
if (update_times)
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
mark_inode_dirty(dir);
}
@@ -561,7 +561,7 @@ got_it:
de->inode = cpu_to_le32(inode->i_ino);
ext2_set_de_type (de, inode);
err = ext2_commit_chunk(page, pos, rec_len);
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
mark_inode_dirty(dir);
/* OFFSET_CACHE */
@@ -610,7 +610,7 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
pde->rec_len = ext2_rec_len_to_disk(to - from);
dir->inode = 0;
err = ext2_commit_chunk(page, pos, to - from);
- inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+ inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;
mark_inode_dirty(inode);
out:
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index efe5fb2..13d88a2 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -551,7 +551,7 @@ got:
inode->i_ino = ino;
inode->i_blocks = 0;
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
memset(ei->i_data, 0, sizeof(ei->i_data));
ei->i_flags =
ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED);
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index fcbe586..f5f655c 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -594,7 +594,7 @@ static void ext2_splice_branch(struct inode *inode,
if (where->bh)
mark_buffer_dirty_inode(where->bh, inode);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
}
@@ -1236,7 +1236,7 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
__ext2_truncate_blocks(inode, newsize);
dax_sem_up_write(EXT2_I(inode));
- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
if (inode_needs_sync(inode)) {
sync_mapping_buffers(inode->i_mapping);
sync_inode_metadata(inode, 1);
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index b386af2..1cbb75b 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -21,6 +21,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
struct inode *inode = file_inode(filp);
struct ext2_inode_info *ei = EXT2_I(inode);
+ struct super_block *sb = inode->i_sb;
unsigned int flags;
unsigned short rsv_window_size;
int ret;
@@ -79,7 +80,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
ei->i_flags = flags;
ext2_set_inode_flags(inode);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(sb);
inode_unlock(inode);
mark_inode_dirty(inode);
@@ -103,7 +104,7 @@ setflags_out:
}
inode_lock(inode);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(sb);
inode->i_generation = generation;
inode_unlock(inode);
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index d446203..7109cb3 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -221,7 +221,7 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir,
if (err)
return err;
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
inode_inc_link_count(inode);
ihold(inode);
@@ -372,7 +372,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
if (!new_de)
goto out_dir;
ext2_set_link(new_dir, new_de, new_page, old_inode, 1);
- new_inode->i_ctime = CURRENT_TIME_SEC;
+ new_inode->i_ctime = current_fs_time(new_inode->i_sb);
if (dir_de)
drop_nlink(new_inode);
inode_dec_link_count(new_inode);
@@ -388,7 +388,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
* Like most other Unix systems, set the ctime for inodes on a
* rename.
*/
- old_inode->i_ctime = CURRENT_TIME_SEC;
+ old_inode->i_ctime = current_fs_time(old_inode->i_sb);
mark_inode_dirty(old_inode);
ext2_delete_entry (old_de, old_page);
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 1d93795..3ead2de 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1543,7 +1543,7 @@ out:
if (inode->i_size < off+len-towrite)
i_size_write(inode, off+len-towrite);
inode->i_version++;
- inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_mtime = inode->i_ctime = current_fs_time(sb);
mark_inode_dirty(inode);
return len - towrite;
}
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 1a5e3bf..8ff1494 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -691,7 +691,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
/* Update the inode. */
EXT2_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0;
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(sb);
if (IS_SYNC(inode)) {
error = sync_inode_metadata(inode, 1);
/* In case sync failed due to ENOSPC the inode was actually
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 663e428..eb0ecb0 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -1071,7 +1071,7 @@ int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo)
}
}
- dir->i_mtime = dir->i_atime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_atime = current_fs_time(sb);
if (IS_DIRSYNC(dir))
(void)fat_sync_inode(dir);
else
diff --git a/fs/fat/file.c b/fs/fat/file.c
index f701856..1f9f172 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -194,7 +194,7 @@ static int fat_cont_expand(struct inode *inode, loff_t size)
if (err)
goto out;
- inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+ inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
if (IS_SYNC(inode)) {
int err2;
@@ -297,7 +297,7 @@ static int fat_free(struct inode *inode, int skip)
MSDOS_I(inode)->i_logstart = 0;
}
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
- inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+ inode->i_ctime = inode->i_mtime = current_fs_time(sb);
if (wait) {
err = fat_sync_inode(inode);
if (err) {
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 3bcf579..7dd9af7 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -237,7 +237,7 @@ static int fat_write_end(struct file *file, struct address_space *mapping,
if (err < len)
fat_write_failed(mapping, pos + len);
if (!(err < 0) && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) {
- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
mark_inode_dirty(inode);
}
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index b7e2b33..c54888f 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -283,7 +283,7 @@ static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode,
goto out;
}
- ts = CURRENT_TIME_SEC;
+ ts = current_fs_time(sb);
err = msdos_add_entry(dir, msdos_name, 0, is_hid, 0, &ts, &sinfo);
if (err)
goto out;
@@ -330,7 +330,7 @@ static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
drop_nlink(dir);
clear_nlink(inode);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(sb);
fat_detach(inode);
out:
mutex_unlock(&MSDOS_SB(sb)->s_lock);
@@ -364,7 +364,7 @@ static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
goto out;
}
- ts = CURRENT_TIME_SEC;
+ ts = current_fs_time(sb);
cluster = fat_alloc_new_dir(dir, &ts);
if (cluster < 0) {
err = cluster;
@@ -416,7 +416,7 @@ static int msdos_unlink(struct inode *dir, struct dentry *dentry)
if (err)
goto out;
clear_nlink(inode);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(sb);
fat_detach(inode);
out:
mutex_unlock(&MSDOS_SB(sb)->s_lock);
@@ -481,7 +481,8 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
mark_inode_dirty(old_inode);
old_dir->i_version++;
- old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
+ old_dir->i_ctime = old_dir->i_mtime =
+ current_fs_time(old_dir->i_sb);
if (IS_DIRSYNC(old_dir))
(void)fat_sync_inode(old_dir);
else
@@ -490,7 +491,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
}
}
- ts = CURRENT_TIME_SEC;
+ ts = current_fs_time(new_inode->i_sb);
if (new_inode) {
if (err)
goto out;
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 7092584..cad8666 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -777,7 +777,7 @@ static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
mutex_lock(&MSDOS_SB(sb)->s_lock);
- ts = CURRENT_TIME_SEC;
+ ts = current_fs_time(sb);
err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &ts, &sinfo);
if (err)
goto out;
@@ -821,7 +821,7 @@ static int vfat_rmdir(struct inode *dir, struct dentry *dentry)
drop_nlink(dir);
clear_nlink(inode);
- inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = current_fs_time(sb);
fat_detach(inode);
dentry->d_time = dir->i_version;
out:
@@ -847,7 +847,7 @@ static int vfat_unlink(struct inode *dir, struct dentry *dentry)
if (err)
goto out;
clear_nlink(inode);
- inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = current_fs_time(sb);
fat_detach(inode);
dentry->d_time = dir->i_version;
out:
@@ -866,7 +866,7 @@ static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
mutex_lock(&MSDOS_SB(sb)->s_lock);
- ts = CURRENT_TIME_SEC;
+ ts = current_fs_time(sb);
cluster = fat_alloc_new_dir(dir, &ts);
if (cluster < 0) {
err = cluster;
@@ -931,7 +931,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
}
}
- ts = CURRENT_TIME_SEC;
+ ts = current_fs_time(sb);
if (new_inode) {
if (is_dir) {
err = fat_dir_empty(new_inode);
diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
index 98cde8b..0fabf66 100644
--- a/fs/hfs/catalog.c
+++ b/fs/hfs/catalog.c
@@ -125,7 +125,7 @@ int hfs_cat_create(u32 cnid, struct inode *dir, struct qstr *str, struct inode *
goto err1;
dir->i_size++;
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(sb);
mark_inode_dirty(dir);
hfs_find_exit(&fd);
return 0;
@@ -261,7 +261,7 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, struct qstr *str)
}
dir->i_size--;
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(sb);
mark_inode_dirty(dir);
res = 0;
out:
@@ -321,7 +321,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, struct qstr *src_name,
if (err)
goto out;
dst_dir->i_size++;
- dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC;
+ dst_dir->i_mtime = dst_dir->i_ctime = current_fs_time(dst_dir->i_sb);
mark_inode_dirty(dst_dir);
/* finally remove the old entry */
@@ -333,7 +333,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, struct qstr *src_name,
if (err)
goto out;
src_dir->i_size--;
- src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC;
+ src_dir->i_mtime = src_dir->i_ctime = current_fs_time(sb);
mark_inode_dirty(src_dir);
type = entry.type;
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 163190e..d64c536 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -268,7 +268,7 @@ static int hfs_remove(struct inode *dir, struct dentry *dentry)
if (res)
return res;
clear_nlink(inode);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
hfs_delete_inode(inode);
mark_inode_dirty(inode);
return 0;
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 8eed66a..b30b6d2 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -193,7 +193,7 @@ struct inode *hfs_new_inode(struct inode *dir, struct qstr *name, umode_t mode)
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
set_nlink(inode, 1);
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
HFS_I(inode)->flags = 0;
HFS_I(inode)->rsrc_inode = NULL;
HFS_I(inode)->fs_blocks = 0;
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
index fb707e8..b2f9093 100644
--- a/fs/hfsplus/catalog.c
+++ b/fs/hfsplus/catalog.c
@@ -303,7 +303,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,
dir->i_size++;
if (S_ISDIR(inode->i_mode))
hfsplus_subfolders_inc(dir);
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(sb);
hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
hfs_find_exit(&fd);
@@ -400,7 +400,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str)
dir->i_size--;
if (type == HFSPLUS_FOLDER)
hfsplus_subfolders_dec(dir);
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(sb);
hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
if (type == HFSPLUS_FILE || type == HFSPLUS_FOLDER) {
@@ -469,7 +469,7 @@ int hfsplus_rename_cat(u32 cnid,
dst_dir->i_size++;
if (type == HFSPLUS_FOLDER)
hfsplus_subfolders_inc(dst_dir);
- dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC;
+ dst_dir->i_mtime = dst_dir->i_ctime = current_fs_time(dst_dir->i_sb);
/* finally remove the old entry */
err = hfsplus_cat_build_key(sb, src_fd.search_key,
@@ -486,7 +486,7 @@ int hfsplus_rename_cat(u32 cnid,
src_dir->i_size--;
if (type == HFSPLUS_FOLDER)
hfsplus_subfolders_dec(src_dir);
- src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC;
+ src_dir->i_mtime = src_dir->i_ctime = current_fs_time(sb);
/* remove old thread entry */
hfsplus_cat_build_key_with_cnid(sb, src_fd.search_key, cnid);
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 42e1286..f5b40db 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -347,7 +347,7 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
inc_nlink(inode);
hfsplus_instantiate(dst_dentry, inode, cnid);
ihold(inode);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
sbi->file_count++;
hfsplus_mark_mdb_dirty(dst_dir->i_sb);
@@ -406,7 +406,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
hfsplus_delete_inode(inode);
} else
sbi->file_count--;
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
out:
mutex_unlock(&sbi->vh_mutex);
@@ -427,7 +427,7 @@ static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
if (res)
goto out;
clear_nlink(inode);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
hfsplus_delete_inode(inode);
mark_inode_dirty(inode);
out:
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index ef9fefe..d0f0ee2 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -369,7 +369,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, umode_t mode)
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
set_nlink(inode, 1);
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
hip = HFSPLUS_I(inode);
INIT_LIST_HEAD(&hip->open_dir_list);
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index 32a49e2..7b4820b 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -122,7 +122,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
else
hip->userflags &= ~HFSPLUS_FLG_NODUMP;
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
out_unlock_inode:
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index bc2693d..f8c7308 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -242,7 +242,7 @@ int jffs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
attr.ia_valid = ATTR_MODE | ATTR_CTIME;
attr.ia_mode = mode;
- attr.ia_ctime = CURRENT_TIME_SEC;
+ attr.ia_ctime = current_fs_time(inode->i_sb);
rc = jffs2_do_setattr(inode, &attr);
if (rc < 0)
return rc;
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index ae2ebb2..2ce4091 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -472,7 +472,7 @@ struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_r
inode->i_mode = jemode_to_cpu(ri->mode);
i_gid_write(inode, je16_to_cpu(ri->gid));
i_uid_write(inode, je16_to_cpu(ri->uid));
- inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+ inode->i_atime = inode->i_ctime = inode->i_mtime = current_fs_time(sb);
ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime));
inode->i_blocks = 0;
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
index 742942a..0e72667 100644
--- a/fs/minix/bitmap.c
+++ b/fs/minix/bitmap.c
@@ -253,7 +253,7 @@ struct inode *minix_new_inode(const struct inode *dir, umode_t mode, int *error)
}
inode_init_owner(inode, dir, mode);
inode->i_ino = j;
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
inode->i_blocks = 0;
memset(&minix_i(inode)->u, 0, sizeof(minix_i(inode)->u));
insert_inode_hash(inode);
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index 31dcd51..d86a1aa 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -274,7 +274,7 @@ got_it:
de->inode = inode->i_ino;
}
err = dir_commit_chunk(page, pos, sbi->s_dirsize);
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(sb);
mark_inode_dirty(dir);
out_put:
dir_put_page(page);
@@ -290,7 +290,8 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page)
struct inode *inode = page->mapping->host;
char *kaddr = page_address(page);
loff_t pos = page_offset(page) + (char*)de - kaddr;
- struct minix_sb_info *sbi = minix_sb(inode->i_sb);
+ struct super_block *sb = inode->i_sb;
+ struct minix_sb_info *sbi = minix_sb(sb);
unsigned len = sbi->s_dirsize;
int err;
@@ -306,7 +307,7 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page)
unlock_page(page);
}
dir_put_page(page);
- inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+ inode->i_ctime = inode->i_mtime = current_fs_time(sb);
mark_inode_dirty(inode);
return err;
}
@@ -412,7 +413,8 @@ void minix_set_link(struct minix_dir_entry *de, struct page *page,
struct inode *inode)
{
struct inode *dir = page->mapping->host;
- struct minix_sb_info *sbi = minix_sb(dir->i_sb);
+ struct super_block *sb = dir->i_sb;
+ struct minix_sb_info *sbi = minix_sb(sb);
loff_t pos = page_offset(page) +
(char *)de-(char*)page_address(page);
int err;
@@ -430,7 +432,7 @@ void minix_set_link(struct minix_dir_entry *de, struct page *page,
unlock_page(page);
}
dir_put_page(page);
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(sb);
mark_inode_dirty(dir);
}
diff --git a/fs/minix/itree_common.c b/fs/minix/itree_common.c
index a731cab..89d9288 100644
--- a/fs/minix/itree_common.c
+++ b/fs/minix/itree_common.c
@@ -124,7 +124,7 @@ static inline int splice_branch(struct inode *inode,
/* We are done with atomic stuff, now do the rest of housekeeping */
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
/* had we spliced it onto indirect block? */
if (where->bh)
@@ -343,7 +343,7 @@ do_indirects:
}
first_whole++;
}
- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_ctime = current_fs_time(sb);
mark_inode_dirty(inode);
}
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index 2887d1d..547fc16 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -106,7 +106,7 @@ static int minix_link(struct dentry * old_dentry, struct inode * dir,
{
struct inode *inode = d_inode(old_dentry);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
inode_inc_link_count(inode);
ihold(inode);
return add_nondir(dentry, inode);
@@ -219,7 +219,7 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
if (!new_de)
goto out_dir;
minix_set_link(new_de, new_page, old_inode);
- new_inode->i_ctime = CURRENT_TIME_SEC;
+ new_inode->i_ctime = current_fs_time(new_inode->i_sb);
if (dir_de)
drop_nlink(new_inode);
inode_dec_link_count(new_inode);
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c
index c8cbf3b..ce3e6eb 100644
--- a/fs/omfs/dir.c
+++ b/fs/omfs/dir.c
@@ -143,7 +143,7 @@ static int omfs_add_link(struct dentry *dentry, struct inode *inode)
mark_buffer_dirty(bh);
brelse(bh);
- dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_ctime = current_fs_time(dir->i_sb);
/* mark affected inodes dirty to rebuild checksums */
mark_inode_dirty(dir);
@@ -395,7 +395,7 @@ static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (err)
goto out;
- old_inode->i_ctime = CURRENT_TIME_SEC;
+ old_inode->i_ctime = current_fs_time(old_inode->i_sb);
mark_inode_dirty(old_inode);
out:
return err;
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index 3d935c8..0f0b65e 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -49,7 +49,7 @@ struct inode *omfs_new_inode(struct inode *dir, umode_t mode)
inode_init_owner(inode, NULL, mode);
inode->i_mapping->a_ops = &omfs_aops;
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_atime = inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
switch (mode & S_IFMT) {
case S_IFDIR:
inode->i_op = &omfs_dir_inops;
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 825455d..a70378d 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2005,7 +2005,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
if (S_ISLNK(inode->i_mode))
inode->i_flags &= ~(S_IMMUTABLE | S_APPEND);
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
inode->i_size = i_size;
inode->i_blocks = 0;
inode->i_bytes = 0;
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index 2f1ddc9..30faa08 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -94,7 +94,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
}
sd_attrs_to_i_attrs(flags, inode);
REISERFS_I(inode)->i_attrs = flags;
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
setflags_out:
mnt_drop_write_file(filp);
@@ -115,7 +115,7 @@ setflags_out:
err = -EFAULT;
goto setversion_out;
}
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
setversion_out:
mnt_drop_write_file(filp);
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 8a36696..d9e54b4 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -570,7 +570,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
}
dir->i_size += paste_size;
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
if (!S_ISDIR(inode->i_mode) && visible)
/* reiserfs_mkdir or reiserfs_rename will do that by itself */
reiserfs_update_sd(th, dir);
@@ -963,7 +963,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
inode->i_nlink);
clear_nlink(inode);
- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
+ inode->i_ctime = dir->i_ctime = dir->i_mtime = current_fs_time(inode->i_sb);
reiserfs_update_sd(&th, inode);
DEC_DIR_INODE_NLINK(dir)
@@ -1067,11 +1067,11 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
inc_nlink(inode);
goto end_unlink;
}
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
reiserfs_update_sd(&th, inode);
dir->i_size -= (de.de_entrylen + DEH_SIZE);
- dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
+ dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
reiserfs_update_sd(&th, dir);
if (!savelink)
@@ -1246,7 +1246,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
return err ? err : retval;
}
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
reiserfs_update_sd(&th, inode);
ihold(inode);
@@ -1567,14 +1567,14 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
mark_de_hidden(old_de.de_deh + old_de.de_entry_num);
journal_mark_dirty(&th, old_de.de_bh);
- ctime = CURRENT_TIME_SEC;
+ ctime = current_fs_time(old_dir->i_sb);
old_dir->i_ctime = old_dir->i_mtime = ctime;
new_dir->i_ctime = new_dir->i_mtime = ctime;
/*
* thanks to Alex Adriaanse <alex_a@caltech.edu> for patch
* which adds ctime update of renamed object
*/
- old_inode->i_ctime = ctime;
+ old_inode->i_ctime = current_fs_time(old_inode->i_sb);
if (new_dentry_inode) {
/* adjust link number of the victim */
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 5feacd6..7aebba07 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -1987,8 +1987,7 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
pathrelse(&s_search_path);
if (update_timestamps) {
- inode->i_mtime = CURRENT_TIME_SEC;
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
}
reiserfs_update_sd(th, inode);
@@ -2012,8 +2011,7 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
update_and_out:
if (update_timestamps) {
/* this is truncate, not file closing */
- inode->i_mtime = CURRENT_TIME_SEC;
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
}
reiserfs_update_sd(th, inode);
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index c72c16c..dd58cf9 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2512,7 +2512,7 @@ out:
if (inode->i_size < off + len - towrite)
i_size_write(inode, off + len - towrite);
inode->i_version++;
- inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_mtime = inode->i_ctime = current_fs_time(sb);
mark_inode_dirty(inode);
return len - towrite;
}
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index a33812a..ada620b 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -456,7 +456,7 @@ static void update_ctime(struct inode *inode)
timespec_equal(&inode->i_ctime, &now))
return;
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
}
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index dbed42f..cf826f6 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -277,7 +277,7 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,
if (error == -ENODATA) {
error = 0;
if (type == ACL_TYPE_ACCESS) {
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
}
}
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c
index 2661b77..d4f60f4 100644
--- a/fs/sysv/dir.c
+++ b/fs/sysv/dir.c
@@ -215,7 +215,7 @@ got_it:
memset (de->name + namelen, 0, SYSV_DIRSIZE - namelen - 2);
de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino);
err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
mark_inode_dirty(dir);
out_page:
dir_put_page(page);
@@ -239,7 +239,7 @@ int sysv_delete_entry(struct sysv_dir_entry *de, struct page *page)
de->inode = 0;
err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
dir_put_page(page);
- inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+ inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
return err;
}
@@ -337,7 +337,7 @@ void sysv_set_link(struct sysv_dir_entry *de, struct page *page,
de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino);
err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
dir_put_page(page);
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
mark_inode_dirty(dir);
}
diff --git a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c
index f9db4eb..8d2ea17 100644
--- a/fs/sysv/ialloc.c
+++ b/fs/sysv/ialloc.c
@@ -164,7 +164,7 @@ struct inode * sysv_new_inode(const struct inode * dir, umode_t mode)
dirty_sb(sb);
inode_init_owner(inode, dir, mode);
inode->i_ino = fs16_to_cpu(sbi, ino);
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
inode->i_blocks = 0;
memset(SYSV_I(inode)->i_data, 0, sizeof(SYSV_I(inode)->i_data));
SYSV_I(inode)->i_dir_start_lookup = 0;
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index 2fde40a..2654a3d 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -178,7 +178,7 @@ static inline int splice_branch(struct inode *inode,
*where->p = where->key;
write_unlock(&pointers_lock);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
/* had we spliced it onto indirect block? */
if (where->bh)
@@ -418,7 +418,7 @@ do_indirects:
}
n++;
}
- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
if (IS_SYNC(inode))
sysv_sync_inode (inode);
else
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c
index 90b60c0..028100d 100644
--- a/fs/sysv/namei.c
+++ b/fs/sysv/namei.c
@@ -120,7 +120,7 @@ static int sysv_link(struct dentry * old_dentry, struct inode * dir,
{
struct inode *inode = d_inode(old_dentry);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
inode_inc_link_count(inode);
ihold(inode);
@@ -240,7 +240,7 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry,
if (!new_de)
goto out_dir;
sysv_set_link(new_de, new_page, old_inode);
- new_inode->i_ctime = CURRENT_TIME_SEC;
+ new_inode->i_ctime = current_fs_time(new_inode->i_sb);
if (dir_de)
drop_nlink(new_inode);
inode_dec_link_count(new_inode);
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 57dcced..2f9a600 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -100,7 +100,7 @@ void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
err = ufs_commit_chunk(page, pos, len);
ufs_put_page(page);
if (update_times)
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
mark_inode_dirty(dir);
}
@@ -395,7 +395,7 @@ got_it:
ufs_set_de_type(sb, de, inode->i_mode);
err = ufs_commit_chunk(page, pos, rec_len);
- dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+ dir->i_mtime = dir->i_ctime = current_fs_time(sb);
mark_inode_dirty(dir);
/* OFFSET_CACHE */
@@ -545,7 +545,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
pde->d_reclen = cpu_to_fs16(sb, to - from);
dir->d_ino = 0;
err = ufs_commit_chunk(page, pos, to - from);
- inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+ inode->i_ctime = inode->i_mtime = current_fs_time(sb);
mark_inode_dirty(inode);
out:
ufs_put_page(page);
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index fd0203c..6cbf2e3 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -176,6 +176,7 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode)
struct ufs_cg_private_info * ucpi;
struct ufs_cylinder_group * ucg;
struct inode * inode;
+ struct timespec ts;
unsigned cg, bit, i, j, start;
struct ufs_inode_info *ufsi;
int err = -ENOSPC;
@@ -290,7 +291,7 @@ cg_found:
inode_init_owner(inode, dir, mode);
inode->i_blocks = 0;
inode->i_generation = 0;
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = current_fs_time(sb);
ufsi->i_flags = UFS_I(dir)->i_flags;
ufsi->i_lastfrag = 0;
ufsi->i_shadow = 0;
@@ -323,8 +324,9 @@ cg_found:
lock_buffer(bh);
ufs2_inode = (struct ufs2_inode *)bh->b_data;
ufs2_inode += ufs_inotofsbo(inode->i_ino);
- ufs2_inode->ui_birthtime = cpu_to_fs64(sb, CURRENT_TIME.tv_sec);
- ufs2_inode->ui_birthnsec = cpu_to_fs32(sb, CURRENT_TIME.tv_nsec);
+ ts = current_fs_time(sb);
+ ufs2_inode->ui_birthtime = cpu_to_fs64(sb, ts.tv_sec);
+ ufs2_inode->ui_birthnsec = cpu_to_fs32(sb, ts.tv_nsec);
mark_buffer_dirty(bh);
unlock_buffer(bh);
if (sb->s_flags & MS_SYNCHRONOUS)
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 9f49431..f0c6fb5 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -293,7 +293,7 @@ ufs_inode_getfrag(struct inode *inode, unsigned index,
if (new)
*new = 1;
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(sb);
if (IS_SYNC(inode))
ufs_sync_inode (inode);
mark_inode_dirty(inode);
@@ -375,7 +375,7 @@ ufs_inode_getblock(struct inode *inode, u64 ind_block,
mark_buffer_dirty(bh);
if (IS_SYNC(inode))
sync_dirty_buffer(bh);
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(sb);
mark_inode_dirty(inode);
out:
brelse (bh);
@@ -1185,7 +1185,7 @@ static int ufs_truncate(struct inode *inode, loff_t size)
truncate_setsize(inode, size);
__ufs_truncate_blocks(inode);
- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty(inode);
out:
UFSD("EXIT: err %d\n", err);
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index a1559f7..eea9b7a 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -153,7 +153,7 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir,
struct inode *inode = d_inode(old_dentry);
int error;
- inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_ctime = current_fs_time(inode->i_sb);
inode_inc_link_count(inode);
ihold(inode);
@@ -279,7 +279,7 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (!new_de)
goto out_dir;
ufs_set_link(new_dir, new_de, new_page, old_inode, 1);
- new_inode->i_ctime = CURRENT_TIME_SEC;
+ new_inode->i_ctime = current_fs_time(new_inode->i_sb);
if (dir_de)
drop_nlink(new_inode);
inode_dec_link_count(new_inode);
@@ -295,7 +295,7 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
* Like most other Unix systems, set the ctime for inodes on a
* rename.
*/
- old_inode->i_ctime = CURRENT_TIME_SEC;
+ old_inode->i_ctime = current_fs_time(old_inode->i_sb);
ufs_delete_entry(old_dir, old_de, old_page);
mark_inode_dirty(old_inode);
--
1.9.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
[not found] <1465448705-25055-1-git-send-email-deepa.kernel@gmail.com>
2016-06-09 5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
@ 2016-06-09 5:04 ` Deepa Dinamani
2016-06-09 18:45 ` Linus Torvalds
1 sibling, 1 reply; 14+ messages in thread
From: Deepa Dinamani @ 2016-06-09 5:04 UTC (permalink / raw)
To: linux-fsdevel, linux-kernel
Cc: Theodore Ts'o, Arnd Bergmann, y2038, Andreas Dilger, Al Viro,
Thomas Gleixner, linux-ext4, Linus Torvalds
CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
current_fs_time() will be transitioned to be y2038 safe
along with vfs.
current_fs_time() returns timestamps according to the
granularities set in the super_block.
The granularity check to call current_fs_time() or
CURRENT_TIME_SEC is not required.
Use current_fs_time() to obtain timestamps
unconditionally.
Quota files are assumed to be on the same filesystem.
Hence, use current_fs_time() for these files as well.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org
---
fs/ext4/acl.c | 2 +-
fs/ext4/ext4.h | 6 ------
fs/ext4/extents.c | 10 +++++-----
fs/ext4/ialloc.c | 2 +-
fs/ext4/inline.c | 4 ++--
fs/ext4/inode.c | 6 +++---
fs/ext4/ioctl.c | 8 ++++----
fs/ext4/namei.c | 24 +++++++++++++-----------
fs/ext4/super.c | 2 +-
fs/ext4/xattr.c | 2 +-
10 files changed, 31 insertions(+), 35 deletions(-)
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index c6601a4..f9469cc 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -197,7 +197,7 @@ __ext4_set_acl(handle_t *handle, struct inode *inode, int type,
if (error < 0)
return error;
else {
- inode->i_ctime = ext4_current_time(inode);
+ inode->i_ctime = current_fs_time(inode->i_sb);
ext4_mark_inode_dirty(handle, inode);
if (error == 0)
acl = NULL;
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index b84aa1c..14e5cf4 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1523,12 +1523,6 @@ static inline struct ext4_inode_info *EXT4_I(struct inode *inode)
return container_of(inode, struct ext4_inode_info, vfs_inode);
}
-static inline struct timespec ext4_current_time(struct inode *inode)
-{
- return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
- current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
-}
-
static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
{
return ino == EXT4_ROOT_INO ||
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 2a2eef9..ac303be 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4722,7 +4722,7 @@ retry:
map.m_lblk += ret;
map.m_len = len = len - ret;
epos = (loff_t)map.m_lblk << inode->i_blkbits;
- inode->i_ctime = ext4_current_time(inode);
+ inode->i_ctime = current_fs_time(inode->i_sb);
if (new_size) {
if (epos > new_size)
epos = new_size;
@@ -4850,7 +4850,7 @@ static long ext4_zero_range(struct file *file, loff_t offset,
}
/* Now release the pages and zero block aligned part of pages */
truncate_pagecache_range(inode, start, end - 1);
- inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size,
flags, mode);
@@ -4875,7 +4875,7 @@ static long ext4_zero_range(struct file *file, loff_t offset,
goto out_dio;
}
- inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
if (new_size) {
ext4_update_inode_size(inode, new_size);
} else {
@@ -5574,7 +5574,7 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
up_write(&EXT4_I(inode)->i_data_sem);
if (IS_SYNC(inode))
ext4_handle_sync(handle);
- inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
ext4_mark_inode_dirty(handle, inode);
out_stop:
@@ -5684,7 +5684,7 @@ int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len)
/* Expand file to avoid data loss if there is error while shifting */
inode->i_size += len;
EXT4_I(inode)->i_disksize += len;
- inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
ret = ext4_mark_inode_dirty(handle, inode);
if (ret)
goto out_stop;
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 3da4cf8..152ef38 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -1039,7 +1039,7 @@ got:
/* This is the optimal IO size (for stat), not the fs block size */
inode->i_blocks = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
- ext4_current_time(inode);
+ current_fs_time(inode->i_sb);
memset(ei->i_data, 0, sizeof(ei->i_data));
ei->i_dir_start_lookup = 0;
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index ff7538c..67b3fe8 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1028,7 +1028,7 @@ static int ext4_add_dirent_to_inline(handle_t *handle,
* happen is that the times are slightly out of date
* and/or different from the directory change time.
*/
- dir->i_mtime = dir->i_ctime = ext4_current_time(dir);
+ dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
ext4_update_dx_flag(dir);
dir->i_version++;
ext4_mark_inode_dirty(handle, dir);
@@ -1971,7 +1971,7 @@ out:
if (inode->i_nlink)
ext4_orphan_del(handle, inode);
- inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
ext4_mark_inode_dirty(handle, inode);
if (IS_SYNC(inode))
ext4_handle_sync(handle);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index f7140ca..1546c02 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3991,7 +3991,7 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
if (IS_SYNC(inode))
ext4_handle_sync(handle);
- inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
ext4_mark_inode_dirty(handle, inode);
out_stop:
ext4_journal_stop(handle);
@@ -4145,7 +4145,7 @@ out_stop:
if (inode->i_nlink)
ext4_orphan_del(handle, inode);
- inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
ext4_mark_inode_dirty(handle, inode);
ext4_journal_stop(handle);
@@ -5120,7 +5120,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
* update c/mtime in shrink case below
*/
if (!shrink) {
- inode->i_mtime = ext4_current_time(inode);
+ inode->i_mtime = current_fs_time(inode->i_sb);
inode->i_ctime = inode->i_mtime;
}
down_write(&EXT4_I(inode)->i_data_sem);
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 28cc412..fb429ac 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -155,7 +155,7 @@ static long swap_inode_boot_loader(struct super_block *sb,
swap_inode_data(inode, inode_bl);
- inode->i_ctime = inode_bl->i_ctime = ext4_current_time(inode);
+ inode->i_ctime = inode_bl->i_ctime = current_fs_time(inode->i_sb);
spin_lock(&sbi->s_next_gen_lock);
inode->i_generation = sbi->s_next_generation++;
@@ -274,7 +274,7 @@ static int ext4_ioctl_setflags(struct inode *inode,
}
ext4_set_inode_flags(inode);
- inode->i_ctime = ext4_current_time(inode);
+ inode->i_ctime = current_fs_time(inode->i_sb);
err = ext4_mark_iloc_dirty(handle, inode, &iloc);
flags_err:
@@ -373,7 +373,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
}
}
EXT4_I(inode)->i_projid = kprojid;
- inode->i_ctime = ext4_current_time(inode);
+ inode->i_ctime = current_fs_time(inode->i_sb);
out_dirty:
rc = ext4_mark_iloc_dirty(handle, inode, &iloc);
if (!err)
@@ -505,7 +505,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
}
err = ext4_reserve_inode_write(handle, inode, &iloc);
if (err == 0) {
- inode->i_ctime = ext4_current_time(inode);
+ inode->i_ctime = current_fs_time(inode->i_sb);
inode->i_generation = generation;
err = ext4_mark_iloc_dirty(handle, inode, &iloc);
}
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index ec4c399..c4cc01d 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1939,7 +1939,7 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname,
* happen is that the times are slightly out of date
* and/or different from the directory change time.
*/
- dir->i_mtime = dir->i_ctime = ext4_current_time(dir);
+ dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb);
ext4_update_dx_flag(dir);
dir->i_version++;
ext4_mark_inode_dirty(handle, dir);
@@ -2988,7 +2988,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
* recovery. */
inode->i_size = 0;
ext4_orphan_add(handle, inode);
- inode->i_ctime = dir->i_ctime = dir->i_mtime = ext4_current_time(inode);
+ inode->i_ctime = dir->i_ctime = dir->i_mtime = current_fs_time(inode->i_sb);
ext4_mark_inode_dirty(handle, inode);
ext4_dec_count(handle, dir);
ext4_update_dx_flag(dir);
@@ -3051,13 +3051,13 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
retval = ext4_delete_entry(handle, dir, de, bh);
if (retval)
goto end_unlink;
- dir->i_ctime = dir->i_mtime = ext4_current_time(dir);
+ dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
ext4_update_dx_flag(dir);
ext4_mark_inode_dirty(handle, dir);
drop_nlink(inode);
if (!inode->i_nlink)
ext4_orphan_add(handle, inode);
- inode->i_ctime = ext4_current_time(inode);
+ inode->i_ctime = current_fs_time(inode->i_sb);
ext4_mark_inode_dirty(handle, inode);
end_unlink:
@@ -3256,7 +3256,7 @@ retry:
if (IS_DIRSYNC(dir))
ext4_handle_sync(handle);
- inode->i_ctime = ext4_current_time(inode);
+ inode->i_ctime = current_fs_time(inode->i_sb);
ext4_inc_count(handle, inode);
ihold(inode);
@@ -3383,7 +3383,7 @@ static int ext4_setent(handle_t *handle, struct ext4_renament *ent,
ent->de->file_type = file_type;
ent->dir->i_version++;
ent->dir->i_ctime = ent->dir->i_mtime =
- ext4_current_time(ent->dir);
+ current_fs_time(ent->dir->i_sb);
ext4_mark_inode_dirty(handle, ent->dir);
BUFFER_TRACE(ent->bh, "call ext4_handle_dirty_metadata");
if (!ent->inlined) {
@@ -3654,7 +3654,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
* Like most other Unix systems, set the ctime for inodes on a
* rename.
*/
- old.inode->i_ctime = ext4_current_time(old.inode);
+ old.inode->i_ctime = current_fs_time(old.inode->i_sb);
ext4_mark_inode_dirty(handle, old.inode);
if (!whiteout) {
@@ -3666,9 +3666,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
if (new.inode) {
ext4_dec_count(handle, new.inode);
- new.inode->i_ctime = ext4_current_time(new.inode);
+ new.inode->i_ctime = current_fs_time(new.inode->i_sb);
}
- old.dir->i_ctime = old.dir->i_mtime = ext4_current_time(old.dir);
+ old.dir->i_ctime = old.dir->i_mtime = current_fs_time(old.dir->i_sb);
ext4_update_dx_flag(old.dir);
if (old.dir_bh) {
retval = ext4_rename_dir_finish(handle, &old, new.dir->i_ino);
@@ -3726,6 +3726,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
};
u8 new_file_type;
int retval;
+ struct timespec ctime;
if ((ext4_encrypted_inode(old_dir) ||
ext4_encrypted_inode(new_dir)) &&
@@ -3828,8 +3829,9 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
* Like most other Unix systems, set the ctime for inodes on a
* rename.
*/
- old.inode->i_ctime = ext4_current_time(old.inode);
- new.inode->i_ctime = ext4_current_time(new.inode);
+ ctime = current_fs_time(old.inode->i_sb);
+ old.inode->i_ctime = ctime;
+ new.inode->i_ctime = ctime;
ext4_mark_inode_dirty(handle, old.inode);
ext4_mark_inode_dirty(handle, new.inode);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3822a5a..c39cb7c 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5165,7 +5165,7 @@ static int ext4_quota_off(struct super_block *sb, int type)
handle = ext4_journal_start(inode, EXT4_HT_QUOTA, 1);
if (IS_ERR(handle))
goto out;
- inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb);
ext4_mark_inode_dirty(handle, inode);
ext4_journal_stop(handle);
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index e79bd32..808609c 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1253,7 +1253,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
}
if (!error) {
ext4_xattr_update_super_block(handle, inode->i_sb);
- inode->i_ctime = ext4_current_time(inode);
+ inode->i_ctime = current_fs_time(inode->i_sb);
if (!value)
ext4_clear_inode_state(inode, EXT4_STATE_NO_EXPAND);
error = ext4_mark_iloc_dirty(handle, inode, &is.iloc);
--
1.9.1
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
2016-06-09 5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
@ 2016-06-09 7:35 ` Jan Kara
2016-06-09 19:15 ` Linus Torvalds
2016-06-09 12:31 ` Bob Copeland
2016-06-10 22:21 ` Arnd Bergmann
2 siblings, 1 reply; 14+ messages in thread
From: Jan Kara @ 2016-06-09 7:35 UTC (permalink / raw)
To: Deepa Dinamani
Cc: Jan Kara, Bob Copeland, Adrian Hunter, David Howells,
Andreas Dilger, linux-afs, y2038, codalist, Christoph Hellwig,
coda, linux-ext4, Evgeniy Dushistov, Arnd Bergmann, Al Viro,
Thomas Gleixner, OGAWA Hirofumi, Jan Harkes, Theodore Ts'o,
Artem Bityutskiy, Tigran A. Aivazian, linux-kernel, Jan Kara,
linux-fsdevel, linux-mtd, Linus Torvalds, linux-karma-devel
On Wed 08-06-16 22:04:45, Deepa Dinamani wrote:
> CURRENT_TIME_SEC is not y2038 safe. current_fs_time() will
> be transitioned to use 64 bit time along with vfs in a
> separate patch.
> There is no plan to transistion CURRENT_TIME_SEC to use
> y2038 safe time interfaces.
>
> current_fs_time() will also be extended to use superblock
> range checking parameters when range checking is introduced.
>
> This works because alloc_super() fills in the the s_time_gran
> in super block to NSEC_PER_SEC.
>
> Also note that filesystem specific times like the birthtime,
> creation time that were using same interfaces to obtain time
> retain same logistics.
You create line longer than 80 characters for affs and reiserfs. Please
wrap those lines properly. Other than that feel free to add:
Acked-by: Jan Kara <jack@suse.cz>
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
2016-06-09 5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
2016-06-09 7:35 ` Jan Kara
@ 2016-06-09 12:31 ` Bob Copeland
2016-06-10 22:21 ` Arnd Bergmann
2 siblings, 0 replies; 14+ messages in thread
From: Bob Copeland @ 2016-06-09 12:31 UTC (permalink / raw)
To: Deepa Dinamani
Cc: linux-fsdevel, linux-kernel, Arnd Bergmann, Thomas Gleixner,
Al Viro, Linus Torvalds, y2038, Artem Bityutskiy, Adrian Hunter,
linux-mtd, Evgeniy Dushistov, OGAWA Hirofumi, Jan Kara,
linux-ext4, David Howells, linux-afs, Tigran A. Aivazian,
Theodore Ts'o, Andreas Dilger, Jan Kara, Jan Harkes, coda,
codalist, linux-karma-devel, Christoph Hellwig
On Wed, Jun 08, 2016 at 10:04:45PM -0700, Deepa Dinamani wrote:
> CURRENT_TIME_SEC is not y2038 safe. current_fs_time() will
> be transitioned to use 64 bit time along with vfs in a
> separate patch.
> There is no plan to transistion CURRENT_TIME_SEC to use
> y2038 safe time interfaces.
[...]
> Cc: Bob Copeland <me@bobcopeland.com>
OMFS parts look sane, thanks.
--
Bob Copeland %% http://bobcopeland.com/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
2016-06-09 5:04 ` [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps Deepa Dinamani
@ 2016-06-09 18:45 ` Linus Torvalds
2016-06-09 18:55 ` Linus Torvalds
2016-06-10 22:19 ` Arnd Bergmann
0 siblings, 2 replies; 14+ messages in thread
From: Linus Torvalds @ 2016-06-09 18:45 UTC (permalink / raw)
To: Deepa Dinamani
Cc: Theodore Ts'o, Arnd Bergmann, y2038,
Linux Kernel Mailing List, Andreas Dilger, Al Viro, linux-fsdevel,
Thomas Gleixner, linux-ext4@vger.kernel.org
On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
> current_fs_time() will be transitioned to be y2038 safe
> along with vfs.
>
> current_fs_time() returns timestamps according to the
> granularities set in the super_block.
All existing users and all the ones in this patch (and the others too,
although I didn't go through them very carefully) really would prefer
just passing in the inode directly, rather than the superblock.
So I don't want to add more users of this broken interface. It was a
mistake to use the superblock. The fact that the time granularity
exists there is pretty much irrelevant. If every single user wants to
use an inode pointer, then that is what the function should get.
Linus
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
2016-06-09 18:45 ` Linus Torvalds
@ 2016-06-09 18:55 ` Linus Torvalds
2016-06-10 22:19 ` Arnd Bergmann
1 sibling, 0 replies; 14+ messages in thread
From: Linus Torvalds @ 2016-06-09 18:55 UTC (permalink / raw)
To: Deepa Dinamani
Cc: linux-fsdevel, Linux Kernel Mailing List, Arnd Bergmann,
Thomas Gleixner, Al Viro, y2038, Theodore Ts'o,
Andreas Dilger, linux-ext4@vger.kernel.org
On Thu, Jun 9, 2016 at 11:45 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> All existing users and all the ones in this patch (and the others too,
> although I didn't go through them very carefully) really would prefer
> just passing in the inode directly, rather than the superblock.
Actually, there seems to be one exception to that "all existing
users", and that one exception (btrfs transacation time) really seems
to be broken. Exactly because it's *not* setting an inode time, it
shouldn't have used current_fs_time() to begin with, because it is
just setting an internal filesystem timestamp.
So not making the argument inode-related seems to actually encourage
people to misuse this function.
Linus
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
2016-06-09 7:35 ` Jan Kara
@ 2016-06-09 19:15 ` Linus Torvalds
2016-06-09 20:41 ` Deepa Dinamani
0 siblings, 1 reply; 14+ messages in thread
From: Linus Torvalds @ 2016-06-09 19:15 UTC (permalink / raw)
To: Jan Kara
Cc: Deepa Dinamani, linux-fsdevel, Linux Kernel Mailing List,
Arnd Bergmann, Thomas Gleixner, Al Viro, y2038, Artem Bityutskiy,
Adrian Hunter, linux-mtd, Evgeniy Dushistov, OGAWA Hirofumi,
Jan Kara, linux-ext4@vger.kernel.org, David Howells, linux-afs,
Tigran A. Aivazian, Theodore Ts'o, Andreas Dilger, Jan Harkes,
coda, codalist, Bob Copeland
On Thu, Jun 9, 2016 at 12:35 AM, Jan Kara <jack@suse.cz> wrote:
>
> You create line longer than 80 characters for affs and reiserfs. Please
> wrap those lines properly.
No, please do *NOT* do things like that.
These kind of mechanical patches should
(a) be as mechanical as possible (and see elsewhere about why I think
'sb' should be 'inode' and the patch should have been 95% automated
with a trivial script thanks to that change)
(b) be made as easy to verify visually as possible.
That (b) means that a conversion should *not* add whitespace fixups or
add other non-mechanical cleanups, because it's a *lot* easier to see
that a conversion like
- inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+ inode->i_mtime = inode->i_ctime = current_fs_time(inode);
makes no other changes, but if you start doing line-splitting or other
transformations (add new variables etc to get at 'sb'), suddenly you
have to verify the patch at a completely different level.
In other words, it's actually really important to make these kinds of
bulk changes be very very obvious. Including to the point of making
them visually easier to scan as a patch by not making any other
changes.
Linus
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
2016-06-09 19:15 ` Linus Torvalds
@ 2016-06-09 20:41 ` Deepa Dinamani
0 siblings, 0 replies; 14+ messages in thread
From: Deepa Dinamani @ 2016-06-09 20:41 UTC (permalink / raw)
To: Linus Torvalds
Cc: Jan Kara, Bob Copeland, Adrian Hunter, David Howells,
Andreas Dilger, linux-afs, y2038, codalist, Christoph Hellwig,
coda, linux-ext4@vger.kernel.org, Evgeniy Dushistov,
Arnd Bergmann, Al Viro, Thomas Gleixner, OGAWA Hirofumi,
Jan Harkes, Theodore Ts'o, Artem Bityutskiy,
Tigran A. Aivazian, Linux Kernel Mailing List, Jan Kara,
linux-fsdevel, linux-mtd
On Thu, Jun 9, 2016 at 12:15 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Thu, Jun 9, 2016 at 12:35 AM, Jan Kara <jack@suse.cz> wrote:
>>
>> You create line longer than 80 characters for affs and reiserfs. Please
>> wrap those lines properly.
>
> No, please do *NOT* do things like that.
>
> These kind of mechanical patches should
>
> (a) be as mechanical as possible (and see elsewhere about why I think
> 'sb' should be 'inode' and the patch should have been 95% automated
> with a trivial script thanks to that change)
>
> (b) be made as easy to verify visually as possible.
>
> That (b) means that a conversion should *not* add whitespace fixups or
> add other non-mechanical cleanups, because it's a *lot* easier to see
> that a conversion like
>
> - inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
> + inode->i_mtime = inode->i_ctime = current_fs_time(inode);
>
> makes no other changes, but if you start doing line-splitting or other
> transformations (add new variables etc to get at 'sb'), suddenly you
> have to verify the patch at a completely different level.
>
> In other words, it's actually really important to make these kinds of
> bulk changes be very very obvious. Including to the point of making
> them visually easier to scan as a patch by not making any other
> changes.
Thanks for the guidelines.
Only patches 1 and 4 are mechanical.
All others need some kind of inspection/ verification.
I will keep these in mind for updating 1 and 4.
-Deepa
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
2016-06-09 18:45 ` Linus Torvalds
2016-06-09 18:55 ` Linus Torvalds
@ 2016-06-10 22:19 ` Arnd Bergmann
2016-06-14 17:55 ` [Y2038] " Deepa Dinamani
1 sibling, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2016-06-10 22:19 UTC (permalink / raw)
To: y2038
Cc: Theodore Ts'o, Linux Kernel Mailing List, Andreas Dilger,
Deepa Dinamani, linux-fsdevel, Thomas Gleixner,
linux-ext4@vger.kernel.org, Linus Torvalds, Al Viro
On Thursday, June 9, 2016 11:45:01 AM CEST Linus Torvalds wrote:
> On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> > CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
> > current_fs_time() will be transitioned to be y2038 safe
> > along with vfs.
> >
> > current_fs_time() returns timestamps according to the
> > granularities set in the super_block.
>
> All existing users and all the ones in this patch (and the others too,
> although I didn't go through them very carefully) really would prefer
> just passing in the inode directly, rather than the superblock.
>
> So I don't want to add more users of this broken interface. It was a
> mistake to use the superblock. The fact that the time granularity
> exists there is pretty much irrelevant. If every single user wants to
> use an inode pointer, then that is what the function should get.
I guess it would help to give the function a new name in the process,
if only to avoid possible conflicts. That new name of course needs to
be at least as intuitive as the old one. How about
struct timespec fs_timestamp(struct inode *);
?
Arnd
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
2016-06-09 5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
2016-06-09 7:35 ` Jan Kara
2016-06-09 12:31 ` Bob Copeland
@ 2016-06-10 22:21 ` Arnd Bergmann
2016-06-11 5:03 ` Deepa Dinamani
2 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2016-06-10 22:21 UTC (permalink / raw)
To: Deepa Dinamani, Bob Copeland
Cc: Jan Kara, Adrian Hunter, David Howells, Andreas Dilger, linux-afs,
y2038, Christoph Hellwig, coda, linux-ext4, Evgeniy Dushistov,
Al Viro, Thomas Gleixner, OGAWA Hirofumi, Jan Harkes,
Theodore Ts'o, Artem Bityutskiy, Tigran A. Aivazian,
linux-kernel, Jan Kara, linux-fsdevel, linux-mtd, Linus Torvalds,
linux-karma-devel
On Wednesday, June 8, 2016 10:04:45 PM CEST Deepa Dinamani wrote:
> CURRENT_TIME_SEC is not y2038 safe. current_fs_time() will
> be transitioned to use 64 bit time along with vfs in a
> separate patch.
> There is no plan to transistion CURRENT_TIME_SEC to use
> y2038 safe time interfaces.
>
> current_fs_time() will also be extended to use superblock
> range checking parameters when range checking is introduced.
>
> This works because alloc_super() fills in the the s_time_gran
> in super block to NSEC_PER_SEC.
>
> Also note that filesystem specific times like the birthtime,
> creation time that were using same interfaces to obtain time
> retain same logistics.
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
one question:
In an earlier version, you had a small optimization to
use ktime_get_real_seconds() instead of current_kernel_time()
when the granularity is seconds.
Do you still plan to send that one, or did you decide we don't
need it?
Arnd
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
2016-06-10 22:21 ` Arnd Bergmann
@ 2016-06-11 5:03 ` Deepa Dinamani
2016-06-11 20:55 ` Arnd Bergmann
0 siblings, 1 reply; 14+ messages in thread
From: Deepa Dinamani @ 2016-06-11 5:03 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Jan Kara, Bob Copeland, Adrian Hunter, David Howells,
Andreas Dilger, linux-afs, y2038, Christoph Hellwig, coda,
linux-ext4, Evgeniy Dushistov, Al Viro, Thomas Gleixner,
OGAWA Hirofumi, Jan Harkes, Theodore Ts'o, Artem Bityutskiy,
Tigran A. Aivazian, Linux Kernel Mailing List, Jan Kara,
Linux FS-devel Mailing List, linux-mtd, Linus Torvalds,
linux-karma
On Fri, Jun 10, 2016 at 3:21 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Wednesday, June 8, 2016 10:04:45 PM CEST Deepa Dinamani wrote:
>> CURRENT_TIME_SEC is not y2038 safe. current_fs_time() will
>> be transitioned to use 64 bit time along with vfs in a
>> separate patch.
>> There is no plan to transistion CURRENT_TIME_SEC to use
>> y2038 safe time interfaces.
>>
>> current_fs_time() will also be extended to use superblock
>> range checking parameters when range checking is introduced.
>>
>> This works because alloc_super() fills in the the s_time_gran
>> in super block to NSEC_PER_SEC.
>>
>> Also note that filesystem specific times like the birthtime,
>> creation time that were using same interfaces to obtain time
>> retain same logistics.
>>
>> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
>
> one question:
>
> In an earlier version, you had a small optimization to
> use ktime_get_real_seconds() instead of current_kernel_time()
> when the granularity is seconds.
>
> Do you still plan to send that one, or did you decide we don't
> need it?
I was actually planning to use get_seconds() instead of current_kernel_time().
And, transition both along with vfs to y2038 safe apis.
Difference between ktime_get_real_seconds() and current_kernel_time64()
is not much because they both require sequence counter.
It didn't make sense to me to optimize current_fs_time() for seconds
only, and not optimize for 1ns granularity also.
I plan to make changes to the function depending on how we end up
using timespec_trunc()
after the addition of range checking.
Thanks for the guidance on inclusion of reviewers. I'll follow this
approach when I post v2 of the series.
-Deepa
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time()
2016-06-11 5:03 ` Deepa Dinamani
@ 2016-06-11 20:55 ` Arnd Bergmann
0 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2016-06-11 20:55 UTC (permalink / raw)
To: Deepa Dinamani
Cc: Jan Kara, Bob Copeland, Adrian Hunter, David Howells,
Andreas Dilger, linux-afs, y2038, Christoph Hellwig, coda,
linux-ext4, Evgeniy Dushistov, Al Viro, Thomas Gleixner,
OGAWA Hirofumi, Jan Harkes, Theodore Ts'o, Artem Bityutskiy,
Tigran A. Aivazian, Linux Kernel Mailing List, Jan Kara,
Linux FS-devel Mailing List, linux-mtd, Linus Torvalds,
linux-karma
On Friday, June 10, 2016 10:03:14 PM CEST Deepa Dinamani wrote:
> On Fri, Jun 10, 2016 at 3:21 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > In an earlier version, you had a small optimization to
> > use ktime_get_real_seconds() instead of current_kernel_time()
> > when the granularity is seconds.
> >
> > Do you still plan to send that one, or did you decide we don't
> > need it?
>
> I was actually planning to use get_seconds() instead of current_kernel_time().
> And, transition both along with vfs to y2038 safe apis.
> Difference between ktime_get_real_seconds() and current_kernel_time64()
> is not much because they both require sequence counter.
>
> It didn't make sense to me to optimize current_fs_time() for seconds
> only, and not optimize for 1ns granularity also.
Ah, you are right: adding another check for second granularity would
probably cost more than it would save, since we already don't calculate
the exact nanoseconds but just use the timestamp of the last timer
tick.
> I plan to make changes to the function depending on how we end up
> using timespec_trunc() after the addition of range checking.
Makes sense. I guess we can skip the range checking for
current_fs_time() if we end up not allowing writable mounts on
file systems that cannot represent the current time, but we
do want the range checking for the other users of
timespec_trunc().
Arnd
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Y2038] [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
2016-06-10 22:19 ` Arnd Bergmann
@ 2016-06-14 17:55 ` Deepa Dinamani
2016-06-14 20:59 ` Arnd Bergmann
0 siblings, 1 reply; 14+ messages in thread
From: Deepa Dinamani @ 2016-06-14 17:55 UTC (permalink / raw)
To: Arnd Bergmann
Cc: y2038, Linus Torvalds, Theodore Ts'o,
Linux Kernel Mailing List, Andreas Dilger, Al Viro, linux-fsdevel,
Thomas Gleixner, linux-ext4@vger.kernel.org
On Fri, Jun 10, 2016 at 3:19 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Thursday, June 9, 2016 11:45:01 AM CEST Linus Torvalds wrote:
>> On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>> > CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
>> > current_fs_time() will be transitioned to be y2038 safe
>> > along with vfs.
>> >
>> > current_fs_time() returns timestamps according to the
>> > granularities set in the super_block.
>>
>> All existing users and all the ones in this patch (and the others too,
>> although I didn't go through them very carefully) really would prefer
>> just passing in the inode directly, rather than the superblock.
>>
>> So I don't want to add more users of this broken interface. It was a
>> mistake to use the superblock. The fact that the time granularity
>> exists there is pretty much irrelevant. If every single user wants to
>> use an inode pointer, then that is what the function should get.
>
> I guess it would help to give the function a new name in the process,
> if only to avoid possible conflicts. That new name of course needs to
> be at least as intuitive as the old one. How about
>
> struct timespec fs_timestamp(struct inode *);
Would moving the function to fs/ directory (filesystems.c/ super.c /
inode.c) and calling it current_time() or fs_current_time() make
sense?
The declaration is already part of fs.h.
This is actually a vfs function.
And, the time functions it uses are already exported.
Leaving it in the time.c by renaming to current_time() would be
confusing in spite of
the struct inode* argument.
-Deepa
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps
2016-06-14 17:55 ` [Y2038] " Deepa Dinamani
@ 2016-06-14 20:59 ` Arnd Bergmann
0 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2016-06-14 20:59 UTC (permalink / raw)
To: Deepa Dinamani, John Stultz
Cc: Theodore Ts'o, y2038, Linux Kernel Mailing List,
Andreas Dilger, Al Viro, linux-fsdevel, Thomas Gleixner,
linux-ext4@vger.kernel.org, Linus Torvalds
On Tuesday, June 14, 2016 10:55:39 AM CEST Deepa Dinamani wrote:
> On Fri, Jun 10, 2016 at 3:19 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Thursday, June 9, 2016 11:45:01 AM CEST Linus Torvalds wrote:
> >> On Wed, Jun 8, 2016 at 10:04 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> >> > CURRENT_TIME_SEC and CURRENT_TIME are not y2038 safe.
> >> > current_fs_time() will be transitioned to be y2038 safe
> >> > along with vfs.
> >> >
> >> > current_fs_time() returns timestamps according to the
> >> > granularities set in the super_block.
> >>
> >> All existing users and all the ones in this patch (and the others too,
> >> although I didn't go through them very carefully) really would prefer
> >> just passing in the inode directly, rather than the superblock.
> >>
> >> So I don't want to add more users of this broken interface. It was a
> >> mistake to use the superblock. The fact that the time granularity
> >> exists there is pretty much irrelevant. If every single user wants to
> >> use an inode pointer, then that is what the function should get.
> >
> > I guess it would help to give the function a new name in the process,
> > if only to avoid possible conflicts. That new name of course needs to
> > be at least as intuitive as the old one. How about
> >
> > struct timespec fs_timestamp(struct inode *);
>
> Would moving the function to fs/ directory (filesystems.c/ super.c /
> inode.c) and calling it current_time() or fs_current_time() make
> sense?
> The declaration is already part of fs.h.
>
> This is actually a vfs function.
> And, the time functions it uses are already exported.
> Leaving it in the time.c by renaming to current_time() would be
> confusing in spite of
> the struct inode* argument.
I've looked up the original patch that introduced current_fs_time
at http://marc.info/?l=linux-kernel&m=110134111125012&w=3
From the patch, it's clear that current_fs_time was intentionally
added to the same file as current_kernel_time() so it could be
inlined there, but both functions have since been moved to different
files.
I agree moving both timespec_trunc and current_fs_time into
fs/inode.c or fs/attr.c seems appropriate then, or we could move
current_fs_time() into kernel/time/timekeeping.c and mark
current_kernel_time64() inline again.
When John Stultz moved this function in 2c6b47de17c7 ("Cleanup
non-arch xtime uses, use get_seconds() or current_kernel_time()."),
he evidently did not consider the "inline" behavior important
there, no idea if this is even measurable.
Arnd
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-06-14 20:59 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1465448705-25055-1-git-send-email-deepa.kernel@gmail.com>
2016-06-09 5:04 ` [PATCH 01/21] fs: Replace CURRENT_TIME_SEC with current_fs_time() Deepa Dinamani
2016-06-09 7:35 ` Jan Kara
2016-06-09 19:15 ` Linus Torvalds
2016-06-09 20:41 ` Deepa Dinamani
2016-06-09 12:31 ` Bob Copeland
2016-06-10 22:21 ` Arnd Bergmann
2016-06-11 5:03 ` Deepa Dinamani
2016-06-11 20:55 ` Arnd Bergmann
2016-06-09 5:04 ` [PATCH 02/21] fs: ext4: Use current_fs_time() for inode timestamps Deepa Dinamani
2016-06-09 18:45 ` Linus Torvalds
2016-06-09 18:55 ` Linus Torvalds
2016-06-10 22:19 ` Arnd Bergmann
2016-06-14 17:55 ` [Y2038] " Deepa Dinamani
2016-06-14 20:59 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).