if (current->flags & PF_FREEZE) refrigerator(PF_FREEZE); 
try_to_freeze(); 
static int kcdrwd(void *foobar){	struct pktcdvd_device *pd = foobar;	struct packet_data *pkt;	long min_sleep_time, residue;	set_user_nice(current, -20);	for (;;) {		DECLARE_WAITQUEUE(wait, current);		/*		 * Wait until there is something to do		 */		add_wait_queue(&pd->wqueue, &wait);		for (;;) {			set_current_state(TASK_INTERRUPTIBLE);			/* Check if we need to run pkt_handle_queue */			if (atomic_read(&pd->scan_queue) > 0)				goto work_to_do;			/* Check if we need to run the state machine for some packet */			list_for_each_entry(pkt, &pd->cdrw.pkt_active_list, list) {				if (atomic_read(&pkt->run_sm) > 0)					goto work_to_do;			}			/* Check if we need to process the iosched queues */			if (atomic_read(&pd->iosched.attention) != 0)				goto work_to_do;			/* Otherwise, go to sleep */			if (PACKET_DEBUG > 1) {				int states[PACKET_NUM_STATES];				pkt_count_states(pd, states);				VPRINTK("kcdrwd: i:%d ow:%d rw:%d ww:%d rec:%d fin:%d\n",					states[0], states[1], states[2], states[3],					states[4], states[5]);			}			min_sleep_time = MAX_SCHEDULE_TIMEOUT;			list_for_each_entry(pkt, &pd->cdrw.pkt_active_list, list) {				if (pkt->sleep_time && pkt->sleep_time < min_sleep_time)					min_sleep_time = pkt->sleep_time;			}			generic_unplug_device(bdev_get_queue(pd->bdev));			VPRINTK("kcdrwd: sleeping\n");			residue = schedule_timeout(min_sleep_time);			VPRINTK("kcdrwd: wake up\n");			/* make swsusp happy with our thread */			if (current->flags & PF_FREEZE)				refrigerator(PF_FREEZE);			list_for_each_entry(pkt, &pd->cdrw.pkt_active_list, list) {				if (!pkt->sleep_time)					continue;				pkt->sleep_time -= min_sleep_time - residue;				if (pkt->sleep_time <= 0) {					pkt->sleep_time = 0;					atomic_inc(&pkt->run_sm);				}			}			if (signal_pending(current)) {				flush_signals(current);			}			if (kthread_should_stop())				break;		}work_to_do:		set_current_state(TASK_RUNNING);		remove_wait_queue(&pd->wqueue, &wait);		if (kthread_should_stop())			break;		/*		 * if pkt_handle_queue returns true, we can queue		 * another request.		 */		while (pkt_handle_queue(pd))			;		/*		 * Handle packet state machine		 */		pkt_handle_packets(pd);		/*		 * Handle iosched queues		 */		pkt_iosched_process_queue(pd);	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/3e1d1d28d99dabe63c64f7f40f1ca1d646de1f73/pktcdvd.c/clean/drivers/block/pktcdvd.c