Skip to content

Commit

Permalink
s390/scm_blk: fix request number accounting
Browse files Browse the repository at this point in the history
If a block device driver cannot fetch all requests from the blocklayer
it's in his responsibility to call the request function at a later time.
Normally this would be done after the next irq for the underlying device
is handled. However in situations where we have no outstanding request
we have to schedule the request function for a later time.

This is determined using an internal counter of requests issued to the
hardware.

In some cases where we give a request back to the block layer unhandled
the number of queued requests was not adjusted. Fix this class of
failures by adjusting queued_requests in all functions used to give
a request back to the block layer.

Reviewed-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Sebastian Ott authored and Martin Schwidefsky committed Mar 7, 2013
1 parent f6a70a0 commit 8360cb5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/s390/block/scm_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,18 @@ void scm_request_requeue(struct scm_request *scmrq)

scm_release_cluster(scmrq);
blk_requeue_request(bdev->rq, scmrq->request);
atomic_dec(&bdev->queued_reqs);
scm_request_done(scmrq);
scm_ensure_queue_restart(bdev);
}

void scm_request_finish(struct scm_request *scmrq)
{
struct scm_blk_dev *bdev = scmrq->bdev;

scm_release_cluster(scmrq);
blk_end_request_all(scmrq->request, scmrq->error);
atomic_dec(&bdev->queued_reqs);
scm_request_done(scmrq);
}

Expand Down Expand Up @@ -231,11 +235,13 @@ static void scm_blk_request(struct request_queue *rq)
return;
}
if (scm_need_cluster_request(scmrq)) {
atomic_inc(&bdev->queued_reqs);
blk_start_request(req);
scm_initiate_cluster_request(scmrq);
return;
}
scm_request_prepare(scmrq);
atomic_inc(&bdev->queued_reqs);
blk_start_request(req);

ret = scm_start_aob(scmrq->aob);
Expand All @@ -244,7 +250,6 @@ static void scm_blk_request(struct request_queue *rq)
scm_request_requeue(scmrq);
return;
}
atomic_inc(&bdev->queued_reqs);
}
}

Expand Down Expand Up @@ -310,7 +315,6 @@ static void scm_blk_tasklet(struct scm_blk_dev *bdev)
}

scm_request_finish(scmrq);
atomic_dec(&bdev->queued_reqs);
spin_lock_irqsave(&bdev->lock, flags);
}
spin_unlock_irqrestore(&bdev->lock, flags);
Expand Down

0 comments on commit 8360cb5

Please sign in to comment.