From patchwork Thu Jun 9 05:04:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9166253 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 2EE7160467 for ; Thu, 9 Jun 2016 05:09:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20624200E7 for ; Thu, 9 Jun 2016 05:09:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1523F2040D; Thu, 9 Jun 2016 05:09:48 +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 97EF228319 for ; Thu, 9 Jun 2016 05:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946079AbcFIFHp (ORCPT ); Thu, 9 Jun 2016 01:07:45 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:35068 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754153AbcFIFFw (ORCPT ); Thu, 9 Jun 2016 01:05:52 -0400 Received: by mail-pa0-f67.google.com with SMTP id gp3so1909817pac.2; Wed, 08 Jun 2016 22:05:52 -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=4ClamWOwoqCLN512JIvzBReJ0j47HF7iDSjA3zl8Osw=; b=DPsWnV61ET2IqED+brFEazcmj7TCi4XKMYHCJbaz4fuX/nSBN5R17MH6s3w+fWjT5e 1CRH1t0WEB5VSRZYY0ZYNFpB/r3iLruSJdZ1eQj5+BzMWaGMoEV7+ca3P7XV9On8bSPS jAHEDKUI8UC4659s25GLW6lrztxj9Ejm5PhAwaUEAywM9LNUOYSHNR4PkpCSkPu/PDrJ FoPilfYXl82WH4DeioVo3q1ak3+rDcZmiJG9oN4iodIFsTKRzSZA6X0ABRCgELoximaX qyIuuPzSNZJIWW0J6K420TkRuyaE3XBt2BM6wAn3vAA/LhxPuOi4JBMQL4MVymSVsMRk Wesw== 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=4ClamWOwoqCLN512JIvzBReJ0j47HF7iDSjA3zl8Osw=; b=MH18BcdZaNkviVu5+5zEBVz8ms4QWXcLwniRop+BvUIhKQYoJmRRH1SKaMz3/YZZY9 IANfuXcHOBmH2tfnPz27CZvKlJ3j3VbZuJvXfhljfqUtJm2LWsCeVBcOVnZfciWMHZCX oR6u1GQ17y5JaSHIfWfgHlsOEqGFx62lbEfjXg1Ih6Ho/6KUOEkMh4SmewqyPFAmt+FQ EarCL4cxYs7V6YzuhQ1vaWFtJw6YLvW7HKW2pZ50X+SC7ygQB4MOyLJN6rUKMQEQwf7n nKuETaLLHuGIxqZYnMiRKPXkob+MR8f8BlTLGYChw+ic27S9IlArXSXTUis+DJqEBVFk DQ7A== X-Gm-Message-State: ALyK8tLaymANm2c3QksejIizt3egc1P31o4BFTLc13UWHz8mmvl/dg8htTg8vj/qmzD8Lg== X-Received: by 10.66.89.228 with SMTP id br4mr10138579pab.110.1465448751445; Wed, 08 Jun 2016 22:05:51 -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 129sm6220808pfe.3.2016.06.08.22.05.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 22:05:50 -0700 (PDT) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Gleixner , Al Viro , Linus Torvalds , y2038@lists.linaro.org, Jaegeuk Kim , Changman Lee , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH 10/21] fs: f2fs: Use ktime_get_real_seconds for sit_info times Date: Wed, 8 Jun 2016 22:04:54 -0700 Message-Id: <1465448705-25055-11-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465448705-25055-1-git-send-email-deepa.kernel@gmail.com> References: <1465448705-25055-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: Chao Yu 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 2e6f537..bde5dbd 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2123,7 +2123,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 7a756ff..da3e87f 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -652,8 +652,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,