Commit a23f2aae authored by Pankaj Gupta's avatar Pankaj Gupta Committed by Song Liu

md: use current request time as base for ktime comparisons

Request coalescing logic uses 'prev_flush_start' as base to
compare the current request start time. 'prev_flush_start' is
updated in other context.

This patch changes this by using ktime comparison base to
'req_start' for better readability of code.
Signed-off-by: default avatarPankaj Gupta <pankaj.gupta@cloud.ionos.com>
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
parent 204d1a64
...@@ -667,10 +667,10 @@ bool md_flush_request(struct mddev *mddev, struct bio *bio) ...@@ -667,10 +667,10 @@ bool md_flush_request(struct mddev *mddev, struct bio *bio)
*/ */
wait_event_lock_irq(mddev->sb_wait, wait_event_lock_irq(mddev->sb_wait,
!mddev->flush_bio || !mddev->flush_bio ||
ktime_after(mddev->prev_flush_start, req_start), ktime_before(req_start, mddev->prev_flush_start),
mddev->lock); mddev->lock);
/* new request after previous flush is completed */ /* new request after previous flush is completed */
if (!ktime_after(mddev->prev_flush_start, req_start)) { if (ktime_after(req_start, mddev->prev_flush_start)) {
WARN_ON(mddev->flush_bio); WARN_ON(mddev->flush_bio);
mddev->flush_bio = bio; mddev->flush_bio = bio;
bio = NULL; bio = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment