blk_finish_queue_drain(q); 
clear_bit(QUEUE_FLAG_BYPASS, &q->queue_flags); kfree(e); 
static void elevator_switch(request_queue_t *q, struct elevator_type *new_e){	elevator_t *e = kmalloc(sizeof(elevator_t), GFP_KERNEL);	struct elevator_type *noop_elevator = NULL;	elevator_t *old_elevator;	if (!e)		goto error;	/*	 * first step, drain requests from the block freelist	 */	blk_wait_queue_drained(q, 0);	/*	 * unregister old elevator data	 */	elv_unregister_queue(q);	old_elevator = q->elevator;	/* 	 * next step, switch to noop since it uses no private rq structures	 * and doesn't allocate any memory for anything. then wait for any	 * non-fs requests in-flight 	 */	noop_elevator = elevator_get("noop");	spin_lock_irq(q->queue_lock);	elevator_attach(q, noop_elevator, e);	spin_unlock_irq(q->queue_lock);	blk_wait_queue_drained(q, 1);	/*	 * attach and start new elevator	 */	if (elevator_attach(q, new_e, e))		goto fail;	if (elv_register_queue(q))		goto fail_register;	/*	 * finally exit old elevator and start queue again	 */	elevator_exit(old_elevator);	blk_finish_queue_drain(q);	elevator_put(noop_elevator);	return;fail_register:	/*	 * switch failed, exit the new io scheduler and reattach the old	 * one again (along with re-adding the sysfs dir)	 */	elevator_exit(e);fail:	q->elevator = old_elevator;	elv_register_queue(q);	blk_finish_queue_drain(q);error:	if (noop_elevator)		elevator_put(noop_elevator);	elevator_put(new_e);	printk(KERN_ERR "elevator: switch to %s failed\n",new_e->elevator_name);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/cb98fc8bb9c141009e2bda99c0db39d387e142cf/elevator.c/buggy/drivers/block/elevator.c