From patchwork Sat Oct 1 17:23:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9359325 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 B276A607D6 for ; Sat, 1 Oct 2016 17:24:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A058C28CED for ; Sat, 1 Oct 2016 17:24:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 956E228D10; Sat, 1 Oct 2016 17:24:10 +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 2E8EA28D0C for ; Sat, 1 Oct 2016 17:24:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751080AbcJARXx (ORCPT ); Sat, 1 Oct 2016 13:23:53 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:32965 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750820AbcJARXw (ORCPT ); Sat, 1 Oct 2016 13:23:52 -0400 Received: by mail-pa0-f65.google.com with SMTP id oz2so6215084pac.0; Sat, 01 Oct 2016 10:23:51 -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; bh=ekPBeest2o70GODZMbWbyT002GMS/Ntzszy1Q8e4KV0=; b=OdippVe44xR773T/KGSzBAShmnPAlpynLGVJ81o8AVc0tTYqtjX5YrsIvSgOVhnCzz aAvx0e/YMLlM8XXqiJlaYoTrtpqh/bmZCIG+pklvqGBXtnI4Y3shSVSpM7JqtYo6liE5 x+b6Y8TysCgCU+lPm2XIu15tt6Dwti8MNZYzs+i0cStTPViisBRhkoZhztiTsqo///kc F3qLs3LrSFlrF9WWshykqdj1Rova1qCyZqXzJTnLkRg6R627CwVP0gh1r4CkUp1/L/FY +8yuUBOeYNlaOL7sN2RG7yAjcvTFl22MUFOnKFc5Esbf97et/S9wTGeWQW+Ogcfd2yRE 86lw== 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; bh=ekPBeest2o70GODZMbWbyT002GMS/Ntzszy1Q8e4KV0=; b=Y3SnaUu3Elvogvm1kpR5trCZblUh1p45FLfT8lxGCERcC/YS2ntioJKq7SdhWUE4PN Fi+Ofp4G/5MGDjdUkztW1zkEFiVkFmZAKIdRQmeaAjFq9T/oJFPoFL1dIeODUgb5gIDw IR39YQccGRDd9XiPeZnzx7nxmqxoMQUTS6rV/omsa2STL3B0itZPazamyw18mn115O/t md++slsGgwXPOVSsHlfohvFeCqVL5CFCpbBU2xuwaKvzeX30r355LWcgR8A8Rg/F5Upr ae82EDOhia67MCp/cLKxSsYw5oQm9+YvkfFWwKnry+1SLmlrjTsmS7P9kzsJG/H/Uwzk 34WA== X-Gm-Message-State: AA6/9Rn6DHaiU9HQwtcz+IqtiGlRwCWjP87DK5h+ABobMPL+v6CxQU974tCBuKYHIb0CIA== X-Received: by 10.66.254.102 with SMTP id ah6mr21973018pad.59.1475342631462; Sat, 01 Oct 2016 10:23:51 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net ([2601:647:5000:6620:2cdc:37ce:31d6:fd40]) by smtp.gmail.com with ESMTPSA id yg10sm36286830pab.8.2016.10.01.10.23.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 01 Oct 2016 10:23:50 -0700 (PDT) From: Deepa Dinamani To: linux-kernel@vger.kernel.org Cc: arnd@arndb.de, y2038@lists.linaro.org, Chris Mason , David Sterba , Josef Bacik , linux-btrfs@vger.kernel.org Subject: [PATCH] fs: btrfs: Use ktime_get_real_ts for root ctime Date: Sat, 1 Oct 2016 10:23:34 -0700 Message-Id: <1475342614-18439-1-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.7.4 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: David Sterba Cc: Josef Bacik Cc: linux-btrfs@vger.kernel.org Acked-by: David Sterba --- Changes from previous version: * Separated from the current_time() api series. * Moved ktime_get_real_ts() outside of spin lock. 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 0912960..17e5a5f 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c @@ -505,8 +505,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);