From patchwork Fri Feb 12 09:45:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 8289791 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 064C5BEEE5 for ; Fri, 12 Feb 2016 09:50:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24252203AC for ; Fri, 12 Feb 2016 09:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E05720380 for ; Fri, 12 Feb 2016 09:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752079AbcBLJt6 (ORCPT ); Fri, 12 Feb 2016 04:49:58 -0500 Received: from mail-pf0-f170.google.com ([209.85.192.170]:34728 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751952AbcBLJt4 (ORCPT ); Fri, 12 Feb 2016 04:49:56 -0500 Received: by mail-pf0-f170.google.com with SMTP id x65so45186617pfb.1; Fri, 12 Feb 2016 01:49:56 -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=wKFj8LLHHwb9OQo87XpR1yP9hCd2dMYXQTWbi1mbcJM=; b=oP2tmO4jEJIQkfq6BIlrz9eMZHrCCdkUI20bgpHpf2vvcU9qeLg7qYmXm3JuvL5qL6 EAXxUUCRgHWuPTYb5sheiry2Ffgtpa0u/rD5jFc1aN3zAsiUumdP2hVYVtPhRzrjVSgB smzNfZhGGl3sSOS3KGCZ8wLkDrH1GLNRpwJcEUh60oJt3QdqtuVkpUtYZfDb0rLWdHa7 sZqhwqQfa/PKN041JuOfaiIT5rvtwC3WvQUmfqDleL2ACqPbmnw7asmIOi+n2IMe86FT 5toc7RXkyWJiqP+7I+EZkvjqAGNWsEfbqyUnp4p7t0CwYWsTaYSgezLn5pg+cWSZDDdw mNEg== 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=wKFj8LLHHwb9OQo87XpR1yP9hCd2dMYXQTWbi1mbcJM=; b=Ajqr6NbBUAUhIg50wc2UF4fS3AGbRvhra3Pc357quFqTJlMfK0QhfOojxt1ezBaHrF yBnuzYXnH6S0ePUtp2vkgLOC+pSLeqrQkRiaRczB4Xc7bRsdPCn4ZKoGnWdYrUBLEv/J w0RGt3/6SMLKDKbTdRMd/uwXAPNS12jlggb8XCZeJr25aDjRYLkVCzWiN+uFItoOcuHF 9/lPxiT0rViB9CVgms9XBVBwo/L6Pgr7gY3PAhP+YYR093qvJk/B+Rqpw27C6gXMdqBd UAp0hPnCxmYTmFWhMyZUgbZYeKfMzUqsg4Nwq7AmTMSyzgY0othx2tmkbRk2jyJclZOp xboQ== X-Gm-Message-State: AG10YOT4CNVmwxJ1nYMq88bwmcBS0+MVSOcI7tq65xnk97GL6v8Hh2ifIPkOV/mo9LSXJg== X-Received: by 10.98.64.83 with SMTP id n80mr733112pfa.149.1455270595809; Fri, 12 Feb 2016 01:49:55 -0800 (PST) Received: from localhost.localdomain ([106.51.31.162]) by smtp.gmail.com with ESMTPSA id ah10sm18066745pad.23.2016.02.12.01.49.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 01:49:55 -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 5/5] fs: xfs: change inode times to use vfs_time data type Date: Fri, 12 Feb 2016 01:45:49 -0800 Message-Id: <1455270349-3187-6-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. current_fs_time() will change along with vfs timestamp data type changes. xfs_vn_update_time() is a .update callback for inode operations and this needs to change along with vfs inode times. Signed-off-by: Deepa Dinamani --- fs/xfs/xfs_inode.c | 2 +- fs/xfs/xfs_trans_inode.c | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index ceba1a8..fc20e65 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -831,7 +831,7 @@ xfs_ialloc( ip->i_d.di_nextents = 0; ASSERT(ip->i_d.di_nblocks == 0); - tv = current_fs_time(mp->m_super); + tv = vfs_time_to_timespec(current_fs_time(mp->m_super)); ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec; ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec; ip->i_d.di_atime = ip->i_d.di_mtime; diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c index b97f1df..e469e6a 100644 --- a/fs/xfs/xfs_trans_inode.c +++ b/fs/xfs/xfs_trans_inode.c @@ -68,24 +68,28 @@ xfs_trans_ichgtime( int flags) { struct inode *inode = VFS_I(ip); - struct timespec tv; + struct timespec now; + struct timespec ts; ASSERT(tp); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); - tv = current_fs_time(inode->i_sb); + now = vfs_time_to_timespec(current_fs_time(inode->i_sb)); + ts = vfs_time_to_timespec(inode->i_mtime); if ((flags & XFS_ICHGTIME_MOD) && - !timespec_equal(&inode->i_mtime, &tv)) { - inode->i_mtime = tv; - ip->i_d.di_mtime.t_sec = tv.tv_sec; - ip->i_d.di_mtime.t_nsec = tv.tv_nsec; + !timespec_equal(&ts, &now)) { + inode->i_mtime = timespec_to_vfs_time(now); + ip->i_d.di_mtime.t_sec = now.tv_sec; + ip->i_d.di_mtime.t_nsec = now.tv_nsec; } + + ts = vfs_time_to_timespec(inode->i_ctime); if ((flags & XFS_ICHGTIME_CHG) && - !timespec_equal(&inode->i_ctime, &tv)) { - inode->i_ctime = tv; - ip->i_d.di_ctime.t_sec = tv.tv_sec; - ip->i_d.di_ctime.t_nsec = tv.tv_nsec; + !timespec_equal(&ts, &now)) { + inode->i_ctime = timespec_to_vfs_time(now); + ip->i_d.di_ctime.t_sec = now.tv_sec; + ip->i_d.di_ctime.t_nsec = now.tv_nsec; } }