mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Deepa Dinamani <deepa.kernel@gmail.com>
To: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org
Cc: Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	David Howells <dhowells@redhat.com>,
	Michal Hocko <mhocko@suse.com>
Subject: [PATCH 6/8] fs: ramfs: Replace CURRENT_TIME by current_fs_time()
Date: Mon, 22 Feb 2016 07:17:52 -0800	[thread overview]
Message-ID: <1456154274-30487-7-git-send-email-deepa.kernel@gmail.com> (raw)
In-Reply-To: <1456154274-30487-1-git-send-email-deepa.kernel@gmail.com>

CURRENT_TIME macro is not appropriate for filesystems as it
doesn't use the right granularity for filesystem timestamps.
Use current_fs_time() instead.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
---
 fs/ramfs/inode.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 38981b0..ce69aec 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -61,7 +61,8 @@ struct inode *ramfs_get_inode(struct super_block *sb,
 		inode->i_mapping->a_ops = &ramfs_aops;
 		mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
 		mapping_set_unevictable(inode->i_mapping);
-		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+		inode->i_atime = inode->i_mtime =
+			inode->i_ctime = current_fs_time(sb);
 		switch (mode & S_IFMT) {
 		default:
 			init_special_inode(inode, mode, dev);
@@ -93,14 +94,15 @@ struct inode *ramfs_get_inode(struct super_block *sb,
 static int
 ramfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
 {
-	struct inode * inode = ramfs_get_inode(dir->i_sb, dir, mode, dev);
+	struct super_block *sb = dir->i_sb;
+	struct inode *inode = ramfs_get_inode(sb, dir, mode, dev);
 	int error = -ENOSPC;
 
 	if (inode) {
 		d_instantiate(dentry, inode);
 		dget(dentry);	/* Extra count - pin the dentry in core */
 		error = 0;
-		dir->i_mtime = dir->i_ctime = CURRENT_TIME;
+		dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 	}
 	return error;
 }
@@ -120,17 +122,18 @@ static int ramfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 
 static int ramfs_symlink(struct inode * dir, struct dentry *dentry, const char * symname)
 {
+	struct super_block *sb = dir->i_sb;
 	struct inode *inode;
 	int error = -ENOSPC;
 
-	inode = ramfs_get_inode(dir->i_sb, dir, S_IFLNK|S_IRWXUGO, 0);
+	inode = ramfs_get_inode(sb, dir, S_IFLNK|S_IRWXUGO, 0);
 	if (inode) {
 		int l = strlen(symname)+1;
 		error = page_symlink(inode, symname, l);
 		if (!error) {
 			d_instantiate(dentry, inode);
 			dget(dentry);
-			dir->i_mtime = dir->i_ctime = CURRENT_TIME;
+			dir->i_mtime = dir->i_ctime = current_fs_time(sb);
 		} else
 			iput(inode);
 	}
-- 
1.9.1

  parent reply	other threads:[~2016-02-22 15:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 15:17 [PATCH 0/8] Remove CURRENT_TIME and CURRENT_TIME_SEC - PART 2 Deepa Dinamani
2016-02-22 15:17 ` [PATCH 1/8] fs: debugfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani
2016-02-22 15:17 ` [PATCH 2/8] fs: logfs: " Deepa Dinamani
2016-02-22 15:17 ` [PATCH 3/8] fs: devpts: " Deepa Dinamani
2016-02-22 15:17 ` [PATCH 4/8] fs: configfs: " Deepa Dinamani
2016-02-24  9:02   ` Joel Becker
2016-02-26  9:45   ` stoph Hellwig
2016-02-22 15:17 ` [PATCH 5/8] fs: proc: " Deepa Dinamani
2016-02-22 15:17 ` Deepa Dinamani [this message]
2016-02-22 15:17 ` [PATCH 7/8] fs: kernfs: " Deepa Dinamani
2016-02-22 15:17 ` [PATCH 8/8] net: sunrpc: " Deepa Dinamani
2016-02-22 15:34   ` Trond Myklebust
2016-02-22 15:47     ` Deepa Dinamani
2016-02-24 15:08     ` [Y2038] " Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456154274-30487-7-git-send-email-deepa.kernel@gmail.com \
    --to=deepa.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome