Commit c04e456f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Use request_list as indicator that req originated from ll_rw_blk

From: Mike Christie <michaelc@cs.wisc.edu>,
      Jens Axboe <axboe@suse.de>

It's cleaner and more correct to look at req->rl to determine whether this
request got from the block layer requests lists instead of using req->q.
It's handy to always have req->q available, to lookup the queue from the
request.
parent a7d9a66e
......@@ -165,6 +165,7 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where,
if (plug)
blk_plug_device(q);
rq->q = q;
q->elevator.elevator_add_req_fn(q, rq, where);
}
......
......@@ -1834,8 +1834,6 @@ void __blk_put_request(request_queue_t *q, struct request *req)
if (unlikely(--req->ref_count))
return;
elv_completed_request(req->q, req);
req->rq_status = RQ_INACTIVE;
req->q = NULL;
req->rl = NULL;
......@@ -1847,6 +1845,8 @@ void __blk_put_request(request_queue_t *q, struct request *req)
if (rl) {
int rw = rq_data_dir(req);
elv_completed_request(q, req);
BUG_ON(!list_empty(&req->queuelist));
blk_free_request(q, req);
......@@ -1856,14 +1856,13 @@ void __blk_put_request(request_queue_t *q, struct request *req)
void blk_put_request(struct request *req)
{
request_queue_t *q = req->q;
/*
* if req->q isn't set, this request didnt originate from the
* if req->rl isn't set, this request didnt originate from the
* block layer, so it's safe to just disregard it
*/
if (q) {
if (req->rl) {
unsigned long flags;
request_queue_t *q = req->q;
spin_lock_irqsave(q->queue_lock, flags);
__blk_put_request(q, req);
......
......@@ -541,7 +541,7 @@ static inline void blkdev_dequeue_request(struct request *req)
list_del_init(&req->queuelist);
if (req->q)
if (req->rl)
elv_remove_request(req->q, req);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment