From patchwork Mon Jan 22 02:04:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 10177203 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 088FD601D5 for ; Mon, 22 Jan 2018 02:06:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED2DE28399 for ; Mon, 22 Jan 2018 02:06:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2197283BF; Mon, 22 Jan 2018 02:06:22 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 9B96928399 for ; Mon, 22 Jan 2018 02:06:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751169AbeAVCFU (ORCPT ); Sun, 21 Jan 2018 21:05:20 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:38925 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751050AbeAVCFS (ORCPT ); Sun, 21 Jan 2018 21:05:18 -0500 Received: by mail-pf0-f195.google.com with SMTP id e11so5919658pff.6; Sun, 21 Jan 2018 18:05:17 -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=YCvousbKGN3cS+F1VHrAdUZCmQfPMyKP6AvbPHzvNjk=; b=o6MAcr6HXSZVr7oOiz6sKhrDxIfMgr3wzXEtGXNQN09LQIJi0HLXyDiafPIN3wVINg Yc9h6Z7saPlvf4MfzTYM2BPvtWTBde/RYsOs7HHLc23BOVeXIxHq0waKzwH8/65hGKf1 hiuDrs0Ulf9DkojVA1OLV53wsGVsunPRJqnIxySv/x6XwrHPfHUz7Q0Xz93peGlMRN86 McvDRbcg2IeycVDh+KXXD4vx6tcs+ju/NaSE6Fb9aY+WwQAtpUxUPAIOcACNuAudUJC0 s1gd5I6O5E6KvXinvFE1Py0cpVr86CKJ+q/e5U6zZal9K6sIXFkegJVFyjqRipmQoZmL UJow== 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=YCvousbKGN3cS+F1VHrAdUZCmQfPMyKP6AvbPHzvNjk=; b=ixL+drXdELLydg3TzGaudTlXp23DfEXFQMZHa1OtfzQJL2c3x+RSiNOzPDSIMMHQWM mS2nnEHJKclnfsT+eR9IKC7fm1XXwRlQlbSMBw0lQiW/N/au5gfXK6wjRtVW+2/ZVX65 uOYCZiMCmhy05KXMTzZhHxPAlcLFXpuhvvXLMU1iXwrQomMO8DqgIOwteeewy1LTOfPZ mhLbUfetCwo/w87/LFakvZp/FQ92XIHkJoBzUyEqK4vntsYSLnLbfINdpPuFDH04sbuc da3jMu+SOyUGScDin95+uTaYnUlYdcLXZiVVuY8MKN5GBQ+yzUo6Sc+bvYnjfrtceZYX GKSw== X-Gm-Message-State: AKwxytcMSqyonU8jW7PGQB1B0XiKzxfvrUcRUhUogCSqyECQ+AZpjtAm ErzNCq/oqLTbn3jhajDe8Hw= X-Google-Smtp-Source: AH8x225gAUfeBq2NjVqKUBAyQZZ1Q/FMntB0x7/hdGok4YgVpuy7xudPS0fWwXvk4nq+LQvgx7/CeA== X-Received: by 10.99.123.91 with SMTP id k27mr5844608pgn.179.1516586717521; Sun, 21 Jan 2018 18:05:17 -0800 (PST) Received: from deepa-ubuntu.lan (c-67-170-212-194.hsd1.ca.comcast.net. [67.170.212.194]) by smtp.gmail.com with ESMTPSA id y79sm27168472pfb.177.2018.01.21.18.05.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Jan 2018 18:05:16 -0800 (PST) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: [PATCH v6 1/4] vfs: Add file timestamp range support Date: Sun, 21 Jan 2018 18:04:23 -0800 Message-Id: <20180122020426.2988-2-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180122020426.2988-1-deepa.kernel@gmail.com> References: <20180122020426.2988-1-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 672538ca9831..9e0c97e54e46 100644 --- a/fs/super.c +++ b/fs/super.c @@ -244,6 +244,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 f9d01c0951a8..406f3de71c22 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1379,6 +1379,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 93d39499838e..76ed46db7a7f 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h @@ -36,6 +36,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)