Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1431247

[PATCH v3 09/24] fs: btrfs: Use ktime_get_real_ts for root ctime

From Deepa Dinamani <deepa.kernel@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v3 09/24] fs: btrfs: Use ktime_get_real_ts for root ctime
Date 2016-06-25 23:50 +0200
Message-ID <rO3CG-2iL-35@gated-at.bofh.it> (permalink)
References <rO3t0-2bb-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <deepa.kernel@gmail.com>
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Acked-by: David Sterba <dsterba@suse.com>
---
 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);
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/24] Delete CURRENT_TIME_SEC and replace current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-06-25 23:50 +0200
  [PATCH v3 09/24] fs: btrfs: Use ktime_get_real_ts for root ctime Deepa Dinamani <deepa.kernel@gmail.com> - 2016-06-25 23:50 +0200
  [PATCH v3 07/24] fs: ext4: Use current_time() for inode timestamps Deepa Dinamani <deepa.kernel@gmail.com> - 2016-06-25 23:50 +0200
  [PATCH v3 16/24] fs: ocfs2: Use time64_t to represent orphan scan times Deepa Dinamani <deepa.kernel@gmail.com> - 2016-06-25 23:50 +0200
  [PATCH v3 05/24] fs: Replace current_fs_time() with current_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-06-25 23:50 +0200
  Re: [Y2038] [PATCH v3 00/24] Delete CURRENT_TIME_SEC and replace current_fs_time() Arnd Bergmann <arnd@arndb.de> - 2016-06-29 21:50 +0200

csiph-web