]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: calculate more accurate remaining time to sleep in transaction_kthread
authorNikolay Borisov <nborisov@suse.com>
Tue, 20 Oct 2020 09:44:17 +0000 (12:44 +0300)
committerDavid Sterba <dsterba@suse.com>
Tue, 8 Dec 2020 14:53:36 +0000 (15:53 +0100)
commit67e5e8ca8783e546251dd53d2eb28a5bb0eed953
treeb921c6141761365c55b10006765cbea053860bc9
parentb080037e07f0513cc03beee487e2e989e8b2a0f4
btrfs: calculate more accurate remaining time to sleep in transaction_kthread

If transaction_kthread is woken up before btrfs_fs_info::commit_interval
seconds have elapsed it will sleep for a fixed period of 5 seconds. This
is not a problem per-se but is not accurate. Instead the code should
sleep for an interval which guarantees on next wakeup commit_interval
would have passed. Since time tracking is not precise subtract 1 second
from delta to ensure the delay we end up waiting will be longer than
than the wake up period.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c