From patchwork Sat Jun 25 21:37:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9198781 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 0C5E16075F for ; Sat, 25 Jun 2016 21:42:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02D1628527 for ; Sat, 25 Jun 2016 21:42:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBD082852B; Sat, 25 Jun 2016 21:42:45 +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 ED50728529 for ; Sat, 25 Jun 2016 21:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751955AbcFYVma (ORCPT ); Sat, 25 Jun 2016 17:42:30 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:35894 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751854AbcFYVih (ORCPT ); Sat, 25 Jun 2016 17:38:37 -0400 Received: by mail-pa0-f68.google.com with SMTP id av7so5854579pac.3; Sat, 25 Jun 2016 14:38:37 -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=+bTJViic4FWJgAW1BRPUpR4bMm9ZvIm1cE9eyRFFSE8=; b=lW38t30E9pC2hQmOkmUq9b0M+/mFYCYeVPfCw+C69zLwfuFhFuUWzolLf5sXTc80yO 3Fkgunn7ZL43zINtDCI6h0KZKJQgsuuHJvO2zot+cSynfc1ZdMowlTqxlFxixqiVkDK+ wWF2KX+VwT9jfecKEg4uuZHWOjB2pyNzgLwya+nSH6eu4gKeQnGJA8vX2tNwjrGkcaK+ 2mNn9FmB92Ut3eNpbTppMC5PCv7AOa59ijYqbtLObOvdA7VAjoS9JWgkj09fV2uMZNrA /iGb4Y/02Y4smmOxyREfrSjaqnTEpfbrW8cVwuJwI462lbSQgXEoVR5tjswLKokp/q5O bMWw== 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=+bTJViic4FWJgAW1BRPUpR4bMm9ZvIm1cE9eyRFFSE8=; b=hpUDht6p2hVPqNf8gqSeMKohENfQY1Im6SUIRnBfZmvDrjvEEM9MumwonMWkL1C4Hv fO52w4rZexQ60fL47VqtEVMItcGDMQsE09IEqU9handAI3Jr3a0AIkDk5WYthyCuj3Dx yAtsk9VDBQi47T9m2nt9YjiBX9XIjZt3a+j0iphxI59FqHFg3Z6huJwpdjTcHvcBX7WC 4hLdDaayaIBbdS0V4BvWB8jqEdRUD6X4CtnvGqD6OVT96BI9Wthso4jg2Y3SnpFe9M/i TarFLjW2cSe7QqIgOpkqEXbLxbUNhmtUPlxneb6+iDQP1o/g+MS+S+ECazQtOw9t+x2F 2icA== X-Gm-Message-State: ALyK8tJZBEttY48Nx0Ooc6ztdyYO8PJL2+TE+jtVBdMWVhOePBDliEB1Kyk04Ehf84KWtw== X-Received: by 10.66.27.41 with SMTP id q9mr19884195pag.45.1466890712078; Sat, 25 Jun 2016 14:38:32 -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 m8sm1861308pfi.27.2016.06.25.14.38.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 Jun 2016 14:38:31 -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 v3 09/24] fs: btrfs: Use ktime_get_real_ts for root ctime Date: Sat, 25 Jun 2016 14:37:33 -0700 Message-Id: <1466890668-23400-10-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466890668-23400-1-git-send-email-deepa.kernel@gmail.com> References: <1466890668-23400-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-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);