From patchwork Sat Aug 13 22:48:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9278959 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 C943A60780 for ; Sun, 14 Aug 2016 11:10:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9DA1288C6 for ; Sun, 14 Aug 2016 11:10:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE41C28929; Sun, 14 Aug 2016 11:10:10 +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=ham 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 2C2CB288C6 for ; Sun, 14 Aug 2016 11:10:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932666AbcHNLJw (ORCPT ); Sun, 14 Aug 2016 07:09:52 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:34217 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753561AbcHNLJu (ORCPT ); Sun, 14 Aug 2016 07:09:50 -0400 Received: by mail-pa0-f65.google.com with SMTP id hh10so2064894pac.1; Sun, 14 Aug 2016 04:09:49 -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=yL0NJ7+OwY65ILoHVze0BULOCeKkJKuaSXPHZxkQBig=; b=VtOWXr6yONt1toj7o6X96XYQnJsMVuB+ej+2nYPtjoNsxhioDTF7O5IPsUqayVP2rm krKMSvSCQbIZplFQVwvuuaLHM6nc4kYrACazj2/DNWF4eWz7NG4gmlo1CWBKovSIUbIS HPqzsAL3PSqYYt3hI8Ait1xnZsLaeN13ByhHSu+1HLvAIoTIBpCMIZZTTHO/vDiKFlUB tXP3PFdbC/dw8LVyvWmN5yp1P4rHE3dpq7Cj1BQHvWGxslbJp8p3rbptDLysTaAR+W2l 1M0Q8B0bNI0iTbVViK9l0O+hkT7FlKzM901aPf6Z5JO2/Ht+fqbnqBucnIxqJkuG+kgA u+nw== 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=yL0NJ7+OwY65ILoHVze0BULOCeKkJKuaSXPHZxkQBig=; b=VCNQdaqs/HNN92wn9pS9UkEsbVVBvnI+jpDOLJPVyiCNkVCsz7d+8RyJ5NoSDCq0vT ILjwcCVT+ArW9y89zzEx9IpNcEp0wNE24VNn2+jPVPjaKBmteB0QWb4A6ldT38jGDEUJ u18uHe1o2HbUomwjyl7jgTcYqFfDbo97NcyZThOLJZGnMKfypgCTpU3crzmwO289Bjst vIcck9iEXKYVXN4cgxJ26wJ5vakCEWZcrdCh6FLRdnLks9jOrPGuEQNI3xNpqIuqPpW3 +QwyWYJL/4koFZ2Gkcxr7rz8C42MfWLY3bI7q3hsn7nbBGVY5/InyYK8iTg5LCsUxWTP yljA== X-Gm-Message-State: AEkoouuI3WfKe3rt/FfM9C11NlSKYN2F8Gx2fs8sJPXcsNUtTGlTtTk+IFihT81wEBeG6g== X-Received: by 10.66.49.137 with SMTP id u9mr40735876pan.72.1471128573434; Sat, 13 Aug 2016 15:49:33 -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.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Aug 2016 15:49:32 -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, Jaegeuk Kim , Changman Lee , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH v4 15/26] fs: f2fs: Use ktime_get_real_seconds for sit_info times Date: Sat, 13 Aug 2016 15:48:27 -0700 Message-Id: <1471128518-24075-16-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 CURRENT_TIME_SEC is not y2038 safe. Replace use of CURRENT_TIME_SEC with ktime_get_real_seconds in segment timestamps used by GC algorithm including the segment mtime timestamps. Signed-off-by: Deepa Dinamani Reviewed-by: Arnd Bergmann Cc: Jaegeuk Kim Cc: Changman Lee Cc: linux-f2fs-devel@lists.sourceforge.net --- fs/f2fs/segment.c | 2 +- fs/f2fs/segment.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index a46296f..34bb30e 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2168,7 +2168,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi) sit_i->dirty_sentries = 0; sit_i->sents_per_block = SIT_ENTRY_PER_BLOCK; sit_i->elapsed_time = le64_to_cpu(sbi->ckpt->elapsed_time); - sit_i->mounted_time = CURRENT_TIME_SEC.tv_sec; + sit_i->mounted_time = ktime_get_real_seconds(); mutex_init(&sit_i->sentry_lock); return 0; } diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index b33f73e..2423749 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -662,8 +662,9 @@ static inline void set_to_next_sit(struct sit_info *sit_i, unsigned int start) static inline unsigned long long get_mtime(struct f2fs_sb_info *sbi) { struct sit_info *sit_i = SIT_I(sbi); - return sit_i->elapsed_time + CURRENT_TIME_SEC.tv_sec - - sit_i->mounted_time; + time64_t now = ktime_get_real_seconds(); + + return sit_i->elapsed_time + now - sit_i->mounted_time; } static inline void set_summary(struct f2fs_summary *sum, nid_t nid,