BUG_ON(pkt->frames > PACKET_MAX_SIZE); 
static int pkt_handle_queue(struct pktcdvd_device *pd){	struct packet_data *pkt, *p;	struct bio *bio = NULL;	sector_t zone = 0; /* Suppress gcc warning */	struct pkt_rb_node *node, *first_node;	struct rb_node *n;	VPRINTK("handle_queue\n");	atomic_set(&pd->scan_queue, 0);	if (list_empty(&pd->cdrw.pkt_free_list)) {		VPRINTK("handle_queue: no pkt\n");		return 0;	}	/*	 * Try to find a zone we are not already working on.	 */	spin_lock(&pd->lock);	first_node = pkt_rbtree_find(pd, pd->current_sector);	if (!first_node) {		n = rb_first(&pd->bio_queue);		if (n)			first_node = rb_entry(n, struct pkt_rb_node, rb_node);	}	node = first_node;	while (node) {		bio = node->bio;		zone = ZONE(bio->bi_sector, pd);		list_for_each_entry(p, &pd->cdrw.pkt_active_list, list) {			if (p->sector == zone) {				bio = NULL;				goto try_next_bio;			}		}		break;try_next_bio:		node = pkt_rbtree_next(node);		if (!node) {			n = rb_first(&pd->bio_queue);			if (n)				node = rb_entry(n, struct pkt_rb_node, rb_node);		}		if (node == first_node)			node = NULL;	}	spin_unlock(&pd->lock);	if (!bio) {		VPRINTK("handle_queue: no bio\n");		return 0;	}	pkt = pkt_get_packet_data(pd, zone);	BUG_ON(!pkt);	pd->current_sector = zone + pd->settings.size;	pkt->sector = zone;	pkt->frames = pd->settings.size >> 2;	BUG_ON(pkt->frames > PACKET_MAX_SIZE);	pkt->write_size = 0;	/*	 * Scan work queue for bios in the same zone and link them	 * to this packet.	 */	spin_lock(&pd->lock);	VPRINTK("pkt_handle_queue: looking for zone %llx\n", (unsigned long long)zone);	while ((node = pkt_rbtree_find(pd, zone)) != NULL) {		bio = node->bio;		VPRINTK("pkt_handle_queue: found zone=%llx\n",			(unsigned long long)ZONE(bio->bi_sector, pd));		if (ZONE(bio->bi_sector, pd) != zone)			break;		pkt_rbtree_erase(pd, node);		spin_lock(&pkt->lock);		pkt_add_list_last(bio, &pkt->orig_bios, &pkt->orig_bios_tail);		pkt->write_size += bio->bi_size / CD_FRAMESIZE;		spin_unlock(&pkt->lock);	}	spin_unlock(&pd->lock);	pkt->sleep_time = max(PACKET_WAIT_TIME, 1);	pkt_set_state(pkt, PACKET_WAITING_STATE);	atomic_set(&pkt->run_sm, 1);	spin_lock(&pd->cdrw.active_list_lock);	list_add(&pkt->list, &pd->cdrw.pkt_active_list);	spin_unlock(&pd->cdrw.active_list_lock);	return 1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d0272e78eee4dc53c887fd132e9035daf037d423/pktcdvd.c/buggy/drivers/block/pktcdvd.c