diff mbox

Re: [PATCH 12/24] io-controller: Wait for requests to complete from last queue before new queue is scheduled

Message ID 4A92095A.4070804@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gui Jianfeng Aug. 24, 2009, 3:30 a.m. UTC
Vivek Goyal wrote:
...
>  void elv_schedule_dispatch(struct request_queue *q)
> @@ -2260,6 +2264,17 @@ void *elv_select_ioq(struct request_queue *q, int force)
>  	}
>  
>  expire:
> +	if (efqd->fairness && !force && ioq && ioq->dispatched) {
> +		/*
> +		 * If there are request dispatched from this queue, don't
> +		 * dispatch requests from new queue till all the requests from
> +		 * this queue have completed.
> +		 */
> +		elv_log_ioq(efqd, ioq, "select: wait for requests to finish"
> +				" disp=%lu", ioq->dispatched);
> +		ioq = NULL;
> +		goto keep_queue;
> +	}
>  	elv_slice_expired(q);
>  new_queue:
>  	ioq = elv_set_active_ioq(q, new_ioq);
> @@ -2375,6 +2390,10 @@ void elv_ioq_completed_request(struct request_queue *q, struct request *rq)
>  				goto done;
>  			}
>  
> +			/* Wait for requests to finish from this queue */
> +			if (efqd->fairness && ioq->dispatched)

Since we have the routing to access to ioq->dispatched, why not to use it.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
 block/elevator-fq.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/block/elevator-fq.c b/block/elevator-fq.c
index d04e925..f1e0de5 100644
--- a/block/elevator-fq.c
+++ b/block/elevator-fq.c
@@ -3120,7 +3120,7 @@  void elv_ioq_completed_request(struct request_queue *q, struct request *rq)
 			}
 
 			/* Wait for requests to finish from this queue */
-			if (efqd->fairness && ioq->dispatched)
+			if (efqd->fairness && elv_ioq_nr_dispatched(ioq))
 				goto done;
 
 			/* Expire the queue */
@@ -3135,7 +3135,7 @@  void elv_ioq_completed_request(struct request_queue *q, struct request *rq)
 		 * If this is the last queue in the group and we did not
 		 * decide to idle on queue, idle on group.
 		 */
-		if (elv_iog_should_idle(ioq) && !ioq->dispatched
+		if (elv_iog_should_idle(ioq) && !elv_ioq_nr_dispatched(ioq)
 		    && !timer_pending(&efqd->idle_slice_timer)) {
 			/*
 			 * If queue has used up its slice, wait for the