linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Chris Mason <chris.mason@oracle.com>
Cc: linux-fsdevel@vger.kernel.org, Jan Kara <jack@suse.cz>
Subject: [PATCH 1/2] barrier-test: Do not flush delayed queue for reads
Date: Wed, 11 Jan 2012 01:44:06 +0100	[thread overview]
Message-ID: <1326242647-23773-2-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1326242647-23773-1-git-send-email-jack@suse.cz>

Signed-off-by: Jan Kara <jack@suse.cz>
---
 block/barrier-test-iosched.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/block/barrier-test-iosched.c b/block/barrier-test-iosched.c
index f641537..8c30461 100644
--- a/block/barrier-test-iosched.c
+++ b/block/barrier-test-iosched.c
@@ -78,8 +78,6 @@ struct barrier_test_data {
 	int total_barriers;
 };
 
-typedef void (rq_end_io_fn)(struct request *, int);
-
 /*
  * wb_requests are ones that we are pretending are done.  We
  * just return completion right away to the poor user.
@@ -429,7 +427,23 @@ static void barrier_test_add_request(struct request_queue *q, struct request *rq
 	 * reads only happen after all the writeback io is complete.
 	 */
 	if (!(rq->cmd_flags & REQ_WRITE)) {
-		if (atomic_read(&nd->pending_rqs)) {
+		struct request *wrq;
+		bool overlap = false;
+
+		list_for_each_entry(wrq, &nd->delayed_requests, queuelist) {
+			if (blk_rq_pos(wrq) <= blk_rq_pos(rq) &&
+			    blk_rq_pos(wrq) + blk_rq_sectors(wrq) >
+							blk_rq_pos(rq)) {
+				overlap = true;
+				break;
+			} else if (blk_rq_pos(wrq) >= blk_rq_pos(rq) &&
+				   blk_rq_pos(wrq) <
+					blk_rq_pos(rq) + blk_rq_sectors(rq)) {
+				overlap = true;
+				break;
+			}
+		}
+		if (overlap) {
 			queue_all_delayed(nd, 0);
 			list_add_tail(&rq->queuelist, &nd->reads_waiting_flush);
 		} else {
-- 
1.7.1


  reply	other threads:[~2012-01-11  0:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  0:44 [PATCH 0/2] Improvements for barrier-test scheduler Jan Kara
2012-01-11  0:44 ` Jan Kara [this message]
2012-01-11  0:44 ` [PATCH 2/2] barrier-test: Allow filesystem to specify special test request Jan Kara
2012-01-11  1:22 ` [PATCH 0/2] Improvements for barrier-test scheduler Chris Mason
2012-01-11 19:26   ` Jens Axboe

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=1326242647-23773-2-git-send-email-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=chris.mason@oracle.com \
    --cc=linux-fsdevel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).