/* Mark the request as complete. The lock must not be held when entering.  */
static void i2o_block_end_request(struct request *req, int error, int nr_bytes)
/* Mark the request as complete. The lock must not be held when entering.  */
static void i2o_block_end_request(struct request *req, int error, int nr_bytes)
{
	struct i2o_block_request *ireq = req->special;
	struct i2o_block_device *dev = ireq->i2o_blk_dev;
	struct request_queue *q = req->q;
	unsigned long flags;
	if (blk_end_request(req, error, nr_bytes))
		if (error)
			blk_end_request_all(req, -EIO);
	spin_lock_irqsave(q->queue_lock, flags);
	if (likely(dev)) {
		dev->open_queue_depth--;
		list_del(&ireq->queue);
	}
	blk_start_queue(q);
	spin_unlock_irqrestore(q->queue_lock, flags);
	i2o_block_sglist_free(ireq);
	i2o_block_request_free(ireq);
}