linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Deepa Dinamani <deepa.kernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org
Cc: yuchao0-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org,
	clm-b10kYP2dOMg@public.gmane.org,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	dushistov-JGs/UdohzUI@public.gmane.org,
	jlayton-vpEMnDpepFuMZCB2o+C8xQ@public.gmane.org,
	tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	paul-r2n+y4ga6xFZroRs9YW3xA@public.gmane.org,
	y2038-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
	mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	arnd-r2nGTMty4D4@public.gmane.org,
	rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org,
	oleg.drokin-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org,
	dsterba-IBi9RG/b67k@public.gmane.org,
	jaegeuk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	ceph-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	jbacik-b10kYP2dOMg@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org,
	eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-f2fs-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-audit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	lustre-devel-aLEFhgZF4x6X6Mz3xDxJMA@public.gmane.org
Subject: [PATCH 01/12] fs: f2fs: Use ktime_get_real_seconds for sit_info times
Date: Fri,  7 Apr 2017 17:56:59 -0700	[thread overview]
Message-ID: <1491613030-11599-2-git-send-email-deepa.kernel@gmail.com> (raw)
In-Reply-To: <1491613030-11599-1-git-send-email-deepa.kernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Reviewed-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 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

  parent reply	other threads:[~2017-04-08  0:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08  0:56 [PATCH 00/12] Delete CURRENT_TIME, CURRENT_TIME_SEC and current_fs_time Deepa Dinamani
2017-04-08  0:57 ` [PATCH 08/12] fs: ubifs: Replace CURRENT_TIME_SEC with current_time Deepa Dinamani
     [not found] ` <1491613030-11599-1-git-send-email-deepa.kernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-08  0:56   ` Deepa Dinamani [this message]
2017-04-08  0:57   ` [PATCH 02/12] trace: Make trace_hwlat timestamp y2038 safe Deepa Dinamani
2017-04-08  1:30     ` Steven Rostedt
     [not found]       ` <20170407213011.36e29f42-f9ZlEuEWxVcJvu8Pb33WZ0EMvNT87kid@public.gmane.org>
2017-04-08  2:16         ` Deepa Dinamani
2017-04-08  0:57   ` [PATCH 03/12] fs: cifs: Replace CURRENT_TIME by other appropriate apis Deepa Dinamani
2017-04-08  0:57   ` [PATCH 04/12] fs: ceph: CURRENT_TIME with ktime_get_real_ts() Deepa Dinamani
     [not found]     ` <1491613030-11599-5-git-send-email-deepa.kernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-01  9:56       ` Yan, Zheng
     [not found]         ` <CAAM7YAmp=cZKqGHa8UqDnrQLCe+6TKx+7w9SDZv4cW5fr4dfvA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-01 10:22           ` Arnd Bergmann
2017-06-02  0:26             ` Yan, Zheng
2017-06-02  0:36               ` John Stultz
     [not found]                 ` <CALAqxLV-yVKWM5es7fAFiDzhSQmtZFiZDPQwBRUYbWUtqhoWVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-02  0:57                   ` Deepa Dinamani
2017-06-02  2:09                     ` Yan, Zheng
     [not found]                       ` <CAAM7YAkXNo_69tOrw6a5kpyref9nEpEp-2vxBbFVSHGmAVbt+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-02  9:45                         ` Arnd Bergmann
     [not found]                           ` <CAK8P3a1TwkVRCwDWqgYE8Z3wZT2+v6xayq=dVeW8KaHmO0W4cg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-02 10:10                             ` Yan, Zheng
     [not found]                               ` <CAAM7YA=BJHFLz_Ud==7L=yCzxj+1sjctc68tvpNogPhiSxxELQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-02 10:51                                 ` Arnd Bergmann
2017-06-02 11:18                                   ` Yan, Zheng
     [not found]                                     ` <CAAM7YAk8JNU=XV=sOCczagWjBimO4JSPU08th7E4u6FTJN--9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-02 11:33                                       ` Arnd Bergmann
2017-06-02 12:18                                         ` Yan, Zheng
     [not found]                                           ` <CAAM7YA=f74Wye8hgqR52CNG-c4Sh3sm74AzZYhSnhjN1B=G-Ow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-02 14:18                                             ` Arnd Bergmann
2017-06-04  7:54                                               ` Yan, Zheng
2017-06-02  0:35             ` Yan, Zheng
2017-04-08  0:57   ` [PATCH 05/12] fs: ufs: Use ktime_get_real_ts64() for birthtime Deepa Dinamani
2017-04-08  0:57   ` [PATCH 06/12] audit: Use timespec64 to represent audit timestamps Deepa Dinamani
2017-04-08 12:40     ` Paul Moore
2017-04-08 17:58       ` Deepa Dinamani
2017-04-11 20:12         ` Paul Moore
     [not found]         ` <CABeXuvoKmvbo_n3XQ0Y+iWGz88Jr3TwbPA7GiR3pia9407ANLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-15 10:29           ` Arnd Bergmann
2017-04-08  0:57   ` [PATCH 07/12] fs: btrfs: Use ktime_get_real_ts for root ctime Deepa Dinamani
2017-04-12 13:42     ` David Sterba
2017-04-08  0:57   ` [PATCH 09/12] lustre: Replace CURRENT_TIME macro Deepa Dinamani
2017-04-08  0:57   ` [PATCH 10/12] apparmorfs: Replace CURRENT_TIME with current_time() Deepa Dinamani
2017-06-02  7:29     ` John Johansen
2017-04-08  0:57 ` [PATCH 11/12] time: Delete CURRENT_TIME_SEC and CURRENT_TIME Deepa Dinamani
2017-04-08  0:57 ` [PATCH 12/12] time: Delete current_fs_time() function Deepa Dinamani

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=1491613030-11599-2-git-send-email-deepa.kernel@gmail.com \
    --to=deepa.kernel-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org \
    --cc=ceph-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=clm-b10kYP2dOMg@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org \
    --cc=dsterba-IBi9RG/b67k@public.gmane.org \
    --cc=dushistov-JGs/UdohzUI@public.gmane.org \
    --cc=eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=jaegeuk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=jbacik-b10kYP2dOMg@public.gmane.org \
    --cc=jlayton-vpEMnDpepFuMZCB2o+C8xQ@public.gmane.org \
    --cc=john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-audit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-f2fs-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lustre-devel-aLEFhgZF4x6X6Mz3xDxJMA@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=oleg.drokin-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=paul-r2n+y4ga6xFZroRs9YW3xA@public.gmane.org \
    --cc=rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org \
    --cc=samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    --cc=y2038-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
    --cc=yuchao0-hv44wF8Li93QT0dZR+AlfA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).