From patchwork Mon Jun 20 00:27:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9186319 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 6F6EC60871 for ; Mon, 20 Jun 2016 00:30:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A1682236A for ; Mon, 20 Jun 2016 00:30:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D75D2237D; Mon, 20 Jun 2016 00:30:24 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham 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 DD7A42236A for ; Mon, 20 Jun 2016 00:30:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752016AbcFTA2o (ORCPT ); Sun, 19 Jun 2016 20:28:44 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33650 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbcFTA2U (ORCPT ); Sun, 19 Jun 2016 20:28:20 -0400 Received: by mail-pf0-f194.google.com with SMTP id c74so10291643pfb.0; Sun, 19 Jun 2016 17:28:20 -0700 (PDT) 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=sBib7CZMg95qeww+RHH4JyfgC4bfhTsTe+NG8hxtfyg=; b=x0I+R9LXD6Z/jAndfnbJiTtOZh0Yui8f1IA1SIP23Q5kyGgunB7MYD2br5b4Y3AT6+ 4JZeWrEWJKNqZYNPK50jRyVVJfp00SahDfHJKxSlRshraIOJ4MetulSKy+3pktHltIPd MSDNHGFtpBaSIRYdn6WAtR6QkSn9fZjp9cL8v3V7EnZVUwA+RRduVrHWBHFbBMYJeJoe 4BNNM1js7chnTk2Pv7/cWdIAVLqGE6nxkO7xHHp5XGPw/xzDX+jnP4sDVRoEiPg+2EDP NtXZQT2xMi51DJ8wqzAZjJ7YuDwvujgDnIUhgUMGRzqO8P9yWWYADilnvyLQ5G6T28kh //4Q== 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=sBib7CZMg95qeww+RHH4JyfgC4bfhTsTe+NG8hxtfyg=; b=jKKb9z85K4xUOWkq11CEXdh9rm4KwBMxAd1z3wcLnb3mkXETm8YaQ6Z60rdEWvOq8Z Tc1hQ5+bi8PWzIoww8frXZ5FWslYartd5PGX3fLvEk1AdmOUqLWu9QxyraTUcMAihwu+ VdK0LBAkJZawn50u19sTAnEvUsgqPo6shdMEF/NITHrNDp1FNhAd1rsYH0p36h9/QsoQ odjncG62ZoFG9alxgpi9dSPBDfr5GmGKVgPflqU6zbwdQimW4CXqV8wEsfNY3/0OwGQr LC9sGJsybB5nmkdMai2fr69FFXTSFBBli39lC4hXTLiajt2uztvct2rTEVhkMPSg2lGh IPGQ== X-Gm-Message-State: ALyK8tIoUqw/NtMNMxB3ijXWn5Oq/ZmXuvy3SFFXNA1ABlYJoCr49Y7IPG+n79fPedYM5g== X-Received: by 10.98.158.206 with SMTP id f75mr18387450pfk.164.1466382498212; Sun, 19 Jun 2016 17:28:18 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net (c-73-252-251-201.hsd1.ca.comcast.net. [73.252.251.201]) by smtp.gmail.com with ESMTPSA id s12sm34984980pfj.57.2016.06.19.17.28.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Jun 2016 17:28:17 -0700 (PDT) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, tglx@linutronix.de, torvalds@linux-foundation.org, tytso@mit.edu, viro@zeniv.linux.org.uk, y2038@lists.linaro.org, Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH v2 08/24] fs: btrfs: Use ktime_get_real_ts for root ctime Date: Sun, 19 Jun 2016 17:27:07 -0700 Message-Id: <1466382443-11063-9-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466382443-11063-1-git-send-email-deepa.kernel@gmail.com> References: <1466382443-11063-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP btrfs_root_item maintains the ctime for root updates. This is not part of vfs_inode. Since current_time() uses struct inode* as an argument as Linus suggested, this cannot be used to update root times unless, we modify the signature to use inode. Since btrfs uses nanosecond time granularity, it can also use ktime_get_real_ts directly to obtain timestamp for the root. It is necessary to use the timespec time api here because the same btrfs_set_stack_timespec_*() apis are used for vfs inode times as well. These can be transitioned to using timespec64 when btrfs internally changes to use timespec64 as well. Signed-off-by: Deepa Dinamani Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Acked-by: David Sterba --- fs/btrfs/root-tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index f1c3086..161118b 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c @@ -496,10 +496,11 @@ 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 timespec ct; spin_lock(&root->root_item_lock); btrfs_set_root_ctransid(item, trans->transid); + ktime_get_real_ts(&ct); btrfs_set_stack_timespec_sec(&item->ctime, ct.tv_sec); btrfs_set_stack_timespec_nsec(&item->ctime, ct.tv_nsec); spin_unlock(&root->root_item_lock);