From patchwork Mon Jun 20 00:27:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9186393 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 2618460871 for ; Mon, 20 Jun 2016 01:20:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13DFE20265 for ; Mon, 20 Jun 2016 01:20:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 083B3205AB; Mon, 20 Jun 2016 01:20:32 +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 43AAD20265 for ; Mon, 20 Jun 2016 01:20:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751846AbcFTBU2 (ORCPT ); Sun, 19 Jun 2016 21:20:28 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34505 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751705AbcFTBU1 (ORCPT ); Sun, 19 Jun 2016 21:20:27 -0400 Received: by mail-pf0-f194.google.com with SMTP id 66so10337974pfy.1; Sun, 19 Jun 2016 18:19:57 -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=2MpCjpkPgfnl9/4j6s0zeZily/7lb58B8tYbCG90Ag0=; b=pZ3bb/2RCc0CHlALSQIF5QMVh2fMnU6qDkU3nJNGTxmq8YBoYTWkDTfAe7lzJwmQvS aB4DFtOB730JSoJbRuI2MZPIQjLmbAy/rSdkIEZ5fGwVvANHHb62i2gDCAlYD9/Vtcf9 nPK5T4jVpPCyggKUXWYRt3eYBCHBtc/KKj6WJpSRIZQkJGyqPb90ymjfv1RKcyXIh3xl e0QZ6dMUFK3teeRrKPBcEyaRQZhsDGWJVWTW+JzEuhhOsfPklGUJ230RqKE914g1TZNJ 1JK5W3NpB7y9SIg1uWMxM0NsnyhqV4HDsQbW5O9feMifRmYXnHAExLpZr1YP+dBxsAIX VhZQ== 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=2MpCjpkPgfnl9/4j6s0zeZily/7lb58B8tYbCG90Ag0=; b=VjMyZjmyNxYGHPC3eIKqDrbN25oiEcBkefc9hJmmvYpJK7bMd1as2fgM3JZpEsFkew zVlEed4hD1eYgxaxN72GA752XUH9KKZDh5unDXPyrfjPWzMDZe6CN4ILQuKXc+N/MWAg n5rf6wDfV7AO09UybdYN2QvIgdAF3QkPXIvPVLE+JXuMXBm0ETv9pP0mRJUXKpt6eshK L+bvOB6ED5exK79vJqr5cJE70sDjfXiB1eneIRLg9loDF9wfJicujFC2cK+ENk/59hcR SzKQICkIi32KUKLHkD8AoaUUXCbD5bVLxPqrDuKYinuQv4kAgBceabf3Jbv6AZ2xhkxK zm2w== X-Gm-Message-State: ALyK8tIZ62Y2ZHKs2QRxOiEM5Szu7zdoxKqZSWjtTUrCCefd12J8uyEhRp00RU8mzX+iuw== X-Received: by 10.98.34.153 with SMTP id p25mr18256082pfj.116.1466382506593; Sun, 19 Jun 2016 17:28:26 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Jun 2016 17:28:26 -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 v2 13/24] fs: f2fs: Use ktime_get_real_seconds for sit_info times Date: Sun, 19 Jun 2016 17:27:12 -0700 Message-Id: <1466382443-11063-14-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 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 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 25b1c47..9c35a21 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2156,7 +2156,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 d74cc33..78bb034 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -661,8 +661,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,