From: David Sterba <dsterba@suse.cz>
To: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: linux-kernel@vger.kernel.org, arnd@arndb.de,
Chris Mason <clm@fb.com>, Josef Bacik <jbacik@fb.com>,
y2038@lists.linaro.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] fs: btrfs: Use ktime_get_real_ts for root ctime
Date: Sun, 2 Oct 2016 01:06:04 +0200 [thread overview]
Message-ID: <20161001230603.GA6576@suse.cz> (raw)
In-Reply-To: <1475342614-18439-1-git-send-email-deepa.kernel@gmail.com>
On Sat, Oct 01, 2016 at 10:23:34AM -0700, Deepa Dinamani wrote:
> 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>
Acked-by: 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
>
>
prev parent reply other threads:[~2016-10-01 23:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-01 17:23 [PATCH] fs: btrfs: Use ktime_get_real_ts for root ctime Deepa Dinamani
2016-10-01 23:06 ` David Sterba [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161001230603.GA6576@suse.cz \
--to=dsterba@suse.cz \
--cc=arnd@arndb.de \
--cc=clm@fb.com \
--cc=deepa.kernel@gmail.com \
--cc=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=y2038@lists.linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).