From patchwork Fri Feb 12 09:52:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 8289921 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A2670BEEE5 for ; Fri, 12 Feb 2016 09:56:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92E6E203AC for ; Fri, 12 Feb 2016 09:56:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88F5C201F2 for ; Fri, 12 Feb 2016 09:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752199AbcBLJ4d (ORCPT ); Fri, 12 Feb 2016 04:56:33 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:36588 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752143AbcBLJz0 (ORCPT ); Fri, 12 Feb 2016 04:55:26 -0500 Received: by mail-pa0-f45.google.com with SMTP id yy13so44391347pab.3; Fri, 12 Feb 2016 01:55:26 -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=Ccw9kuZ2Nh3Pt9QimY/rxY+F3iKrVQWdqP10bHTbl4s=; b=F2qCZnVIC8jnT/91MatIUanNeo9qgPsz0Wa9ZsZFFQh/9XGaBiJlRZVlacca0eQ6hu qiGrOeKvNHAHSmo127pMull0snAzGuZw4xXpc3CHvQwlVuBgEOVgF3XlL1L4mPkC8mZN efRx+NjFn5PcaXnnFdg+TgTY+lXWstjWZx98fSkulHYLjburNJtKaBwHNyKQSrdlGvFG GuR/GR3ZnktGRmF3WhxCuiIRnGfP/0Lb0y09ERwfL6MN+u74PgwJ7V50X4DpyJiGjLfM oZ7vtU3bQFf1pVjwryz6zR7AyPgLhIY3jxNbwEJqhJKBilLyLWqfvNAV3vGvr04D1BJl xmRQ== 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=Ccw9kuZ2Nh3Pt9QimY/rxY+F3iKrVQWdqP10bHTbl4s=; b=OhEJ/hpgFtGhwIyRt9RYpunQuCw0WIdOrHvHPnBlOAUZq2v9XxO221Er44o4nydZxU Dye24KWQWD5wPVwZMtzPKxkxkiCE2O1/3Sw3G7o1nzGRttoi4ujuy4rsGuY8L2QU81NT nLpi6EvXBXqCcvuFnq5ZaTcUmCXcv46dvYrnIyxxciaq/3RfBsdMuxC/oCafMVTY5auB srarz7Ms+wx4pSHOJgV2VAxmk3jqPA//RLkzO6eAGluI9VSk4dDx8MbTydj/lyy1HL// 2c+Bm2dPtDwwaIBn3ihvv6A11H6pvuGFQkASq0V0p5VS5+ODCz3UxsDuhm+dOWjU2J5K Dp6A== X-Gm-Message-State: AG10YOQ4Ypax1gfu3zdoDX3MlAJchUshcEMjEUbbNEUPzm1oz19W4KGtYHS4VRlvbc5bXw== X-Received: by 10.67.7.42 with SMTP id cz10mr768956pad.158.1455270926435; Fri, 12 Feb 2016 01:55:26 -0800 (PST) Received: from localhost.localdomain ([106.51.31.162]) by smtp.gmail.com with ESMTPSA id xz6sm18090024pab.42.2016.02.12.01.55.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 01:55:25 -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 v2c 6/8] fs: btrfs: Use vfs timestamp abstraction helper Date: Fri, 12 Feb 2016 01:52:51 -0800 Message-Id: <1455270773-3249-7-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455270773-3249-1-git-send-email-deepa.kernel@gmail.com> References: <20160212092153.GA2368@deepa-ubuntu> <1455270773-3249-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 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 timespec64 and conversion functions here to access inode times. The following needs to switch along with vfs time representation. 1. inode times set/get. 2. For inode times comparison. 3. getting times from current_fs_time(). 4. btrfs_timespec already uses 64 bits to represent seconds in timestamps as 64 bits in btrfs_timespec. 5. btrfs_update_time() is a inode_ops callback. Signed-off-by: Deepa Dinamani --- fs/btrfs/file.c | 7 ++++--- fs/btrfs/inode.c | 2 +- fs/btrfs/ioctl.c | 4 ++-- fs/btrfs/root-tree.c | 2 +- fs/btrfs/transaction.c | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 610f569..a5fb13c 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1732,16 +1732,17 @@ out: static void update_time_for_write(struct inode *inode) { - struct timespec now; + struct vfs_time now; if (IS_NOCMTIME(inode)) return; now = current_fs_time(inode->i_sb); - if (!timespec_equal(&inode->i_mtime, &now)) + + if (!vfs_time_equal(&inode->i_mtime, &now)) inode->i_mtime = now; - if (!timespec_equal(&inode->i_ctime, &now)) + if (!vfs_time_equal(&inode->i_ctime, &now)) inode->i_ctime = now; if (IS_I_VERSION(inode)) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index bcd223c..860e5e6 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -5942,7 +5942,7 @@ static int btrfs_dirty_inode(struct inode *inode) * This is a copy of file_update_time. We need this so we can return error on * ENOSPC for updating the inode in the case of file write and mmap writes. */ -static int btrfs_update_time(struct inode *inode, struct timespec *now, +static int btrfs_update_time(struct inode *inode, struct vfs_time *now, int flags) { struct btrfs_root *root = BTRFS_I(inode)->root; diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 6f35d9c..471037f 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -443,7 +443,7 @@ static noinline int create_subvol(struct inode *dir, struct btrfs_root *root = BTRFS_I(dir)->root; struct btrfs_root *new_root; struct btrfs_block_rsv block_rsv; - struct timespec cur_time = current_fs_time(dir->i_sb); + struct vfs_time cur_time = current_fs_time(dir->i_sb); struct inode *inode; int ret; int err; @@ -4956,7 +4956,7 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file, struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root_item *root_item = &root->root_item; struct btrfs_trans_handle *trans; - struct timespec ct = current_fs_time(inode->i_sb); + struct vfs_time ct = current_fs_time(inode->i_sb); int ret = 0; int received_uuid_changed; diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index a25f3b2..0a309f6b 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c @@ -488,7 +488,7 @@ void btrfs_update_root_times(struct btrfs_trans_handle *trans, struct btrfs_root *root) { struct btrfs_root_item *item = &root->root_item; - struct timespec ct = current_fs_time(root->fs_info->sb); + struct vfs_time ct = current_fs_time(root->fs_info->sb); spin_lock(&root->root_item_lock); btrfs_set_root_ctransid(item, trans->transid); diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 37562d6..5481ee0 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1333,7 +1333,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, struct dentry *dentry; struct extent_buffer *tmp; struct extent_buffer *old; - struct timespec cur_time; + struct vfs_time cur_time; int ret = 0; u64 to_reserve = 0; u64 index = 0;