From patchwork Tue May 24 20:11:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102307 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp837462qge; Tue, 24 May 2016 13:13:46 -0700 (PDT) X-Received: by 10.98.23.140 with SMTP id 134mr64837pfx.122.1464120826445; Tue, 24 May 2016 13:13:46 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u28si925437pfa.234.2016.05.24.13.13.46; Tue, 24 May 2016 13:13:46 -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 S932983AbcEXUNf (ORCPT + 30 others); Tue, 24 May 2016 16:13:35 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:51039 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932629AbcEXUNc (ORCPT ); Tue, 24 May 2016 16:13:32 -0400 Received: from wuerfel.localnet ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0M1nxq-1bPag73zas-00tj7P; Tue, 24 May 2016 22:13:22 +0200 From: Arnd Bergmann To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Linux FS Devel , Deepa Dinamani , Thomas Gleixner , Al Viro Subject: [GIT PULL] y2038 changes for vfs Date: Tue, 24 May 2016 22:11:16 +0200 Message-ID: <5722005.e8ezZRvZ1E@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-22-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:xO4PdNHL6/GIEcDJM6hwOPxw1VJeyqIoiq1gOhi7JtHj7T/JjQm 7borMozKIfUhobTad2nvwGxLxKerKsull7rHyXhmJExRLsaDbyHWCESQK3S3us9BA32q7df C0px4ABhUXqg1j57zYcZ0hSXXHC76HMrOP9tepLT7w87EJ3r+IUoCrr+abaIrgGqIAxknbX Ilxnhkix0cZljsDltcDAw== X-UI-Out-Filterresults: notjunk:1; V01:K0:PpO3MVSO6M0=:0WExhkB5mNm4lPjDnUIrZm Qw/98L3zg22IXoxa5xQGP2hRd9zURczdTxn4Ea1+eGJW/VwYrw+Ky10GmRd8BJc57xCtOU10u oo/v2SdGf1LmqIcB4PILDQcolsuTfCnFZPm6co6Fefgl/sSIZVXrfuVRSOSJhwODb3XjZjMNS 5pgsVLuNBH6e7KmmJl28Zio2UMb4GoNXgeoDpH1/h3nvZH3gJ9bNrmuDv+ZxsPYhpZcYbIpvY sWcI/vPPx8poLpBZFoSfm8tFCsskPJxPiNaxuKr/uB9ImZJhBagteGJ4SjFApxMu2V10j9kpP lQp6dtGpClWYJpcWG9xcoV8SIRXBe/DjtVNpxOGJd9j3DOTrrQOj+gIDo6EAitkn6IbikPuGh 0EFRgdkPcC3CBGi4eOa/PLhwrTALcldLenV+TwCtlmDa9RTzzjcSk7VzjoJ5TyZLHCy6LxyiK jQ/W2AItcGWGjLtonVlbgkGLWZ1pYhbZzsyZ+IJASo/z4eKoWW25fxChL/FmakTUZpWFBmmdr XLgaImtSBlg9FXkTSsmwMon95Ctd5mrydQD65uOqD+YYhyCVrGrrZQrYAOxt5KYelLtvPv6ha NCEgDL5zS29ZIpJXwEf5h1oo7ca1mbZ7ktmOnucc3qTZBTMiDcVx14XfIaKZ/qJ61zjtsWmuH m3ndbQetVYOxalpy27qZM9D2BqafZGqOz+ZbUoP8esXujT4DK/vwfY2Zg/rfLBpyiolPhPCcw qDGv83Nkv4uyd06j Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following changes since commit bf16200689118d19de1b8d2a3c314fc21f5dc7bb: Linux 4.6-rc3 (2016-04-10 17:58:30 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git tags/y2038-4.7 for you to fetch changes up to 4b277763c5b3ce6d60168797e6f38260416d9b13: vfs: Add support to document max and min inode times (2016-04-26 18:12:30 +0200) ---------------------------------------------------------------- y2038 changes for vfs This is a preparation series for changing the VFS infrastructure to use time64_t in inode timestamps, introducing a couple of simple conversion helper functions that can be used to make the individual file systems independent of the type of inode->i_{a,c,m}time and iattr->ia_{a,c,m}time, following the plan described at http://kernelnewbies.org/y2038/vfs. The patches were done by Deepa Dinamani during her Outreachy internship along with the following set of more than 100 patches that depend on them but that can get merged through the individual file system maintainer trees. Thomas Gleixner reviewed the patches and the approach before, but after http://www.spinics.net/lists/y2038/msg01514.html, both he and Al Viro were busy in other areas of the kernel and neither of them picked them up. I'm sending the series for inclusion directly so we can make progress on the follow-up series and hopefully convert struct inode to timespec64 in 4.8 or 4.9. One small cleanup patch from Tina Ruchandani is included in the branch as well, this is also related to the y2038 effort and is the last one of a backlog of older patches that I picked up last year and otherwise got merged through maintainer trees. ---------------------------------------------------------------- Deepa Dinamani (3): fs: Add current_fs_time_sec() function vfs: Add vfs_time accessors vfs: Add support to document max and min inode times Tina Ruchandani (1): AFS: Correctly use 64-bit time for UUID fs/afs/main.c | 6 ++---- include/linux/fs.h | 29 ++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/fs/afs/main.c b/fs/afs/main.c index 35de0c04729f..129ff432391c 100644 --- a/fs/afs/main.c +++ b/fs/afs/main.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "internal.h" MODULE_DESCRIPTION("AFS Client File System"); @@ -37,7 +38,6 @@ struct workqueue_struct *afs_wq; */ static int __init afs_get_client_UUID(void) { - struct timespec ts; u64 uuidtime; u16 clockseq; int ret; @@ -48,9 +48,7 @@ static int __init afs_get_client_UUID(void) if (ret < 0) return ret; - getnstimeofday(&ts); - uuidtime = (u64) ts.tv_sec * 1000 * 1000 * 10; - uuidtime += ts.tv_nsec / 100; + uuidtime = ktime_divns(ktime_get_real(), 100); uuidtime += AFS_UUID_TO_UNIX_TIME; afs_uuid.time_low = uuidtime; afs_uuid.time_mid = uuidtime >> 32; diff --git a/include/linux/fs.h b/include/linux/fs.h index 70e61b58baaf..d9573060591e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1362,7 +1362,14 @@ struct super_block { /* Granularity of c/m/atime in ns. Cannot be worse than a second */ - u32 s_time_gran; + u32 s_time_gran; + + /* + * Max and min values for timestamps + * according to the range supported by filesystems. + */ + time64_t s_time_min; + time64_t s_time_max; /* * The next field is for VFS *only*. No filesystems have any business @@ -1423,6 +1430,26 @@ struct super_block { extern struct timespec current_fs_time(struct super_block *sb); +static inline struct timespec current_fs_time_sec(struct super_block *sb) +{ + return (struct timespec) { get_seconds(), 0 }; +} + +/* Place holder defines to ensure safe transition to timespec64 + * in the vfs layer. + * These can be deleted after all filesystems and vfs are switched + * over to using 64 bit time. + */ +static inline struct timespec vfs_time_to_timespec(struct timespec inode_ts) +{ + return inode_ts; +} + +static inline struct timespec timespec_to_vfs_time(struct timespec ts) +{ + return ts; +} + /* * Snapshotting support. */