diff options
author | Nikolay Borisov <nborisov@suse.com> | 2020-10-08 15:24:28 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-12-08 15:53:19 +0100 |
commit | e4e428816192798c2fa473ff67d9032b94f93291 (patch) | |
tree | 34e1545005c8f4c23a8eba409880715b80c7d1aa /fs | |
parent | ba1bc00f358190ae1011eae82766aba5c73c9ca2 (diff) | |
download | linux-e4e428816192798c2fa473ff67d9032b94f93291.tar.bz2 |
btrfs: remove redundant time check in transaction kthread loop
The value obtained from ktime_get_seconds() is guaranteed to be
monotonically increasing since it's taken from CLOCK_MONOTONIC. As
transaction_kthread obtains a reference to the currently running
transaction under holding btrfs_fs_info::trans_lock it's guaranteed to:
a) see an initialized 'cur', whose start_time is guaranteed to be smaller
than 'now'
or
b) not obtain a 'cur' and simply go to sleep.
Given this remove the unnecessary check, if it sees
now < cur->start_time this would imply there are far greater problems on
the machine.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/disk-io.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index d052c2051632..3f2c5c05359e 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1792,8 +1792,7 @@ static int transaction_kthread(void *arg) now = ktime_get_seconds(); if (cur->state < TRANS_STATE_COMMIT_START && - (now < cur->start_time || - now - cur->start_time < fs_info->commit_interval)) { + now - cur->start_time < fs_info->commit_interval) { spin_unlock(&fs_info->trans_lock); delay = msecs_to_jiffies(5000); goto sleep; |