From patchwork Sat Jun 25 21:37:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9198769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9F4BA6075F for ; Sat, 25 Jun 2016 21:41:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95CC428527 for ; Sat, 25 Jun 2016 21:41:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A9C32852B; Sat, 25 Jun 2016 21:41:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16D8728527 for ; Sat, 25 Jun 2016 21:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751438AbcFYVlf (ORCPT ); Sat, 25 Jun 2016 17:41:35 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:35917 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857AbcFYVik (ORCPT ); Sat, 25 Jun 2016 17:38:40 -0400 Received: by mail-pa0-f65.google.com with SMTP id av7so5854709pac.3; Sat, 25 Jun 2016 14:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qFL9+G+nCOdFCHDNdef5WLnPp1M5/kOrISg/InwJZUg=; b=KEF/vpfQyI5sTGL7k5U4Bry9bToFLixrU4MVfB0r3bBW8SHk7hORiezmszcUI65auL qXYOMmoGBrTsvYTIejCmvT3CgX858xS9F8rEOGjuleZ2DzTnKMJRwkSBKHsuPSqmFdBT fdsycZ2CJh5CXDIrpvbNNc1x7gpCTb6iQGlhk29f2vHFsRCqEfxN/CU5xtk+fjHFkFvN oeReew6U0oXwJPnmVJml5RcLkc6B3ejlSepyJ2akSDw5X7DjFtLIvwwicJkl3oQxzqXV Rx/HnHW+6+2n8zL1KiU5wOE8S1FdpwE9CqeBPWfMRtteAN9NKbJ1LtJsvQdaQLg1F+iC 65SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qFL9+G+nCOdFCHDNdef5WLnPp1M5/kOrISg/InwJZUg=; b=DrFk3uG2epicLhWKs797GpXA7kcKXSypCCb8cE30gccA6oB5OyaKeDIc2lg0qGzJPi FQtXN6IxxGm9I7O9XWaJEq4GpDKhhik0RSbpHFp8VqaHYHMQH+WxMIrF/b5DYSUTdc/P uFw7F9Vos2NdC1O+AHM0M8pK6lLkvztU69O+ATXdE/vh1h+Y6ucTwlBMQaio9ItJQzP8 54xCtxVpNx8aZsondpiF/sTil1GRycjSb0RCBwwX8c6oxy4vsKer7o/IXBU3ClFPadhJ R6PcjN12weFbZYDlhtbBxcN0HF2NgN0m6IOCHT9cGHRtSTABcCytkvaoR1NFIeRj1zPK kVZg== X-Gm-Message-State: ALyK8tKUEqUZiG6VL2ujIimGAoZUcqlLVnRJ/KEv8GEg9K79q9d6adfUHdIp6G6RkCBQ3w== X-Received: by 10.66.89.34 with SMTP id bl2mr20069827pab.80.1466890719801; Sat, 25 Jun 2016 14:38:39 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net (c-73-252-251-201.hsd1.ca.comcast.net. [73.252.251.201]) by smtp.gmail.com with ESMTPSA id m8sm1861308pfi.27.2016.06.25.14.38.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 Jun 2016 14:38:39 -0700 (PDT) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, tglx@linutronix.de, torvalds@linux-foundation.org, tytso@mit.edu, viro@zeniv.linux.org.uk, y2038@lists.linaro.org, Mark Fasheh , Joel Becker , ocfs2-devel@oss.oracle.com Subject: [PATCH v3 16/24] fs: ocfs2: Use time64_t to represent orphan scan times Date: Sat, 25 Jun 2016 14:37:40 -0700 Message-Id: <1466890668-23400-17-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466890668-23400-1-git-send-email-deepa.kernel@gmail.com> References: <1466890668-23400-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP struct timespec is not y2038 safe. Use time64_t which is y2038 safe to represent orphan scan times. time64_t is sufficient here as only the seconds delta times are relevant. Also use appropriate time functions that return time in time64_t format. Time functions now return monotonic time instead of real time as only delta scan times are relevant and these values are not persistent across reboots. The format string for the debug print is still using long as this is only the time elapsed since the last scan and long is sufficient to represent this value. Signed-off-by: Deepa Dinamani Cc: Mark Fasheh Cc: Joel Becker Cc: ocfs2-devel@oss.oracle.com --- fs/ocfs2/journal.c | 4 ++-- fs/ocfs2/ocfs2.h | 2 +- fs/ocfs2/super.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index bc0e21e..ab68933 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1949,7 +1949,7 @@ static void ocfs2_queue_orphan_scan(struct ocfs2_super *osb) */ seqno++; os->os_count++; - os->os_scantime = CURRENT_TIME; + os->os_scantime = ktime_get_seconds(); unlock: ocfs2_orphan_scan_unlock(osb, seqno); out: @@ -2006,7 +2006,7 @@ void ocfs2_orphan_scan_start(struct ocfs2_super *osb) struct ocfs2_orphan_scan *os; os = &osb->osb_orphan_scan; - os->os_scantime = CURRENT_TIME; + os->os_scantime = ktime_get_seconds(); if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb)) atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE); else { diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index e63af7d..7e5958b 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h @@ -224,7 +224,7 @@ struct ocfs2_orphan_scan { struct ocfs2_super *os_osb; struct ocfs2_lock_res os_lockres; /* lock to synchronize scans */ struct delayed_work os_orphan_scan_work; - struct timespec os_scantime; /* time this node ran the scan */ + time64_t os_scantime; /* time this node ran the scan */ u32 os_count; /* tracks node specific scans */ u32 os_seqno; /* tracks cluster wide scans */ atomic_t os_state; /* ACTIVE or INACTIVE */ diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 3971146..6992c00 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -337,7 +337,7 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len) out += snprintf(buf + out, len - out, "Disabled\n"); else out += snprintf(buf + out, len - out, "%lu seconds ago\n", - (get_seconds() - os->os_scantime.tv_sec)); + (unsigned long)(ktime_get_seconds() - os->os_scantime)); out += snprintf(buf + out, len - out, "%10s => %3s %10s\n", "Slots", "Num", "RecoGen");