summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.h
diff options
context:
space:
mode:
authorDeepa Dinamani <deepa.kernel@gmail.com>2017-05-09 00:59:10 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-09 02:15:15 +0200
commit48fbfe50f1d5fef51bac98d105d2a28df42a1205 (patch)
tree9717ff08a30f206b190e197995ec889dbcd06cfa /fs/f2fs/segment.h
parentformat-security: move static strings to const (diff)
downloadlinux-48fbfe50f1d5fef51bac98d105d2a28df42a1205.tar.xz
linux-48fbfe50f1d5fef51bac98d105d2a28df42a1205.zip
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. Link: http://lkml.kernel.org/r/1491613030-11599-2-git-send-email-deepa.kernel@gmail.com Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Cc: Jaegeuk Kim <jaegeuk@kernel.org> Cc: Chao Yu <yuchao0@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--fs/f2fs/segment.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 5e8ad4280a50..313b99040aa6 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -691,8 +691,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,