[PATCH 29/73] staging/lustre: use 64-bit times for ptlrpc_sec

green at linuxhacker.ru green at linuxhacker.ru
Sun Sep 27 20:45:29 UTC 2015


From: Arnd Bergmann <arnd at arndb.de>

Here we use an unsigned long to store the timeout for gc,
which is probably safe until 2106, but this patch converts it
to use ktime_get_real_seconds() and time64_t for consistency.

Signed-off-by: Arnd Bergmann <arnd at arndb.de>
Signed-off-by: Oleg Drokin <green at linuxhacker.ru>
---
 drivers/staging/lustre/lustre/include/lustre_sec.h | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_gc.c      | 6 +++---
 drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c   | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h
index 707ff69..871185c 100644
--- a/drivers/staging/lustre/lustre/include/lustre_sec.h
+++ b/drivers/staging/lustre/lustre/include/lustre_sec.h
@@ -833,7 +833,7 @@ struct ptlrpc_sec {
 	 */
 	struct list_head		      ps_gc_list;
 	unsigned long		      ps_gc_interval; /* in seconds */
-	unsigned long		      ps_gc_next;     /* in seconds */
+	time64_t		      ps_gc_next;     /* in seconds */
 };
 
 static inline int sec_is_reverse(struct ptlrpc_sec *sec)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c
index cdad608..c3ad1da 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c
@@ -69,7 +69,7 @@ void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec)
 	LASSERT(sec->ps_gc_interval > 0);
 	LASSERT(list_empty(&sec->ps_gc_list));
 
-	sec->ps_gc_next = get_seconds() + sec->ps_gc_interval;
+	sec->ps_gc_next = ktime_get_real_seconds() + sec->ps_gc_interval;
 
 	spin_lock(&sec_gc_list_lock);
 	list_add_tail(&sec_gc_list, &sec->ps_gc_list);
@@ -154,11 +154,11 @@ static void sec_do_gc(struct ptlrpc_sec *sec)
 
 	CDEBUG(D_SEC, "check on sec %p(%s)\n", sec, sec->ps_policy->sp_name);
 
-	if (cfs_time_after(sec->ps_gc_next, get_seconds()))
+	if (sec->ps_gc_next > ktime_get_real_seconds())
 		return;
 
 	sec->ps_policy->sp_cops->gc_ctx(sec);
-	sec->ps_gc_next = get_seconds() + sec->ps_gc_interval;
+	sec->ps_gc_next = ktime_get_real_seconds() + sec->ps_gc_interval;
 }
 
 static int sec_gc_main(void *arg)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
index 68fcac1..a74e2f0 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
@@ -98,9 +98,9 @@ static int sptlrpc_info_lprocfs_seq_show(struct seq_file *seq, void *v)
 		   atomic_read(&sec->ps_refcount));
 	seq_printf(seq, "nctx:	  %d\n", atomic_read(&sec->ps_nctx));
 	seq_printf(seq, "gc internal    %ld\n", sec->ps_gc_interval);
-	seq_printf(seq, "gc next	%ld\n",
+	seq_printf(seq, "gc next	%lld\n",
 		   sec->ps_gc_interval ?
-		   sec->ps_gc_next - get_seconds() : 0);
+		   (s64)(sec->ps_gc_next - ktime_get_real_seconds()) : 0ll);
 
 	sptlrpc_sec_put(sec);
 out:
-- 
2.1.0



More information about the devel mailing list