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


Groups > linux.kernel > #1494443

[PATCH] fs: btrfs: Use ktime_get_real_ts for root ctime

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Deepa Dinamani <deepa.kernel@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] fs: btrfs: Use ktime_get_real_ts for root ctime
Date Sat, 01 Oct 2016 19:30:02 +0200
Message-ID <snwgO-3bv-19@gated-at.bofh.it> (permalink)
X-Original-To linux-kernel@vger.kernel.org
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)
X-Mailer git-send-email 2.7.4
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 45
Organization linux.* mail to news gateway
X-Original-Cc arnd@arndb.de, y2038@lists.linaro.org, Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>, Josef Bacik <jbacik@fb.com>, linux-btrfs@vger.kernel.org
X-Original-Date Sat, 1 Oct 2016 10:23:34 -0700
X-Original-Message-ID <1475342614-18439-1-git-send-email-deepa.kernel@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1494443

Show key headers only | 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: David Sterba <dsterba@suse.com>
Cc: Josef Bacik <jbacik@fb.com>
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

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


Thread

[PATCH] fs: btrfs: Use ktime_get_real_ts for root ctime Deepa Dinamani <deepa.kernel@gmail.com> - 2016-10-01 19:30 +0200
  Re: [PATCH] fs: btrfs: Use ktime_get_real_ts for root ctime David Sterba <dsterba@suse.cz> - 2016-10-02 01:10 +0200

csiph-web