summaryrefslogtreecommitdiff
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2020-10-08 15:24:29 +0300
committerDavid Sterba <dsterba@suse.com>2020-12-08 15:53:36 +0100
commit643900bee4141e1b1c47dce93973a0d1a314d8a5 (patch)
treea1b64c26d5650e1ead4cba12ef20b9cb9086930d /fs/btrfs/disk-io.c
parente4e428816192798c2fa473ff67d9032b94f93291 (diff)
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>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 3f2c5c05359e..813d1d5e6927 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -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;