From patchwork Wed Jun 20 15:01:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139355 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp895838lji; Wed, 20 Jun 2018 08:02:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLcoo/gLKTnxmmJ+eh5UwGEALXLdJ9v4DEG8WfHc3yEpzxJTd1rO+77PCeM65DwlMlTlpZR X-Received: by 2002:a63:41c1:: with SMTP id o184-v6mr19491512pga.323.1529506927011; Wed, 20 Jun 2018 08:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529506927; cv=none; d=google.com; s=arc-20160816; b=UPWaayvNIpFagPEOJCc2iN6OhJmRkJahNKo7JCvD+aPT3ovjSohLtHlRmGSPWAxPsl lRt9/ecACULHaMuWF+bujAPc/yFawKkt2uGyX/b2nxcpJsEwubH8uWNM4NA3aU0jdjYV aTQlnvv0N0O2enxbRHpG2k3Vr7SFH42WJjJimyK+pJMljCv6tfcCJ8mRdblgqjNugMNh 0hUejhWHsPEKQh3yYRRAdfBXtAJeCb2AfK91SsdfwvS0A44tZ3lWWre3TsAbWpy357Dw 7OZMXb7FBHGJv1QUdE5Xzpa7PVdJPNfPZMwhDXDwb49rKfCI1d3MPgDYWdsRdYm0r2eJ z63A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=7Nv8ovbtQBFn+sDSZCSR3S6ccKj6kytjokeed/mIpF0=; b=YQ+xi28Txm2qnUbBRp6OVLPQgeOK1HAa+EFa2JQ4G9Hn/eu6DqShRz8LEnIdc17OZu GPfWC6ve6wrrInJLJerV/67bL9iC+ECrE1XgbqNgfIGkd9uJfRVVvtrxC7JUzhRzae5i Sa4kcfiDLGejXmgRHu2sdX+9X8rrM+6JvUfOYiuAF5a3XBFwt8OMos/DTc56QYE3VJxj g9oyXmOpZb6ojXYriAKiHWn5aWJSPSwUin/H48JwN2UATlXpBG9LFPLVDvUtnt4H6F+q sYJ0vCtU1DrdrRopzSvT+0MCraKvWvV+7nrrAoLdCU33uZt4BiBuEpnzVun01Fz5k0Oj HBhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be3-v6si2532314plb.67.2018.06.20.08.02.06; Wed, 20 Jun 2018 08:02:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754011AbeFTPCC (ORCPT + 30 others); Wed, 20 Jun 2018 11:02:02 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:42101 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752856AbeFTPCB (ORCPT ); Wed, 20 Jun 2018 11:02:01 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MMrpj-1fYgcF1epj-008eEp; Wed, 20 Jun 2018 17:01:40 +0200 From: Arnd Bergmann To: Andrew Morton , Alexander Viro Cc: y2038@lists.linaro.org, Andi Kleen , Arnd Bergmann , "Darrick J. Wong" , Jeff Layton , Jan Kara , Brian Foster , Deepa Dinamani , Miklos Szeredi , Jens Axboe , Pavel Tatashin , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] vfs: replace current_kernel_time64 with ktime equivalent Date: Wed, 20 Jun 2018 17:01:24 +0200 Message-Id: <20180620150138.49380-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:O7197BHrK3NK8I93Hj/GJR5jEGKx4xM3JUenyXkcW+fqxnC0Uuw 6KHtZTE6SDXCmp7Qxq2k1MFDYERup10AXasOlXDYNzx4hxDPGZhohDMfartdp6bSAIk4Qbz AvxhylRK4jPVvxbq8VpE3v6u6s+2HoOg+oy0jUuuGWMFRFdVb0F9AYq2vjZai0eBY0UZkQz tMTVMjc1ctimZNkjIopKw== X-UI-Out-Filterresults: notjunk:1; V01:K0:eYkw8y4A97Y=:noi7bxlkPjvNpKmLJeehyH Vc/uwX87Nfgsqg8VB7v7gfgbizSi3l06mhE0bEQK7p31TGn64sALzSY7UqgLE7D29dMNgrL6x +DykBOhpsJyEt89ULo+pjJkPHvdT9Z+7Ab57odaXJ4Zh4hSBCCtDg5NvouiX+D793Qg0av+tu 7CWhlWlnVPjA6/cryV9oYgtOKhAOFpu2ZZ4oPu7cOxMJ5YzL3W29Mmow4LPCTAS8FpDEzPDrF fROmwUFk9WOIVAg73TYC7Nv7ssv77NjfVPBHRE1/PINl+jJg150v8eUtPKCUIwHNKTqpR0Gcv H0Sa/JTJQWcMknvm952hm48eKUUzzyhIiuBr1hfLpJFGBB74rcQj2cjzfFCxwPQXwqKVypZ2H LpDCxa2wJK/LiZfl1kaVi8gz5n9MYFH9+X3zRufNWJ6qFkCToz0sLtXaRkxlnupUY3grc56c7 lTFFjwLXKvGc/sd+CuVm1w4TZoi5Mpd3vpGjq16Blx1sBP3x2xqvnRXFsHDF1IMlLBolzuS23 GvAIh4b3Z7sZ8X1IXyEwhKhUsp1uYaM7ZhNHI6iAIi9Emg2MLLB9uYnLmGhFsRg/L994F4LLe Lc/wFyc/imZbAoYr9J9SxDnqctw+7zxxGrqsTI8/mQVj2DqzPPKWC9CfZBG8TcQPOFgJ1Plz1 jg19NrCgtKcG4RGS92AE59TToDPU2UE6laJse0n7UZAoqVJUevvXgVJRO71PQUkoVm6w= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org current_time is one of the few callers of current_kernel_time64(), which is a wrapper around ktime_get_coarse_real_ts64(). This calls the latter directly for consistency with the rest of the kernel that is moving to the ktime_get_ family of time accessors. An open questions is whether we may want to actually call the more accurate ktime_get_real_ts64() for file systems that save high-resolution timestamps in their on-disk format. This would add a small but measurable overhead to each update of the inode stamps but lead to inode timestamps to actually have a usable resolution better than one jiffy (1 to 10 milliseconds normally). I traced the original addition of the current_kernel_time() call to set the nanosecond fields back to linux-2.5.48, where Andi Kleen added a patch with subject "nanosecond stat timefields". This adds the original call to current_kernel_time and the truncation to the resolution of the file system, but makes no mention of the intended accuracy. At the time, we had a do_gettimeofday() interface that on some architectures could return a microsecond-resolution timestamp, but there was no interface for getting an accurate timestamp in nanosecond resolution, neither inside the kernel nor from user space. This makes me suspect that the use of coarse timestamps was never really a conscious decision but instead a result of whatever API was available 16 years ago. Signed-off-by: Arnd Bergmann --- fs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.9.0 diff --git a/fs/inode.c b/fs/inode.c index 2c300e981796..e27bd9334939 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -2133,7 +2133,9 @@ EXPORT_SYMBOL(timespec64_trunc); */ struct timespec64 current_time(struct inode *inode) { - struct timespec64 now = current_kernel_time64(); + struct timespec64 now; + + ktime_get_coarse_real_ts64(&now); if (unlikely(!inode->i_sb)) { WARN(1, "current_time() called with uninitialized super_block in the inode");