2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 20:53:53 +08:00

btrfs: record delta directly in transaction_kthread

Rename 'now' to 'delta' and store there the delta between transaction
start time and current time. This is in preparation for optimising the
sleep logic in the next patch. 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>
This commit is contained in:
Nikolay Borisov 2020-10-08 15:24:29 +03:00 committed by David Sterba
parent e4e4288161
commit 643900bee4

View File

@ -1774,7 +1774,7 @@ static int transaction_kthread(void *arg)
struct btrfs_trans_handle *trans;
struct btrfs_transaction *cur;
u64 transid;
time64_t now;
time64_t delta;
unsigned long delay;
bool cannot_commit;
@ -1790,9 +1790,9 @@ static int transaction_kthread(void *arg)
goto sleep;
}
now = ktime_get_seconds();
delta = ktime_get_seconds() - cur->start_time;
if (cur->state < TRANS_STATE_COMMIT_START &&
now - cur->start_time < fs_info->commit_interval) {
delta < fs_info->commit_interval) {
spin_unlock(&fs_info->trans_lock);
delay = msecs_to_jiffies(5000);
goto sleep;