Signed-off-by: Jan Kara <jack@xxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html