Commit 4736346b authored by Geliang Tang's avatar Geliang Tang Committed by Jens Axboe

elevator: use list_{first,prev,next}_entry

To make the intention clearer, use list_{first,prev,next}_entry
instead of list_entry.
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent d09f9581
...@@ -21,10 +21,10 @@ static void noop_merged_requests(struct request_queue *q, struct request *rq, ...@@ -21,10 +21,10 @@ static void noop_merged_requests(struct request_queue *q, struct request *rq,
static int noop_dispatch(struct request_queue *q, int force) static int noop_dispatch(struct request_queue *q, int force)
{ {
struct noop_data *nd = q->elevator->elevator_data; struct noop_data *nd = q->elevator->elevator_data;
struct request *rq;
if (!list_empty(&nd->queue)) { rq = list_first_entry_or_null(&nd->queue, struct request, queuelist);
struct request *rq; if (rq) {
rq = list_entry(nd->queue.next, struct request, queuelist);
list_del_init(&rq->queuelist); list_del_init(&rq->queuelist);
elv_dispatch_sort(q, rq); elv_dispatch_sort(q, rq);
return 1; return 1;
...@@ -46,7 +46,7 @@ noop_former_request(struct request_queue *q, struct request *rq) ...@@ -46,7 +46,7 @@ noop_former_request(struct request_queue *q, struct request *rq)
if (rq->queuelist.prev == &nd->queue) if (rq->queuelist.prev == &nd->queue)
return NULL; return NULL;
return list_entry(rq->queuelist.prev, struct request, queuelist); return list_prev_entry(rq, queuelist);
} }
static struct request * static struct request *
...@@ -56,7 +56,7 @@ noop_latter_request(struct request_queue *q, struct request *rq) ...@@ -56,7 +56,7 @@ noop_latter_request(struct request_queue *q, struct request *rq)
if (rq->queuelist.next == &nd->queue) if (rq->queuelist.next == &nd->queue)
return NULL; return NULL;
return list_entry(rq->queuelist.next, struct request, queuelist); return list_next_entry(rq, queuelist);
} }
static int noop_init_queue(struct request_queue *q, struct elevator_type *e) static int noop_init_queue(struct request_queue *q, struct elevator_type *e)
......
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