[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1491613030-11599-2-git-send-email-deepa.kernel@gmail.com>
Date: Fri, 7 Apr 2017 17:56:59 -0700
From: Deepa Dinamani <deepa.kernel@...il.com>
To: linux-kernel@...r.kernel.org, akpm@...ux-foundation.org
Cc: tglx@...utronix.de, viro@...iv.linux.org.uk,
gregkh@...uxfoundation.org, andreas.dilger@...el.com,
arnd@...db.de, bfields@...ldses.org, clm@...com,
davem@...emloft.net, dsterba@...e.com, dushistov@...l.ru,
eparis@...hat.com, jaegeuk@...nel.org, jbacik@...com,
jlayton@...chiereds.net, john.stultz@...aro.org,
jsimmons@...radead.org, mingo@...hat.com, oleg.drokin@...el.com,
paul@...l-moore.com, rostedt@...dmis.org, yuchao0@...wei.com,
ceph-devel@...r.kernel.org, devel@...verdev.osuosl.org,
linux-audit@...hat.com, linux-btrfs@...r.kernel.org,
linux-cifs@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
linux-fsdevel@...r.kernel.org, linux-mtd@...ts.infradead.org,
linux-security-module@...r.kernel.org,
lustre-devel@...ts.lustre.org, netdev@...r.kernel.org,
samba-technical@...ts.samba.org, y2038@...ts.linaro.org
Subject: [PATCH 01/12] fs: f2fs: Use ktime_get_real_seconds for sit_info times
CURRENT_TIME_SEC is not y2038 safe.
Replace use of CURRENT_TIME_SEC with ktime_get_real_seconds
in segment timestamps used by GC algorithm including the
segment mtime timestamps.
Signed-off-by: Deepa Dinamani <deepa.kernel@...il.com>
Reviewed-by: Arnd Bergmann <arnd@...db.de>
---
fs/f2fs/segment.c | 2 +-
fs/f2fs/segment.h | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 010324c..0531500 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2678,7 +2678,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
sit_i->dirty_sentries = 0;
sit_i->sents_per_block = SIT_ENTRY_PER_BLOCK;
sit_i->elapsed_time = le64_to_cpu(sbi->ckpt->elapsed_time);
- sit_i->mounted_time = CURRENT_TIME_SEC.tv_sec;
+ sit_i->mounted_time = ktime_get_real_seconds();
mutex_init(&sit_i->sentry_lock);
return 0;
}
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 57e36c1..156afc3 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -692,8 +692,9 @@ static inline void set_to_next_sit(struct sit_info *sit_i, unsigned int start)
static inline unsigned long long get_mtime(struct f2fs_sb_info *sbi)
{
struct sit_info *sit_i = SIT_I(sbi);
- return sit_i->elapsed_time + CURRENT_TIME_SEC.tv_sec -
- sit_i->mounted_time;
+ time64_t now = ktime_get_real_seconds();
+
+ return sit_i->elapsed_time + now - sit_i->mounted_time;
}
static inline void set_summary(struct f2fs_summary *sum, nid_t nid,
--
2.7.4
Powered by blists - more mailing lists