All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
To: song@kernel.org
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
	pankaj.gupta.linux@gmail.com,
	Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
Subject: [PATCH 3/3] md: use current request time as base for ktime comparisons
Date: Wed, 11 Nov 2020 06:16:58 +0100	[thread overview]
Message-ID: <20201111051658.18904-4-pankaj.gupta.linux@gmail.com> (raw)
In-Reply-To: <20201111051658.18904-1-pankaj.gupta.linux@gmail.com>

From: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>

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: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
---
 drivers/md/md.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index a330e61876e0..217b1e3312cb 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -667,10 +667,10 @@ bool md_flush_request(struct mddev *mddev, struct bio *bio)
 	 */
 	wait_event_lock_irq(mddev->sb_wait,
 			    !mddev->flush_bio ||
-			    ktime_after(mddev->prev_flush_start, req_start),
+			    ktime_before(req_start, mddev->prev_flush_start),
 			    mddev->lock);
 	/* 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);
 		mddev->flush_bio = bio;
 		bio = NULL;
-- 
2.20.1


  parent reply	other threads:[~2020-11-11  5:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11  5:16 [PATCH 0/3] md: code cleanups Pankaj Gupta
2020-11-11  5:16 ` [PATCH 1/3] md: improve variable names in md_flush_request() Pankaj Gupta
2020-11-11  6:52   ` Paul Menzel
2020-11-11  7:22     ` Pankaj Gupta
2020-11-11  5:16 ` [PATCH 2/3] md: add comments " Pankaj Gupta
2020-11-11  5:16 ` Pankaj Gupta [this message]
2020-11-16 17:30 ` [PATCH 0/3] md: code cleanups Song Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201111051658.18904-4-pankaj.gupta.linux@gmail.com \
    --to=pankaj.gupta.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=pankaj.gupta@cloud.ionos.com \
    --cc=song@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.