 if (unlikely(test_bit(QUEUE_FLAG_DRAIN, &q->queue_flags))) { /* * if drain is set, store the request "locally". when the drain * is finished, the requests will be handed ordered to the io * scheduler */ list_add_tail(&rq->queuelist, &q->drain_list); return; } 
void __elv_add_request(request_queue_t *q, struct request *rq, int where,		       int plug){	if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) {		/*		 * barriers implicitly indicate back insertion		 */		if (where == ELEVATOR_INSERT_SORT)			where = ELEVATOR_INSERT_BACK;		/*		 * this request is scheduling boundary, update end_sector		 */		if (blk_fs_request(rq)) {			q->end_sector = rq_end_sector(rq);			q->boundary_rq = rq;		}	}	if (plug)		blk_plug_device(q);	rq->q = q;	if (unlikely(test_bit(QUEUE_FLAG_DRAIN, &q->queue_flags))) {		/*		 * if drain is set, store the request "locally". when the drain		 * is finished, the requests will be handed ordered to the io		 * scheduler		 */		list_add_tail(&rq->queuelist, &q->drain_list);		return;	}	switch (where) {	case ELEVATOR_INSERT_FRONT:		rq->flags |= REQ_SOFTBARRIER;		list_add(&rq->queuelist, &q->queue_head);		break;	case ELEVATOR_INSERT_BACK:		rq->flags |= REQ_SOFTBARRIER;		while (q->elevator->ops->elevator_dispatch_fn(q, 1))			;		list_add_tail(&rq->queuelist, &q->queue_head);		/*		 * We kick the queue here for the following reasons.		 * - The elevator might have returned NULL previously		 *   to delay requests and returned them now.  As the		 *   queue wasn't empty before this request, ll_rw_blk		 *   won't run the queue on return, resulting in hang.		 * - Usually, back inserted requests won't be merged		 *   with anything.  There's no point in delaying queue		 *   processing.		 */		blk_remove_plug(q);		q->request_fn(q);		break;	case ELEVATOR_INSERT_SORT:		BUG_ON(!blk_fs_request(rq));		rq->flags |= REQ_SORTED;		q->elevator->ops->elevator_add_req_fn(q, rq);		if (q->last_merge == NULL && rq_mergeable(rq))			q->last_merge = rq;		break;	default:		printk(KERN_ERR "%s: bad insertion point %d\n",		       __FUNCTION__, where);		BUG();	}	if (blk_queue_plugged(q)) {		int nrq = q->rq.count[READ] + q->rq.count[WRITE]			- q->in_flight;		if (nrq >= q->unplug_thresh)			__generic_unplug_device(q);	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/cb98fc8bb9c141009e2bda99c0db39d387e142cf/elevator.c/buggy/drivers/block/elevator.c