From patchwork Sat Apr 8 00:57:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9670827 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 1283F602B3 for ; Sat, 8 Apr 2017 01:02:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04D3F285FE for ; Sat, 8 Apr 2017 01:02:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED6E528636; Sat, 8 Apr 2017 01:02:56 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable 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 59FAA285FE for ; Sat, 8 Apr 2017 01:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934039AbdDHBBJ (ORCPT ); Fri, 7 Apr 2017 21:01:09 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33871 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934077AbdDHA6y (ORCPT ); Fri, 7 Apr 2017 20:58:54 -0400 Received: by mail-pg0-f66.google.com with SMTP id o123so18679095pga.1; Fri, 07 Apr 2017 17:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OhQoM+Ol69J/PGSWzubEQGx9KaxS0ohc3EHYIiW0L3g=; b=snjPTDqU9QgHrS+La4VJa9PDAxHV0Whuh1f+use0aWjuclI8RGCnlzehzqFy0dpPfa RgJTJS81SAajtxTACU3FQMxQY/PW7Fl5sYyfmfBcjCqVKbQcwmRdg0MMVM5kobKEXUWq 6W3xNLpUK7Q2b2z+c/R2dmLuA9xHmp+pS7XzUp7oPWROnP6OQR+EozG+19HubfezNHIH Ze2N6HztWnPbNRRhTC1q1ggG2e97tvobWWmX1aQQr7nFR+8xrFlXkmyhH6ybPkib6IKu 4O4hqgNugWTSEQo3pds890PYOuqyXLywshuiXLdltMYDuDOjnxwM8Nct5LL8oIb6yZII amtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OhQoM+Ol69J/PGSWzubEQGx9KaxS0ohc3EHYIiW0L3g=; b=ZBN0ZNbZ2bfbSCIi9o+ll2Ywo5SXwekuit0UDFANZJw5ovrehy3PHy1NmAu9p3xtSf gSKEnRle4zUD9XAELDZ2EOQ+UfqofC0MV11ogkpWKZjmXI8Ff7fuHNZno35+Jr3dSEzb ruVLKrGVAf1JSiNw5Zs9h32zS/AkUfegcVd/MharlVH3EQF2szAAvZ/jLd9zeAWowiV5 yRvqMFclAGJ0XKDwv+qHv0Fb+Rllyn3PYrtZzaUaEj6rtoW5EuVa66qflwOg99fcf2EB j2lPw/xbVnMdfD9FfTR8vhusbG4biHKxunhiTIaMeDyfgKdjlzWyiLldByRdFreuHZIR HWNA== X-Gm-Message-State: AFeK/H0BAZ0B0nkzsTTcUd+qmMEor0TNJDbjs5vjVnmgOHQp884SLZEcvj1vr4fLUzMU+A== X-Received: by 10.99.96.68 with SMTP id u65mr45358894pgb.159.1491613123072; Fri, 07 Apr 2017 17:58:43 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net ([2601:647:5000:6620:95ed:e0d8:7705:f3cc]) by smtp.gmail.com with ESMTPSA id b8sm11638130pfk.39.2017.04.07.17.58.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Apr 2017 17:58:42 -0700 (PDT) From: Deepa Dinamani To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: tglx@linutronix.de, viro@zeniv.linux.org.uk, gregkh@linuxfoundation.org, andreas.dilger@intel.com, arnd@arndb.de, bfields@fieldses.org, clm@fb.com, davem@davemloft.net, dsterba@suse.com, dushistov@mail.ru, eparis@redhat.com, jaegeuk@kernel.org, jbacik@fb.com, jlayton@poochiereds.net, john.stultz@linaro.org, jsimmons@infradead.org, mingo@redhat.com, oleg.drokin@intel.com, paul@paul-moore.com, rostedt@goodmis.org, yuchao0@huawei.com, ceph-devel@vger.kernel.org, devel@driverdev.osuosl.org, linux-audit@redhat.com, linux-btrfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-security-module@vger.kernel.org, lustre-devel@lists.lustre.org, netdev@vger.kernel.org, samba-technical@lists.samba.org, y2038@lists.linaro.org Subject: [PATCH 07/12] fs: btrfs: Use ktime_get_real_ts for root ctime Date: Fri, 7 Apr 2017 17:57:05 -0700 Message-Id: <1491613030-11599-8-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491613030-11599-1-git-send-email-deepa.kernel@gmail.com> References: <1491613030-11599-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@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 --- 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 a08224e..7d6bc30 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c @@ -501,8 +501,9 @@ 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; + ktime_get_real_ts(&ct); spin_lock(&root->root_item_lock); btrfs_set_root_ctransid(item, trans->transid); btrfs_set_stack_timespec_sec(&item->ctime, ct.tv_sec);