Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1339651
| From | Deepa Dinamani <deepa.kernel@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/8] fs: logfs: Replace CURRENT_TIME by current_fs_time() |
| Date | 2016-02-22 16:30 +0100 |
| Message-ID | <r50AY-7F1-59@gated-at.bofh.it> (permalink) |
| References | <r50rf-7B2-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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: Joern Engel <joern@logfs.org>
Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
Cc: logfs@logfs.org
---
fs/logfs/dir.c | 11 +++++++----
fs/logfs/file.c | 2 +-
fs/logfs/inode.c | 3 +--
fs/logfs/readwrite.c | 7 ++++---
4 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c
index 542468e..3b5f279 100644
--- a/fs/logfs/dir.c
+++ b/fs/logfs/dir.c
@@ -212,7 +212,8 @@ static void abort_transaction(struct inode *inode, struct logfs_transaction *ta)
static int logfs_unlink(struct inode *dir, struct dentry *dentry)
{
- struct logfs_super *super = logfs_super(dir->i_sb);
+ struct super_block *sb = dir->i_sb;
+ struct logfs_super *super = logfs_super(sb);
struct inode *inode = d_inode(dentry);
struct logfs_transaction *ta;
struct page *page;
@@ -226,7 +227,8 @@ static int logfs_unlink(struct inode *dir, struct dentry *dentry)
ta->state = UNLINK_1;
ta->ino = inode->i_ino;
- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ inode->i_ctime = dir->i_ctime =
+ dir->i_mtime = current_fs_time(sb);
page = logfs_get_dd_page(dir, dentry);
if (!page) {
@@ -540,7 +542,8 @@ static int logfs_link(struct dentry *old_dentry, struct inode *dir,
{
struct inode *inode = d_inode(old_dentry);
- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ inode->i_ctime = dir->i_ctime =
+ dir->i_mtime = current_fs_time(dir->i_sb);
ihold(inode);
inc_nlink(inode);
mark_inode_dirty_sync(inode);
@@ -573,7 +576,7 @@ static int logfs_delete_dd(struct inode *dir, loff_t pos)
* (crc-protected) journal.
*/
BUG_ON(beyond_eof(dir, pos));
- dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
log_dir(" Delete dentry (%lx, %llx)\n", dir->i_ino, pos);
return logfs_delete(dir, pos, NULL);
}
diff --git a/fs/logfs/file.c b/fs/logfs/file.c
index 61eaeb1..339ae40 100644
--- a/fs/logfs/file.c
+++ b/fs/logfs/file.c
@@ -211,7 +211,7 @@ long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
li->li_flags = flags;
inode_unlock(inode);
- inode->i_ctime = CURRENT_TIME;
+ inode->i_ctime = current_fs_time(inode->i_sb);
mark_inode_dirty_sync(inode);
return 0;
diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c
index db9cfc5..65eaf09 100644
--- a/fs/logfs/inode.c
+++ b/fs/logfs/inode.c
@@ -213,8 +213,7 @@ static void logfs_init_inode(struct super_block *sb, struct inode *inode)
i_gid_write(inode, 0);
inode->i_size = 0;
inode->i_blocks = 0;
- inode->i_ctime = CURRENT_TIME;
- inode->i_mtime = CURRENT_TIME;
+ inode->i_ctime = inode->i_mtime = current_fs_time(sb);
li->li_refcount = 1;
INIT_LIST_HEAD(&li->li_freeing_list);
diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c
index 20973c9..361a2d0 100644
--- a/fs/logfs/readwrite.c
+++ b/fs/logfs/readwrite.c
@@ -1539,14 +1539,15 @@ static int grow_inode(struct inode *inode, u64 bix, level_t level)
static int __logfs_write_buf(struct inode *inode, struct page *page, long flags)
{
- struct logfs_super *super = logfs_super(inode->i_sb);
+ struct super_block *sb = inode->i_sb;
+ struct logfs_super *super = logfs_super(sb);
pgoff_t index = page->index;
u64 bix;
level_t level;
int err;
flags |= WF_WRITE | WF_DELETE;
- inode->i_ctime = inode->i_mtime = CURRENT_TIME;
+ inode->i_ctime = inode->i_mtime = current_fs_time(sb);
logfs_unpack_index(index, &bix, &level);
if (logfs_block(page) && logfs_block(page)->reserved_bytes)
@@ -1578,7 +1579,7 @@ static int __logfs_delete(struct inode *inode, struct page *page)
long flags = WF_DELETE;
int err;
- inode->i_ctime = inode->i_mtime = CURRENT_TIME;
+ inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
if (page->index < I0_BLOCKS)
return logfs_write_direct(inode, page, flags);
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/8] Remove CURRENT_TIME and CURRENT_TIME_SEC - PART 2 Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-22 16:20 +0100
[PATCH 1/8] fs: debugfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-22 16:30 +0100
[PATCH 8/8] net: sunrpc: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-22 16:30 +0100
Re: [PATCH 8/8] net: sunrpc: Replace CURRENT_TIME by current_fs_time() Trond Myklebust <trond.myklebust@primarydata.com> - 2016-02-22 16:40 +0100
Re: [PATCH 8/8] net: sunrpc: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-22 16:50 +0100
Re: [Y2038] [PATCH 8/8] net: sunrpc: Replace CURRENT_TIME by current_fs_time() Arnd Bergmann <arnd@arndb.de> - 2016-02-24 16:10 +0100
[PATCH 7/8] fs: kernfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-22 16:30 +0100
[PATCH 3/8] fs: devpts: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-22 16:30 +0100
[PATCH 6/8] fs: ramfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-22 16:30 +0100
[PATCH 4/8] fs: configfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-22 16:30 +0100
Re: [PATCH 4/8] fs: configfs: Replace CURRENT_TIME by current_fs_time() Joel Becker <jlbec@evilplan.org> - 2016-02-24 10:10 +0100
Re: [PATCH 4/8] fs: configfs: Replace CURRENT_TIME by current_fs_time() stoph Hellwig <hch@lst.de> - 2016-02-26 10:50 +0100
[PATCH 5/8] fs: proc: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-22 16:30 +0100
[PATCH 2/8] fs: logfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-22 16:30 +0100
csiph-web