diff mbox series

[2/4] btrfs: Remove redundant check

Message ID 20201008122430.93433-3-nborisov@suse.com (mailing list archive)
State New, archived
Headers show
Series Small QOI fixes for transaction_kthread | expand

Commit Message

Nikolay Borisov Oct. 8, 2020, 12:24 p.m. UTC
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_tim 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 greated problems on the
machine.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/disk-io.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 77b52b724733..b9fbbf66ccee 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1733,8 +1733,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;