From: Nick Piggin <piggin@cyberone.com.au>

Sometimes a processes thinktime shouldn't be measured on how soon it
submits its next request, but how soon any close request is submitted.

Some processes, such as those in make -j, find | xargs blah, etc. Should be
waited upon even if they never submit another request, because they work with
cooperating or child processes. This helps to take that into account.



 drivers/block/as-iosched.c |   10 ++++++++++
 1 files changed, 10 insertions(+)

diff -puN drivers/block/as-iosched.c~as-cooperative-thinktime drivers/block/as-iosched.c
--- 25/drivers/block/as-iosched.c~as-cooperative-thinktime	2003-11-07 12:43:04.000000000 -0800
+++ 25-akpm/drivers/block/as-iosched.c	2003-11-07 12:43:04.000000000 -0800
@@ -657,6 +657,7 @@ static int as_close_req(struct as_data *
 	return (last - (delta>>1) <= next) && (next <= last + delta);
 }
 
+static void as_update_thinktime(struct as_data *ad, struct as_io_context *aic, unsigned long ttime);
 /*
  * as_can_break_anticipation returns true if we have been anticipating this
  * request.
@@ -686,6 +687,15 @@ static int as_can_break_anticipation(str
 
 	if (arq && arq->is_sync == REQ_SYNC && as_close_req(ad, arq)) {
 		/* close request */
+		struct as_io_context *aic = ioc->aic;
+		if (aic) {
+			unsigned long thinktime;
+			spin_lock(&aic->lock);
+			thinktime = jiffies - aic->last_end_request;
+			aic->last_end_request = jiffies;
+			as_update_thinktime(ad, aic, thinktime);
+			spin_unlock(&aic->lock);
+		}
 		return 1;
 	}
 

_