From patchwork Sat Oct 1 23:38:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9359489 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 0C21F6075E for ; Sat, 1 Oct 2016 23:40:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB69E28C21 for ; Sat, 1 Oct 2016 23:40:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEACA28D19; Sat, 1 Oct 2016 23:40:18 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5452128C21 for ; Sat, 1 Oct 2016 23:40:17 +0000 (UTC) Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u91Ndvo3011952 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 1 Oct 2016 23:39:57 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u91NdpCs008063 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 1 Oct 2016 23:39:52 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1bqTsl-0003qi-Rg; Sat, 01 Oct 2016 16:39:51 -0700 Received: from userv0022.oracle.com ([156.151.31.74]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1bqTs3-0003ph-Ai for ocfs2-devel@oss.oracle.com; Sat, 01 Oct 2016 16:39:07 -0700 Received: from userp1030.oracle.com (userp1030.oracle.com [156.151.31.80]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u91Nd5tA008280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 1 Oct 2016 23:39:05 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by userp1030.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u91Nd4X7017551 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sat, 1 Oct 2016 23:39:05 GMT Authentication-Results: userp1030.oracle.com; dkim=pass reason="2048-bit key" header.d=gmail.com header.i=@gmail.com header.b=KFNs+03E Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.17/8.16.0.17) with SMTP id u91NbCVq016998 for ; Sat, 1 Oct 2016 23:39:04 GMT Authentication-Results: oracle.com; spf=pass smtp.mailfrom=deepa.kernel@gmail.com Received: from mail-pa0-f67.google.com (mail-pa0-f67.google.com [209.85.220.67]) by userp2040.oracle.com with ESMTP id 25t3s5wckv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 01 Oct 2016 23:39:04 +0000 Received: by mail-pa0-f67.google.com with SMTP id r9so5802742paz.1 for ; Sat, 01 Oct 2016 16:39:04 -0700 (PDT) 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; bh=O4iFEdE5/eoeNNBkyBMDhIAVgxyeBj+BZ6RSJ8PREao=; b=DW+tHiSAMkNIDdTFzUVcu0IZQj7mtIBrWo+Y2SqaF8TYaP3Wf0qwuEhPDfNIFTE4PX ZM+e0GGPRLKoOj2XMtVdRnUwo+WVEi+Df2Ykp8sSyYj4JCxvaLjHi7s94nsPbEJjEkRW TcEe1M0WOw/WbXWA5SPRlLiwFhUK01v6X0uj5ooifxNDUtJJNv/lfDslSlmKIx664C0A kBHU1ISr3yk/OlbCEo1KHK4RjrFjlalCNt5TRtjN35Wyfzy38oaOQy+YmNp5y4dtVMhb Ggc86TIAU4VydqD9lChIqaj3C9BADWMW86Lz4bW5o/gc+zQYb6U1yTJObad9Dyfi7wuD G9Rg== X-Gm-Message-State: AA6/9Rmb11Fq+oEEjaexo1qWxdk+YDon9nJW2lXIeBXYtsMen/rxYV0Bnug0LPmpNH7N/A== X-Received: by 10.66.119.136 with SMTP id ku8mr24309287pab.6.1475365143081; Sat, 01 Oct 2016 16:39:03 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net ([2601:647:5000:6620:35af:2ada:b4f5:75ba]) by smtp.gmail.com with ESMTPSA id s82sm37146728pfg.42.2016.10.01.16.39.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 01 Oct 2016 16:39:02 -0700 (PDT) From: Deepa Dinamani To: linux-kernel@vger.kernel.org Date: Sat, 1 Oct 2016 16:38:58 -0700 Message-Id: <1475365138-20567-1-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.7.4 X-ServerName: mail-pa0-f67.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=5800 definitions=8305 signatures=670721 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609280000 definitions=main-1610010437 Cc: y2038@lists.linaro.org, Mark Fasheh , ocfs2-devel@oss.oracle.com, arnd@arndb.de Subject: [Ocfs2-devel] [PATCH] fs: ocfs2: Use time64_t to represent orphan scan times X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: aserv0021.oracle.com [141.146.126.233] 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");