blkdev_dequeue_request(req); 
static void scsi_request_fn(struct request_queue *q){	struct scsi_device *sdev = q->queuedata;	struct Scsi_Host *shost;	struct scsi_cmnd *cmd;	struct request *req;	if (!sdev) {		printk("scsi: killing requests for dead queue\n");		while ((req = elv_next_request(q)) != NULL)			scsi_kill_request(req, q);		return;	}	if(!get_device(&sdev->sdev_gendev))		/* We must be tearing the block queue down already */		return;	/*	 * To start with, we keep looping until the queue is empty, or until	 * the host is no longer able to accept any more requests.	 */	shost = sdev->host;	while (!blk_queue_plugged(q)) {		int rtn;		/*		 * get next queueable request.  We do this early to make sure		 * that the request is fully prepared even if we cannot 		 * accept it.		 */		req = elv_next_request(q);		if (!req || !scsi_dev_queue_ready(q, sdev))			break;		if (unlikely(!scsi_device_online(sdev))) {			printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n",			       sdev->host->host_no, sdev->id, sdev->lun);			blkdev_dequeue_request(req);			scsi_kill_request(req, q);			continue;		}		/*		 * Remove the request from the request list.		 */		if (!(blk_queue_tagged(q) && !blk_queue_start_tag(q, req)))			blkdev_dequeue_request(req);		sdev->device_busy++;		spin_unlock(q->queue_lock);		cmd = req->special;		if (unlikely(cmd == NULL)) {			printk(KERN_CRIT "impossible request in %s.\n"					 "please mail a stack trace to "					 "linux-scsi@vger.kernel.org",					 __FUNCTION__);			BUG();		}		spin_lock(shost->host_lock);		if (!scsi_host_queue_ready(q, shost, sdev))			goto not_ready;		if (sdev->single_lun) {			if (scsi_target(sdev)->starget_sdev_user &&			    scsi_target(sdev)->starget_sdev_user != sdev)				goto not_ready;			scsi_target(sdev)->starget_sdev_user = sdev;		}		shost->host_busy++;		/*		 * XXX(hch): This is rather suboptimal, scsi_dispatch_cmd will		 *		take the lock again.		 */		spin_unlock_irq(shost->host_lock);		/*		 * Finally, initialize any error handling parameters, and set up		 * the timers for timeouts.		 */		scsi_init_cmd_errh(cmd);		/*		 * Dispatch the command to the low-level driver.		 */		rtn = scsi_dispatch_cmd(cmd);		spin_lock_irq(q->queue_lock);		if(rtn) {			/* we're refusing the command; because of			 * the way locks get dropped, we need to 			 * check here if plugging is required */			if(sdev->device_busy == 0)				blk_plug_device(q);			break;		}	}	goto out; not_ready:	spin_unlock_irq(shost->host_lock);	/*	 * lock q, handle tag, requeue req, and decrement device_busy. We	 * must return with queue_lock held.	 *	 * Decrementing device_busy without checking it is OK, as all such	 * cases (host limits or settings) should run the queue at some	 * later time.	 */	scsi_unprep_request(req);	spin_lock_irq(q->queue_lock);	blk_requeue_request(q, req);	sdev->device_busy--;	if(sdev->device_busy == 0)		blk_plug_device(q); out:	/* must be careful here...if we trigger the ->remove() function	 * we cannot be holding the q lock */	spin_unlock_irq(q->queue_lock);	put_device(&sdev->sdev_gendev);	spin_lock_irq(q->queue_lock);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/788ce43aa1ad7158f894b6bb3df8ba2f63794c20/scsi_lib.c/buggy/drivers/scsi/scsi_lib.c