From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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> Sender: linux-btrfs-owner@vger.kernel.org List-ID: 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 --- 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); -- 2.7.4