From patchwork Sat Feb 25 01:40:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9591429 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 683AB60471 for ; Sat, 25 Feb 2017 01:42:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 584E128678 for ; Sat, 25 Feb 2017 01:42:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D5C6286AC; Sat, 25 Feb 2017 01:42:59 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 0AC7628678 for ; Sat, 25 Feb 2017 01:42:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751764AbdBYBmY (ORCPT ); Fri, 24 Feb 2017 20:42:24 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35733 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751582AbdBYBmA (ORCPT ); Fri, 24 Feb 2017 20:42:00 -0500 Received: by mail-pg0-f65.google.com with SMTP id 1so4988912pgz.2; Fri, 24 Feb 2017 17:41:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sjRj++dbsZ0WTEGR6i9Unc4CgCTRk8ByXnl45YMqpvQ=; b=ldxPTxp6meEZMq9CrDZp/CDYp4g0xuJ+bQFv0Z/Y/DBftlUifaQzdNfriunK1LKrh0 GeVOm9k5fGZMyDdXBVsOCR13CyO6wRR4iYixrcNP81HD281j1lAo/RnoVltLFKJBN4aE ThtYjahxDovTstijr7rA76JhT4WyRo6/zGCFyfe43s2BzvM9sobX6d0eC2kdYs8acRy+ kNdUTLM4YnEyMqR4jTOv01WN1k801oH+gGbty/ReutHS5Sjy0Y3CYDm3ColK7f0veIeP /rklcsy17O8HF2+4LScVoK8xsQKSysy+y8U1Xd7FDTyxQPXiN69UMznUozee3rm2N5wN ISWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sjRj++dbsZ0WTEGR6i9Unc4CgCTRk8ByXnl45YMqpvQ=; b=eIa1p6drhuZQdlvj7SwVvABN+ZlONixdB8E4hVETvgYm92pDiVdEJQsHibLv4dsap4 PxBxGbIQwp/Pyu/i9SkZhBp324OvsJOCiOWd3no0TTIbVdRg/Qp7ugjjoA/6YPUI2og+ KQJYcQeueP+1iBMnadV6IZuI403lMUd7tJfeog34Los2bR1AFKrqu9xzx063RgeP3vJm oBMezk3gg4UOaX5xuXueWVU/XQK1Ss/ZcovAvWQho9VWVBvDaKtu1GwCXfSVYgslDE0r fWzenU2jVLCRzRNJsBOM5Wl5p7biTyBLKJ0YesnkoarDwanplIvuLlZVq8R2vBFnm0e2 70lA== X-Gm-Message-State: AMke39nve4HwqMZdHjOJkVD5FkZSffYOA8D1RTofufFzwmKceMA+cuEsSiHLjP3XZASI9A== X-Received: by 10.84.214.9 with SMTP id h9mr7950737pli.65.1487986878744; Fri, 24 Feb 2017 17:41:18 -0800 (PST) Received: from deepa-ubuntu.hsd1.ca.comcast.net ([2601:647:5000:6620:d459:bd54:9ed4:a3f5]) by smtp.gmail.com with ESMTPSA id o24sm17175001pfj.78.2017.02.24.17.41.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Feb 2017 17:41:18 -0800 (PST) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: [PATCH v4 1/5] vfs: Add file timestamp range support Date: Fri, 24 Feb 2017 17:40:59 -0800 Message-Id: <1487986863-6005-2-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487986863-6005-1-git-send-email-deepa.kernel@gmail.com> References: <1487986863-6005-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 Add fields to the superblock to track the min and max timestamps supported by filesystems. Initially, when a superblock is allocated, initialize it to the max and min values the fields can hold. Individual filesystems override these to match their actual limits. Pseudo filesystems are assumed to always support the min and max allowable values for the fields. Note that the time ranges are saved in type time64_t rather than time_t. This is required because if we save ranges in time_t then we would not be able to save timestamp ranges for files that support timestamps beyond y2038. Signed-off-by: Deepa Dinamani --- fs/super.c | 2 ++ include/linux/fs.h | 3 +++ include/linux/time64.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/fs/super.c b/fs/super.c index b8b6a08..f9c2241 100644 --- a/fs/super.c +++ b/fs/super.c @@ -247,6 +247,8 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, s->s_maxbytes = MAX_NON_LFS; s->s_op = &default_op; s->s_time_gran = 1000000000; + s->s_time_min = TIME64_MIN; + s->s_time_max = TIME64_MAX; s->cleancache_poolid = CLEANCACHE_NO_POOL; s->s_shrink.seeks = DEFAULT_SEEKS; diff --git a/include/linux/fs.h b/include/linux/fs.h index de8ed0b..ef55dfb 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1337,6 +1337,9 @@ struct super_block { /* Granularity of c/m/atime in ns. Cannot be worse than a second */ u32 s_time_gran; + /* Time limits for c/m/atime in seconds. */ + time64_t s_time_min; + time64_t s_time_max; /* * The next field is for VFS *only*. No filesystems have any business diff --git a/include/linux/time64.h b/include/linux/time64.h index 980c71b..25433b18 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h @@ -38,6 +38,8 @@ struct itimerspec64 { /* Located here for timespec[64]_valid_strict */ #define TIME64_MAX ((s64)~((u64)1 << 63)) +#define TIME64_MIN (-TIME64_MAX - 1) + #define KTIME_MAX ((s64)~((u64)1 << 63)) #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)