BUG_ON(!node); 
static int pkt_make_request(request_queue_t *q, struct bio *bio){	struct pktcdvd_device *pd;	char b[BDEVNAME_SIZE];	sector_t zone;	struct packet_data *pkt;	int was_empty, blocked_bio;	struct pkt_rb_node *node;	pd = q->queuedata;	if (!pd) {		printk("pktcdvd: %s incorrect request queue\n", bdevname(bio->bi_bdev, b));		goto end_io;	}	/*	 * Clone READ bios so we can have our own bi_end_io callback.	 */	if (bio_data_dir(bio) == READ) {		struct bio *cloned_bio = bio_clone(bio, GFP_NOIO);		struct packet_stacked_data *psd = mempool_alloc(psd_pool, GFP_NOIO);		psd->pd = pd;		psd->bio = bio;		cloned_bio->bi_bdev = pd->bdev;		cloned_bio->bi_private = psd;		cloned_bio->bi_end_io = pkt_end_io_read_cloned;		pd->stats.secs_r += bio->bi_size >> 9;		pkt_queue_bio(pd, cloned_bio);		return 0;	}	if (!test_bit(PACKET_WRITABLE, &pd->flags)) {		printk("pktcdvd: WRITE for ro device %s (%llu)\n",			pd->name, (unsigned long long)bio->bi_sector);		goto end_io;	}	if (!bio->bi_size || (bio->bi_size % CD_FRAMESIZE)) {		printk("pktcdvd: wrong bio size\n");		goto end_io;	}	blk_queue_bounce(q, &bio);	zone = ZONE(bio->bi_sector, pd);	VPRINTK("pkt_make_request: start = %6llx stop = %6llx\n",		(unsigned long long)bio->bi_sector,		(unsigned long long)(bio->bi_sector + bio_sectors(bio)));	/* Check if we have to split the bio */	{		struct bio_pair *bp;		sector_t last_zone;		int first_sectors;		last_zone = ZONE(bio->bi_sector + bio_sectors(bio) - 1, pd);		if (last_zone != zone) {			BUG_ON(last_zone != zone + pd->settings.size);			first_sectors = last_zone - bio->bi_sector;			bp = bio_split(bio, bio_split_pool, first_sectors);			BUG_ON(!bp);			pkt_make_request(q, &bp->bio1);			pkt_make_request(q, &bp->bio2);			bio_pair_release(bp);			return 0;		}	}	/*	 * If we find a matching packet in state WAITING or READ_WAIT, we can	 * just append this bio to that packet.	 */	spin_lock(&pd->cdrw.active_list_lock);	blocked_bio = 0;	list_for_each_entry(pkt, &pd->cdrw.pkt_active_list, list) {		if (pkt->sector == zone) {			spin_lock(&pkt->lock);			if ((pkt->state == PACKET_WAITING_STATE) ||			    (pkt->state == PACKET_READ_WAIT_STATE)) {				pkt_add_list_last(bio, &pkt->orig_bios,						  &pkt->orig_bios_tail);				pkt->write_size += bio->bi_size / CD_FRAMESIZE;				if ((pkt->write_size >= pkt->frames) &&				    (pkt->state == PACKET_WAITING_STATE)) {					atomic_inc(&pkt->run_sm);					wake_up(&pd->wqueue);				}				spin_unlock(&pkt->lock);				spin_unlock(&pd->cdrw.active_list_lock);				return 0;			} else {				blocked_bio = 1;			}			spin_unlock(&pkt->lock);		}	}	spin_unlock(&pd->cdrw.active_list_lock);	/*	 * No matching packet found. Store the bio in the work queue.	 */	node = mempool_alloc(pd->rb_pool, GFP_NOIO);	BUG_ON(!node);	node->bio = bio;	spin_lock(&pd->lock);	BUG_ON(pd->bio_queue_size < 0);	was_empty = (pd->bio_queue_size == 0);	pkt_rbtree_insert(pd, node);	spin_unlock(&pd->lock);	/*	 * Wake up the worker thread.	 */	atomic_set(&pd->scan_queue, 1);	if (was_empty) {		/* This wake_up is required for correct operation */		wake_up(&pd->wqueue);	} else if (!list_empty(&pd->cdrw.pkt_free_list) && !blocked_bio) {		/*		 * This wake up is not required for correct operation,		 * but improves performance in some cases.		 */		wake_up(&pd->wqueue);	}	return 0;end_io:	bio_io_error(bio, bio->bi_size);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/610827dee82731c7be5a135d750d194ac56881a9/pktcdvd.c/buggy/drivers/block/pktcdvd.c