From patchwork Sat Feb 18 23:30:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9581403 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 7F6C46049F for ; Sat, 18 Feb 2017 23:32:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76561287BB for ; Sat, 18 Feb 2017 23:32:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B35E287BE; Sat, 18 Feb 2017 23:32:52 +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 1CE46287BB for ; Sat, 18 Feb 2017 23:32:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751542AbdBRXca (ORCPT ); Sat, 18 Feb 2017 18:32:30 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35896 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812AbdBRXbJ (ORCPT ); Sat, 18 Feb 2017 18:31:09 -0500 Received: by mail-pg0-f65.google.com with SMTP id a123so5406677pgc.3; Sat, 18 Feb 2017 15:30:43 -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=Uadb4ae023RDnlq4QIHyo5C00oGTfUwX1/sG+Fjxbug=; b=RsL53MORr7E83U5whLBdrK3ZXwhMepQS4hKc7pCRqzmxQkPvMb+YOG+T3Gko2Qbezs LpX/lCMPM6jWKKRkCGNZ5s+sUsaXkT8uTzVlVoqHz9IVjAkLX4ntii3LqmUdUupL7PBl ZwTLHbNiwBi3/nJlqm90rBzjM5GUZv6ii/6yECJFm50dm4qCIcucgagVQv4e0G/qIW6r 54eQcmiYa3z7oegVlzf46PLf0QYGsarDotvfIjQ61irpFqrq/V02CsC/Nf3/2tI42ppi eywV2ujeu65ERC0Wc7a7tOZ3HIRkDMK/EhqVnO3LSMSVXV7vYPytr9WA9O8GnCBGkVgr 0bDw== 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=Uadb4ae023RDnlq4QIHyo5C00oGTfUwX1/sG+Fjxbug=; b=JF1DX20BfsSSaiuklvzNfW3m7Aj696npD4f0BrPeAbhjyWFnBh89gMR/r9lluOOsEg LjpZekFaOU8NAJfMbRxz4lcKDlkEHgNGUPywW301NHHSmjU8SB9+ip9C8PcQld+IJP5+ x5XFbyLn9TqFKP1zDztEsnipBLtHmtURStRypepLw26R+3DKNuoJLenBPNYiy9GT/94z 6E65w/rzMTZsXTZI8cyiEPOSjcOLFrifm1VPukjDs+VzvCS3iTe/MXzSEaVr9FrM0Udx kXRYbPIZIoo4kzXg2cfme2uNRbwBj6lU/O4Z1EXlH5vb467ioLG41rlp4nmyA8u3Truf GlyA== X-Gm-Message-State: AMke39kKouqInGEbLR15FToec6Xa7Kivkktwf8LlfDLIhQAQhzVaLJv0//t+tg5ihpPnLg== X-Received: by 10.84.224.11 with SMTP id r11mr21494121plj.130.1487460642437; Sat, 18 Feb 2017 15:30:42 -0800 (PST) Received: from deepa-ubuntu.hsd1.ca.comcast.net ([2601:647:5000:6620:e8a1:d9de:f814:c176]) by smtp.gmail.com with ESMTPSA id s24sm27278030pgo.25.2017.02.18.15.30.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Feb 2017 15:30:41 -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 v3 1/5] vfs: Add file timestamp range support Date: Sat, 18 Feb 2017 15:30:04 -0800 Message-Id: <1487460608-15697-2-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487460608-15697-1-git-send-email-deepa.kernel@gmail.com> References: <1487460608-15697-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/libfs.c | 4 ++++ fs/super.c | 2 ++ include/linux/fs.h | 3 +++ include/linux/time64.h | 2 ++ 4 files changed, 11 insertions(+) diff --git a/fs/libfs.c b/fs/libfs.c index 28d6f35..90ee803 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -257,6 +257,8 @@ struct dentry *mount_pseudo_xattr(struct file_system_type *fs_type, char *name, s->s_op = ops ? ops : &simple_super_operations; s->s_xattr = xattr; s->s_time_gran = 1; + s->s_time_min = TIME64_MIN; + s->s_time_max = TIME64_MAX; root = new_inode(s); if (!root) goto Enomem; @@ -518,6 +520,8 @@ int simple_fill_super(struct super_block *s, unsigned long magic, s->s_magic = magic; s->s_op = &simple_super_operations; s->s_time_gran = 1; + s->s_time_min = TIME64_MIN; + s->s_time_max = TIME64_MAX; inode = new_inode(s); if (!inode) 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)