static int as_dispatch_request(struct as_data *ad) 
static int as_dispatch_request(request_queue_t *q, int force) 
static int as_dispatch_request(struct as_data *ad){	struct as_rq *arq;	const int reads = !list_empty(&ad->fifo_list[REQ_SYNC]);	const int writes = !list_empty(&ad->fifo_list[REQ_ASYNC]);	/* Signal that the write batch was uncontended, so we can't time it */	if (ad->batch_data_dir == REQ_ASYNC && !reads) {		if (ad->current_write_count == 0 || !writes)			ad->write_batch_idled = 1;	}	if (!(reads || writes)		|| ad->antic_status == ANTIC_WAIT_REQ		|| ad->antic_status == ANTIC_WAIT_NEXT		|| ad->changed_batch)		return 0;	if (!(reads && writes && as_batch_expired(ad)) ) {		/*		 * batch is still running or no reads or no writes		 */		arq = ad->next_arq[ad->batch_data_dir];		if (ad->batch_data_dir == REQ_SYNC && ad->antic_expire) {			if (as_fifo_expired(ad, REQ_SYNC))				goto fifo_expired;			if (as_can_anticipate(ad, arq)) {				as_antic_waitreq(ad);				return 0;			}		}		if (arq) {			/* we have a "next request" */			if (reads && !writes)				ad->current_batch_expires =					jiffies + ad->batch_expire[REQ_SYNC];			goto dispatch_request;		}	}	/*	 * at this point we are not running a batch. select the appropriate	 * data direction (read / write)	 */	if (reads) {		BUG_ON(RB_EMPTY(&ad->sort_list[REQ_SYNC]));		if (writes && ad->batch_data_dir == REQ_SYNC)			/*			 * Last batch was a read, switch to writes			 */			goto dispatch_writes;		if (ad->batch_data_dir == REQ_ASYNC) {			WARN_ON(ad->new_batch);			ad->changed_batch = 1;		}		ad->batch_data_dir = REQ_SYNC;		arq = list_entry_fifo(ad->fifo_list[ad->batch_data_dir].next);		ad->last_check_fifo[ad->batch_data_dir] = jiffies;		goto dispatch_request;	}	/*	 * the last batch was a read	 */	if (writes) {dispatch_writes:		BUG_ON(RB_EMPTY(&ad->sort_list[REQ_ASYNC]));		if (ad->batch_data_dir == REQ_SYNC) {			ad->changed_batch = 1;			/*			 * new_batch might be 1 when the queue runs out of			 * reads. A subsequent submission of a write might			 * cause a change of batch before the read is finished.			 */			ad->new_batch = 0;		}		ad->batch_data_dir = REQ_ASYNC;		ad->current_write_count = ad->write_batch_count;		ad->write_batch_idled = 0;		arq = ad->next_arq[ad->batch_data_dir];		goto dispatch_request;	}	BUG();	return 0;dispatch_request:	/*	 * If a request has expired, service it.	 */	if (as_fifo_expired(ad, ad->batch_data_dir)) {fifo_expired:		arq = list_entry_fifo(ad->fifo_list[ad->batch_data_dir].next);		BUG_ON(arq == NULL);	}	if (ad->changed_batch) {		WARN_ON(ad->new_batch);		if (ad->nr_dispatched)			return 0;		if (ad->batch_data_dir == REQ_ASYNC)			ad->current_batch_expires = jiffies +					ad->batch_expire[REQ_ASYNC];		else			ad->new_batch = 1;		ad->changed_batch = 0;	}	/*	 * arq is the selected appropriate request.	 */	as_move_to_dispatch(ad, arq);	return 1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b4878f245ec8e168cdd1f170f823a750b7dd4af5/as-iosched.c/clean/drivers/block/as-iosched.c