From patchwork Mon Jun 20 00:27:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9186415 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 D23616075E for ; Mon, 20 Jun 2016 01:39:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5BEE20748 for ; Mon, 20 Jun 2016 01:39:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8C1E22230; Mon, 20 Jun 2016 01:39:31 +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 0C87020748 for ; Mon, 20 Jun 2016 01:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752208AbcFTBjZ (ORCPT ); Sun, 19 Jun 2016 21:39:25 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:33341 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752186AbcFTBjY (ORCPT ); Sun, 19 Jun 2016 21:39:24 -0400 Received: by mail-pa0-f68.google.com with SMTP id ts6so9777796pac.0; Sun, 19 Jun 2016 18:39:19 -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=KbfRFyNeWv0ySmdXJDB6YA3PMgiktfxtvd81El/k6uc=; b=QsTqAF4UrRPvNq6T1VdTWvyZruRF007tlEc7Lo8JbuP7+lQICKCWRedUN2dBQWakhX pGtdmnqRUYenXKohh2ka1xGcZVVO2pvplUgYdK/aYH1WaVKdjb6ui/J30H74k84tYjE8 vm0dUcq4EcJaO5/b6WZ+Y3pTFNLJ+T3XqJ0XyK+yOaRLyM0XhA+aOqptT8YXfhEx5Uzf taaaLNs1JtERsFMoonpWbrgonCHdOl2m0NP/szmRBAAs8kBnXtyWKqCYGhZ0n+5aVkFk ZeGHipDtEq+ZetsMQ/1p6Z5w/vF3RtMLyWXjTdEeHg3OyptWGoq/XRAVeIFD65K7VTSK JdbA== 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=KbfRFyNeWv0ySmdXJDB6YA3PMgiktfxtvd81El/k6uc=; b=VrF7MHgMrxF4JiRwYBhPPS1kS07x0m5Swk8DnQFPvoxzTfIL9iOPPhhQ8L5b8FCW9u xfUYCDS//mwu4k/fxKqQ9nsurYEQ6qYL1AC8vq/UtJmRB1/Q8jvdJutBYLXxYbeoeZ9Q 6g7D5C9aWc1O6PWjeGTXyZJ2cfH0KbEaB7e6GN9V4MK6U/ImBO1l7scXHoU9NwbzNJx6 vCEQdcRbAMXc+2EaUEdqz+Ok9+sJiS+qNy235uwrVynOC7DfjUevbFUjjGlyekjRv/Pa 3+hm/AZFP1XnhWVWPlsbPXsSSmU/3hhTp1T23iHXUVh7LQ45RkpvP0tfjbtgF8a3AEj+ 6lXg== X-Gm-Message-State: ALyK8tJFXzENFsyL/ERlm7wRm6oFkomdK90HZVdHjZKP3CK9Bc0jryoLRiib/ZxOc+M3RQ== X-Received: by 10.66.248.3 with SMTP id yi3mr102077pac.61.1466382510025; Sun, 19 Jun 2016 17:28:30 -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 s12sm34984980pfj.57.2016.06.19.17.28.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Jun 2016 17:28:29 -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 v2 15/24] fs: ocfs2: Use time64_t to represent orphan scan times Date: Sun, 19 Jun 2016 17:27:14 -0700 Message-Id: <1466382443-11063-16-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466382443-11063-1-git-send-email-deepa.kernel@gmail.com> References: <1466382443-11063-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 e607419..df76e60 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1946,7 +1946,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: @@ -2003,7 +2003,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");