btrfs: use helpers to convert from seconds to jiffies in transaction_kthread
authorNikolay Borisov <nborisov@suse.com>
Thu, 8 Oct 2020 12:24:27 +0000 (15:24 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 7 Dec 2020 15:24:00 +0000 (16:24 +0100)
The kernel provides easy to understand helpers to convert from human
understandable units to the kernel-friendly 'jiffies'. So let's use
those to make the code easier to understand. No functional changes.

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

index af97ddc..d052c20 100644 (file)
@@ -1780,7 +1780,7 @@ static int transaction_kthread(void *arg)
 
        do {
                cannot_commit = false;
-               delay = HZ * fs_info->commit_interval;
+               delay = msecs_to_jiffies(fs_info->commit_interval * 1000);
                mutex_lock(&fs_info->transaction_kthread_mutex);
 
                spin_lock(&fs_info->trans_lock);
@@ -1795,7 +1795,7 @@ static int transaction_kthread(void *arg)
                    (now < cur->start_time ||
                     now - cur->start_time < fs_info->commit_interval)) {
                        spin_unlock(&fs_info->trans_lock);
-                       delay = HZ * 5;
+                       delay = msecs_to_jiffies(5000);
                        goto sleep;
                }
                transid = cur->transid;