spin_lock(q->queue_lock);
rq = elv_next_request(q);
+ if (rq)
+ blkdev_dequeue_request(rq);
spin_unlock(q->queue_lock);
if (!rq)
ret = __mbox_msg_send(mbox, tx_data->msg, tx_data->arg);
if (ret) {
enable_mbox_irq(mbox, IRQ_TX);
+ spin_lock(q->queue_lock);
+ blk_requeue_request(q, rq);
+ spin_unlock(q->queue_lock);
return;
}
while (1) {
spin_lock_irqsave(q->queue_lock, flags);
rq = elv_next_request(q);
+ if (rq)
+ blkdev_dequeue_request(rq);
spin_unlock_irqrestore(q->queue_lock, flags);
if (!rq)
break;
while (1) {
spin_lock_irqsave(q->queue_lock, flags);
rq = elv_next_request(q);
+ if (rq)
+ blkdev_dequeue_request(rq);
spin_unlock_irqrestore(q->queue_lock, flags);
if (!rq)
del_timer(&fd_timeout);
cont = NULL;
clear_bit(0, &fdc_busy);
- if (elv_next_request(floppy_queue))
+ if (current_req || elv_next_request(floppy_queue))
do_fd_request(floppy_queue);
spin_unlock_irqrestore(&floppy_lock, flags);
wake_up(&fdc_wait);
spin_lock_irq(floppy_queue->queue_lock);
req = elv_next_request(floppy_queue);
+ if (req)
+ blkdev_dequeue_request(req);
spin_unlock_irq(floppy_queue->queue_lock);
if (!req) {
do_floppy = NULL;
while ((req = elv_next_request(rq)) != NULL) {
info = req->rq_disk->private_data;
- if (!blk_fs_request(req)) {
- __blk_end_request_cur(req, -EIO);
- continue;
- }
if (RING_FULL(&info->ring))
goto wait;
+ blkdev_dequeue_request(req);
+
+ if (!blk_fs_request(req)) {
+ __blk_end_request_all(req, -EIO);
+ continue;
+ }
+
pr_debug("do_blk_req %p: cmd %p, sec %lx, "
"(%u/%u) buffer:%p [%s]\n",
req, req->cmd, (unsigned long)blk_rq_pos(req),
blk_rq_cur_sectors(req), blk_rq_sectors(req),
req->buffer, rq_data_dir(req) ? "write" : "read");
-
- blkdev_dequeue_request(req);
if (blkif_queue_request(req)) {
blk_requeue_request(rq, req);
wait:
struct request *req;
while ((rwreq == 0) && ((req = elv_next_request(q)) != NULL)) {
+ blkdev_dequeue_request(req);
+
if (!blk_fs_request(req))
__blk_end_request_all(req, -EIO);
else if (send_request(req) < 0) {
msb->req_sg);
if (!msb->seg_count) {
- chunk = __blk_end_request(msb->block_req, -ENOMEM,
- blk_rq_cur_bytes(msb->block_req));
+ chunk = __blk_end_request_cur(msb->block_req, -ENOMEM);
continue;
}
dev_dbg(&card->dev, "issue end\n");
return -EAGAIN;
}
+ blkdev_dequeue_request(msb->block_req);
dev_dbg(&card->dev, "trying again\n");
chunk = 1;
return;
if (msb->eject) {
- while ((req = elv_next_request(q)) != NULL)
+ while ((req = elv_next_request(q)) != NULL) {
+ blkdev_dequeue_request(req);
__blk_end_request_all(req, -ENODEV);
+ }
return;
}
blk_stop_queue(q);
break;
}
- } else
- __blk_end_request_cur(req, -EIO);
+ } else {
+ blkdev_dequeue_request(req);
+ __blk_end_request_all(req, -EIO);
+ }
}
};
spin_lock_irq(q->queue_lock);
set_current_state(TASK_INTERRUPTIBLE);
- if (!blk_queue_plugged(q))
+ if (!blk_queue_plugged(q)) {
req = elv_next_request(q);
+ if (req)
+ blkdev_dequeue_request(req);
+ }
mq->req = req;
spin_unlock_irq(q->queue_lock);
{
struct mmc_queue *mq = q->queuedata;
struct request *req;
- int ret;
if (!mq) {
printk(KERN_ERR "MMC: killing requests for dead queue\n");
while ((req = elv_next_request(q)) != NULL) {
- do {
- ret = __blk_end_request(req, -EIO,
- blk_rq_cur_bytes(req));
- } while (ret);
+ blkdev_dequeue_request(req);
+ __blk_end_request_all(req, -EIO);
}
return;
}