From patchwork Fri Feb 12 09:45:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 8289751 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 93CC09F3CD for ; Fri, 12 Feb 2016 09:49:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E9C8203AC for ; Fri, 12 Feb 2016 09:49:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC78420380 for ; Fri, 12 Feb 2016 09:49:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751890AbcBLJtK (ORCPT ); Fri, 12 Feb 2016 04:49:10 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:34338 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751220AbcBLJtI (ORCPT ); Fri, 12 Feb 2016 04:49:08 -0500 Received: by mail-pf0-f180.google.com with SMTP id x65so45176592pfb.1; Fri, 12 Feb 2016 01:49:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=a6sIRvf9aAx5dg+wn77Jlhba8vN4ExSvRCv+oOccFrI=; b=fZhdKPNIiRQxMYKglHyZbFErm8mKMK7Xpr2AJeXG7m8mOSQ7Pwaeone82laOgyezAJ fSPy1eSrlQPOBRxam8rcFcvfeLoRGtkc5TZ4XngeCrCFEkG2Wk3DDQnJ01IDZ57ly9Hl B50skOSfKUOzoyZv5Dh3LXUXoubl5VG8vFrb0uTOEuzdLRn89IKV+4HWRq5mVmckpxqv jHrRbPs+egyv8g6BYRjpNyWj5brCWfDequrae+Ue75IsPDoXaoVec11h3L1cUtaVPydI /aU5lfQLNqsZYUbywNmYgmiSxazuSw48+w54KrVscR+koZaZipofuSvwIwcYySW6gmbV fmFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=a6sIRvf9aAx5dg+wn77Jlhba8vN4ExSvRCv+oOccFrI=; b=C1VtLNH8ywHgyRI5a6KTvnnUKdvQH/m+Hq7FLKduy8KH/53VzI6tjLixmaYE4GMUrH fdvFuVCg+TdrAWKei+VdkTQazRUEFKFg5G9adDiBaz3+THeB+AK8Y+pgbCssDOfZeKKa 37i+unTm7utxbvFIJGlaziGKKqFbaZ0Gc/fosN/swPZjc52oyKD0ji9qaBaV62s7R8K0 mn6hyKAJrT48AnO6zpyzK00pqZDJMoFwLK7yo4rxIU4QX56SgksBgWt7hg6cof9zhu7L kZ+UkzgZTxOjo2o8HMsi7pn46d1GObq0T98oUrcIYUaa95Y2He421jgjP1b3U98TY5x7 tSWA== X-Gm-Message-State: AG10YOTfJMuL7dIhTSpF+mjXnac3Ug+F1XbnY8G/uPawGv5FPzX3o+rSvYLSGnXUCglpTQ== X-Received: by 10.98.70.211 with SMTP id o80mr783545pfi.124.1455270548417; Fri, 12 Feb 2016 01:49:08 -0800 (PST) Received: from localhost.localdomain ([106.51.31.162]) by smtp.gmail.com with ESMTPSA id ah10sm18066745pad.23.2016.02.12.01.48.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 01:49:08 -0800 (PST) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org Cc: Arnd Bergmann , Dave Chinner , "Theodore Ts'o" , linux-kernel@vger.kernel.org Subject: [RFC v2b 3/5] fs: btrfs: Use vfs_time accessors Date: Fri, 12 Feb 2016 01:45:47 -0800 Message-Id: <1455270349-3187-4-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455270349-3187-1-git-send-email-deepa.kernel@gmail.com> References: <20160212092153.GA2368@deepa-ubuntu> <1455270349-3187-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-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is in preparation for changing VFS inode timestamps to use 64 bit time. The VFS inode timestamps are not y2038 safe as they use struct timespec. These will be changed to use struct timespec64 instead and that is y2038 safe. But, since the above data type conversion will break the end file systems, use vfs_time functions to access inode times. Note that the btrfs_update_time() has not been changed in this patch. This will need to be updated along with vfs time data type changes. This is because the function signature is decided by the VFS layer since it is a VFS inode operations callback. Signed-off-by: Deepa Dinamani --- fs/btrfs/file.c | 14 +++++++++----- fs/btrfs/inode.c | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 610f569..3bccb97 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1733,16 +1733,20 @@ out: static void update_time_for_write(struct inode *inode) { struct timespec now; + struct timespec ts; if (IS_NOCMTIME(inode)) return; - now = current_fs_time(inode->i_sb); - if (!timespec_equal(&inode->i_mtime, &now)) - inode->i_mtime = now; + now = vfs_time_to_timespec(current_fs_time(inode->i_sb)); - if (!timespec_equal(&inode->i_ctime, &now)) - inode->i_ctime = now; + ts = vfs_time_to_timespec(inode->i_mtime); + if (!timespec_equal(&ts, &now)) + inode->i_mtime = timespec_to_vfs_time(now); + + ts = vfs_time_to_timespec(inode->i_mtime); + if (!timespec_equal(&ts, &now)) + inode->i_ctime = timespec_to_vfs_time(now); if (IS_I_VERSION(inode)) inode_inc_iversion(inode); diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 59c0e22..5b93cf8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -5592,7 +5592,7 @@ static struct inode *new_simple_dir(struct super_block *s, inode->i_mtime = current_fs_time(inode->i_sb); inode->i_atime = inode->i_mtime; inode->i_ctime = inode->i_mtime; - BTRFS_I(inode)->i_otime = inode->i_mtime; + BTRFS_I(inode)->i_otime = vfs_time_to_timespec(inode->i_mtime); return inode; } @@ -6164,7 +6164,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, inode->i_mtime = current_fs_time(inode->i_sb); inode->i_atime = inode->i_mtime; inode->i_ctime = inode->i_mtime; - BTRFS_I(inode)->i_otime = inode->i_mtime; + BTRFS_I(inode)->i_otime = vfs_time_to_timespec(inode->i_mtime); inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0], struct btrfs_inode_item);