[PATCH] elevator: move the backmerging logic into the elevator core
Right now, every IO scheduler implements its own backmerging (except for noop, which does no merging). That results in duplicated code for essentially the same operation, which is never a good thing. This patch moves the backmerging out of the io schedulers and into the elevator core. We save 1.6kb of text and as a bonus get backmerging for noop as well. Win-win! Signed-off-by: Jens Axboe <axboe@suse.de>
This commit is contained in:
parent
4aff5e2333
commit
9817064b68
7 changed files with 146 additions and 375 deletions
|
@ -229,6 +229,8 @@ struct request {
|
|||
struct bio *bio;
|
||||
struct bio *biotail;
|
||||
|
||||
struct hlist_node hash; /* merge hash */
|
||||
|
||||
void *elevator_private;
|
||||
void *completion_data;
|
||||
|
||||
|
@ -696,21 +698,6 @@ static inline void blkdev_dequeue_request(struct request *req)
|
|||
elv_dequeue_request(req->q, req);
|
||||
}
|
||||
|
||||
/*
|
||||
* This should be in elevator.h, but that requires pulling in rq and q
|
||||
*/
|
||||
static inline void elv_dispatch_add_tail(struct request_queue *q,
|
||||
struct request *rq)
|
||||
{
|
||||
if (q->last_merge == rq)
|
||||
q->last_merge = NULL;
|
||||
q->nr_sorted--;
|
||||
|
||||
q->end_sector = rq_end_sector(rq);
|
||||
q->boundary_rq = rq;
|
||||
list_add_tail(&rq->queuelist, &q->queue_head);
|
||||
}
|
||||
|
||||
/*
|
||||
* Access functions for manipulating queue properties
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue