From patchwork Sat Aug 13 22:48:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9278769 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 4F95360231 for ; Sun, 14 Aug 2016 10:51:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4018828A1A for ; Sun, 14 Aug 2016 10:51:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 347CE28A28; Sun, 14 Aug 2016 10:51:03 +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 53B4628A1E for ; Sun, 14 Aug 2016 10:51:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807AbcHNKuk (ORCPT ); Sun, 14 Aug 2016 06:50:40 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:35307 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751243AbcHNKui (ORCPT ); Sun, 14 Aug 2016 06:50:38 -0400 Received: by mail-pa0-f65.google.com with SMTP id cf3so2031223pad.2; Sun, 14 Aug 2016 03:50:38 -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=EPJ6ezt2/TP0hhtf4cYruFEJtgZD9EyKpNbaq3uiWkA=; b=nZFCXor5VWGhD5EYZnXBWJrg5cqOvSIe0QtvZGhPrUp9f9jqzzXHcXpkqp5yBQgmVS BxWDDoCVP6ewUustaTxueyaZvxGPvB3t12XcjA4AjDZeuClOtpATrhil72shS9QqNqOt MPWJUjOWZhAEwa618Eb+aG6iJ32yZ1kzYfktzCGnEEl7dQU21mUrCErbjlmG/FalH82h yL7w/hk8X6RSJya3qVXRfVMSj0dPgobtl3bgcup+disX1lyjgUrhQh9qqdUndIDxgMzJ FSvD+I8FTv29RtNfPyF9qltoJ8LPLpRY2cn0jWQtbcZ8S97HuWvj6JyC7TESqajW1pYr SXlA== 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=EPJ6ezt2/TP0hhtf4cYruFEJtgZD9EyKpNbaq3uiWkA=; b=Z4QpK4WpRT1F+ixVXrm8PhDmvs1nCQMZH9dbgq/iq0RJQazm4+//P2aWHvJeKHU4iV e1R1yALBK62TLfjrQnJe+CFV+n3pzx1VlPZ5fsN3AUTPZTo8ACMOgUC8ie5PKpf0SWBh o9yoeGE6Cr8Mh70dtHaQDsZJH+LPQ/4PRHuvvpEGtrS7ED7KxfiIuBEuyASmFp+p4fkU xdt5A7ROYI+vAz5z24IACIu0PpieDZm1My1et/PtYCZODSXrWC17guCkQWk8spwoOm8f pqyEWDYkmrRupmsfVtls76cJl7U+LNFjPPdYiuPlLpLjBRc2LFYCVm3z3OBUjNUvJcQA JdMQ== X-Gm-Message-State: AEkoouuOzt0B3LISB14TJi8ZtWu0RWUU59rk//EbU69xDJIvRV00p6Ef/hJRktwnIAxi3w== X-Received: by 10.66.177.7 with SMTP id cm7mr40221290pac.132.1471128568220; Sat, 13 Aug 2016 15:49:28 -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 81sm22528007pfm.90.2016.08.13.15.49.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Aug 2016 15:49:27 -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 , David Sterba , Josef Bacik , linux-btrfs@vger.kernel.org Subject: [PATCH v4 10/26] fs: btrfs: Use ktime_get_real_ts for root ctime Date: Sat, 13 Aug 2016 15:48:22 -0700 Message-Id: <1471128518-24075-11-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471128518-24075-1-git-send-email-deepa.kernel@gmail.com> References: <1471128518-24075-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 Acked-by: David Sterba Reviewed-by: Arnd Bergmann Cc: Chris Mason Cc: David Sterba Cc: Josef Bacik 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 7fd7e18..212ae51 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);