Commit 3ba0f211 authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] uninline elv_next_request()

Uninline elv_next_request() and move it to elevator.c, where it belongs.
Because of CURRENT declaration, this actually saves lots of space.  From
Andrew.
parent 1856a951
...@@ -388,11 +388,43 @@ void __elv_add_request(request_queue_t *q, struct request *rq, ...@@ -388,11 +388,43 @@ void __elv_add_request(request_queue_t *q, struct request *rq,
q->elevator.elevator_add_req_fn(q, rq, insert_here); q->elevator.elevator_add_req_fn(q, rq, insert_here);
} }
struct request *__elv_next_request(request_queue_t *q) static inline struct request *__elv_next_request(request_queue_t *q)
{ {
return q->elevator.elevator_next_req_fn(q); return q->elevator.elevator_next_req_fn(q);
} }
struct request *elv_next_request(request_queue_t *q)
{
struct request *rq;
while ((rq = __elv_next_request(q))) {
rq->flags |= REQ_STARTED;
if (&rq->queuelist == q->last_merge)
q->last_merge = NULL;
if ((rq->flags & REQ_DONTPREP) || !q->prep_rq_fn)
break;
/*
* all ok, break and return it
*/
if (!q->prep_rq_fn(q, rq))
break;
/*
* prep said no-go, kill it
*/
blkdev_dequeue_request(rq);
if (end_that_request_first(rq, 0, rq->nr_sectors))
BUG();
end_that_request_last(rq);
}
return rq;
}
void elv_remove_request(request_queue_t *q, struct request *rq) void elv_remove_request(request_queue_t *q, struct request *rq)
{ {
elevator_t *e = &q->elevator; elevator_t *e = &q->elevator;
...@@ -423,7 +455,7 @@ EXPORT_SYMBOL(elevator_linus); ...@@ -423,7 +455,7 @@ EXPORT_SYMBOL(elevator_linus);
EXPORT_SYMBOL(elevator_noop); EXPORT_SYMBOL(elevator_noop);
EXPORT_SYMBOL(__elv_add_request); EXPORT_SYMBOL(__elv_add_request);
EXPORT_SYMBOL(__elv_next_request); EXPORT_SYMBOL(elv_next_request);
EXPORT_SYMBOL(elv_remove_request); EXPORT_SYMBOL(elv_remove_request);
EXPORT_SYMBOL(elevator_exit); EXPORT_SYMBOL(elevator_exit);
EXPORT_SYMBOL(elevator_init); EXPORT_SYMBOL(elevator_init);
...@@ -40,6 +40,7 @@ void initrd_init(void); ...@@ -40,6 +40,7 @@ void initrd_init(void);
extern int end_that_request_first(struct request *, int, int); extern int end_that_request_first(struct request *, int, int);
extern void end_that_request_last(struct request *); extern void end_that_request_last(struct request *);
struct request *elv_next_request(request_queue_t *q);
static inline void blkdev_dequeue_request(struct request *req) static inline void blkdev_dequeue_request(struct request *req)
{ {
...@@ -49,38 +50,6 @@ static inline void blkdev_dequeue_request(struct request *req) ...@@ -49,38 +50,6 @@ static inline void blkdev_dequeue_request(struct request *req)
elv_remove_request(req->q, req); elv_remove_request(req->q, req);
} }
extern inline struct request *elv_next_request(request_queue_t *q)
{
struct request *rq;
while ((rq = __elv_next_request(q))) {
rq->flags |= REQ_STARTED;
if (&rq->queuelist == q->last_merge)
q->last_merge = NULL;
if ((rq->flags & REQ_DONTPREP) || !q->prep_rq_fn)
break;
/*
* all ok, break and return it
*/
if (!q->prep_rq_fn(q, rq))
break;
/*
* prep said no-go, kill it
*/
blkdev_dequeue_request(rq);
if (end_that_request_first(rq, 0, rq->nr_sectors))
BUG();
end_that_request_last(rq);
}
return rq;
}
#define _elv_add_request_core(q, rq, where, plug) \ #define _elv_add_request_core(q, rq, where, plug) \
do { \ do { \
if ((plug)) \ if ((plug)) \
......
...@@ -40,7 +40,6 @@ struct elevator_s ...@@ -40,7 +40,6 @@ struct elevator_s
*/ */
extern void __elv_add_request(request_queue_t *, struct request *, extern void __elv_add_request(request_queue_t *, struct request *,
struct list_head *); struct list_head *);
extern struct request *__elv_next_request(request_queue_t *);
extern void elv_merge_cleanup(request_queue_t *, struct request *, int); extern void elv_merge_cleanup(request_queue_t *, struct request *, int);
extern int elv_merge(request_queue_t *, struct request **, struct bio *); extern int elv_merge(request_queue_t *, struct request **, struct bio *);
extern void elv_merge_requests(request_queue_t *, struct request *, extern void elv_merge_requests(request_queue_t *, struct request *,
......
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