From patchwork Sat Aug 13 22:48:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9278943 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 58E3E60780 for ; Sun, 14 Aug 2016 11:08:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4933E28925 for ; Sun, 14 Aug 2016 11:08:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DA9028927; Sun, 14 Aug 2016 11:08:07 +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 DACB028925 for ; Sun, 14 Aug 2016 11:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964864AbcHNLHw (ORCPT ); Sun, 14 Aug 2016 07:07:52 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:33477 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753311AbcHNLC2 (ORCPT ); Sun, 14 Aug 2016 07:02:28 -0400 Received: by mail-pa0-f65.google.com with SMTP id vy10so2044552pac.0; Sun, 14 Aug 2016 04:02:27 -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=Fy2p7GSli8AbFySFVzulkh5S9WBi2UjIINmowZyDxF8=; b=nuWH98T03/vewmGqrL3g4jjMx6s1q2eNtQ0kXwtQyU+v5FdFhZ78wEKS6P5lZcHLxI ejsauR4q7RuJard+OARvsv1gWZtyn4C7JT9wqXP/qmx67cJqm9iY5M6z2iBIrolXUu2D tfVlxM8soPQxe2P9OYsOPvOPneJhXvQfCg4pdZ+Lxummjf8idHs043Z38c7vVtpDksu8 IZJN52EsV2sT8PihhmBT8kHwHjtgaNFxydjL9K7ncO6ODhtnKzyrUBB80dvn54HtwhtP gMo2l2d9UCsi9tfr5h8RRQ5smxb0276thJ2LZQt3ATFQRxxOgtaBqjZ/zt+ewRZX7RXA wi4g== 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=Fy2p7GSli8AbFySFVzulkh5S9WBi2UjIINmowZyDxF8=; b=Ork2h/Ej5AqY7Xug3GKvBUWLcAfdKXar6P5tey4fIG6eu0TLg931CDGe7I/VF6n8RB XnIidLbyoCKOIpc2nonCitHmZaVyhIKOMg7FQbHFhrBPi/zs+mPF596CRJ2vT/xLq1aV 7dBubbIYqtHJmbIb5+3/4tmkSzsxAwstdP528OxtgcxkPxIAzc978iVgLJSiTlHY5/3C SZKgeA1ap+mf3DSwDbRKVjLycx0uXByluHp08sV4smpnzB3GDGaBQwuK6unQ6Is7NNbd iRbLZSJIpgXbifnRmeGIcwrNYXFAfCLe+lxFRhLk2qOYEiLKQeyRAiM6ln8O27+iarYY CRZQ== X-Gm-Message-State: AEkoousDIB3CNpk40f2M6J62V9FpIWHH0U7ECXdscpySWBcxQHmgJItQmge56j+c4JCYPA== X-Received: by 10.66.32.131 with SMTP id j3mr40767743pai.58.1471128575595; Sat, 13 Aug 2016 15:49:35 -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 81sm22528007pfm.90.2016.08.13.15.49.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Aug 2016 15:49:35 -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 v4 17/26] fs: ocfs2: Use time64_t to represent orphan scan times Date: Sat, 13 Aug 2016 15:48:29 -0700 Message-Id: <1471128518-24075-18-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471128518-24075-1-git-send-email-deepa.kernel@gmail.com> References: <1471128518-24075-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 Reviewed-by: Arnd Bergmann 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 a244f14..d5e5fa7 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1947,7 +1947,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: @@ -2004,7 +2004,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 603b28d..bf3ca30 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");