From: Nikolay Borisov <nborisov@suse.com>
To: Arnd Bergmann <arnd@arndb.de>, Chris Mason <clm@fb.com>,
Josef Bacik <jbacik@fb.com>, David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>, Anand Jain <anand.jain@oracle.com>,
Liu Bo <bo.liu@linux.alibaba.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] [v2] btrfs: use monotonic time for transaction handling
Date: Thu, 21 Jun 2018 19:06:44 +0300 [thread overview]
Message-ID: <8252f9b0-dcf2-a10e-3e21-aa069668c916@suse.com> (raw)
In-Reply-To: <20180621160420.139575-1-arnd@arndb.de>
On 21.06.2018 19:04, Arnd Bergmann wrote:
> The transaction times were changed to ktime_get_real_seconds to avoid
> the y2038 overflow, but they still have a minor problem when they go
> backwards or jump due to settimeofday() or leap seconds.
>
> This changes the transaction handling to instead use ktime_get_seconds(),
> which returns a CLOCK_MONOTONIC timestamp that has neither of those
> problems.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> v2: Rebased on top of an earlier patch by Allen Pais, which
> also obsoleted the original patch 2/3
> ---
> fs/btrfs/disk-io.c | 2 +-
> fs/btrfs/transaction.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index f3224e23d5fa..bf0717f2824d 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -1819,7 +1819,7 @@ static int transaction_kthread(void *arg)
> goto sleep;
> }
>
> - now = ktime_get_real_seconds();
> + now = ktime_get_seconds();
> if (cur->state < TRANS_STATE_BLOCKED &&
> !test_bit(BTRFS_FS_NEED_ASYNC_COMMIT, &fs_info->flags) &&
> (now < cur->start_time ||
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index 56c8bab0b816..ebe50dfb8947 100644
> --- a/fs/btrfs/transaction.c
> +++ b/fs/btrfs/transaction.c
> @@ -241,7 +241,7 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,
> refcount_set(&cur_trans->use_count, 2);
> atomic_set(&cur_trans->pending_ordered, 0);
> cur_trans->flags = 0;
> - cur_trans->start_time = ktime_get_real_seconds();
> + cur_trans->start_time = ktime_get_seconds();
>
> memset(&cur_trans->delayed_refs, 0, sizeof(cur_trans->delayed_refs));
>
>
next prev parent reply other threads:[~2018-06-21 16:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-21 16:04 Arnd Bergmann
2018-06-21 16:04 ` [PATCH 2/2] [v2] btrfs: use timespec64 for i_otime Arnd Bergmann
2018-06-21 16:09 ` Nikolay Borisov
2018-06-21 16:06 ` Nikolay Borisov [this message]
2018-06-21 17:24 ` [PATCH 1/2] [v2] btrfs: use monotonic time for transaction handling David Sterba
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=8252f9b0-dcf2-a10e-3e21-aa069668c916@suse.com \
--to=nborisov@suse.com \
--cc=anand.jain@oracle.com \
--cc=arnd@arndb.de \
--cc=bo.liu@linux.alibaba.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wqu@suse.com \
/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
all inboxes | Powered by JetHome®