aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorJens Axboe <jaxboe@fusionio.com>2011-03-30 03:52:30 -0400
committerJens Axboe <jaxboe@fusionio.com>2011-04-05 17:51:37 -0400
commitb710a480554f2be682bac3cb59b0e085ba3d644b (patch)
treebd1b9d5080bca2b35c861ddbc98d4116445bebfb /block
parent8182924bc5850281985d73c312876746acd390b5 (diff)
block: get rid of elv_insert() interface
Merge it with __elv_add_request(), it's pretty pointless to have a function with only two callers. The main interface is elv_add_request()/__elv_add_request(). Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-flush.c4
-rw-r--r--block/elevator.c35
2 files changed, 17 insertions, 22 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 93d5fd8e51eb..d6275cbbaf35 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -261,7 +261,7 @@ static bool blk_kick_flush(struct request_queue *q)
261 q->flush_rq.end_io = flush_end_io; 261 q->flush_rq.end_io = flush_end_io;
262 262
263 q->flush_pending_idx ^= 1; 263 q->flush_pending_idx ^= 1;
264 elv_insert(q, &q->flush_rq, ELEVATOR_INSERT_REQUEUE); 264 __elv_add_request(q, &q->flush_rq, ELEVATOR_INSERT_REQUEUE);
265 return true; 265 return true;
266} 266}
267 267
@@ -281,7 +281,7 @@ static void flush_data_end_io(struct request *rq, int error)
281 * blk_insert_flush - insert a new FLUSH/FUA request 281 * blk_insert_flush - insert a new FLUSH/FUA request
282 * @rq: request to insert 282 * @rq: request to insert
283 * 283 *
284 * To be called from elv_insert() for %ELEVATOR_INSERT_FLUSH insertions. 284 * To be called from __elv_add_request() for %ELEVATOR_INSERT_FLUSH insertions.
285 * @rq is being submitted. Analyze what needs to be done and put it on the 285 * @rq is being submitted. Analyze what needs to be done and put it on the
286 * right queue. 286 * right queue.
287 * 287 *
diff --git a/block/elevator.c b/block/elevator.c
index c387d3168734..0cdb4e7ebab4 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -610,7 +610,7 @@ void elv_requeue_request(struct request_queue *q, struct request *rq)
610 610
611 rq->cmd_flags &= ~REQ_STARTED; 611 rq->cmd_flags &= ~REQ_STARTED;
612 612
613 elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE); 613 __elv_add_request(q, rq, ELEVATOR_INSERT_REQUEUE);
614} 614}
615 615
616void elv_drain_elevator(struct request_queue *q) 616void elv_drain_elevator(struct request_queue *q)
@@ -655,12 +655,25 @@ void elv_quiesce_end(struct request_queue *q)
655 queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q); 655 queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q);
656} 656}
657 657
658void elv_insert(struct request_queue *q, struct request *rq, int where) 658void __elv_add_request(struct request_queue *q, struct request *rq, int where)
659{ 659{
660 trace_block_rq_insert(q, rq); 660 trace_block_rq_insert(q, rq);
661 661
662 rq->q = q; 662 rq->q = q;
663 663
664 BUG_ON(rq->cmd_flags & REQ_ON_PLUG);
665
666 if (rq->cmd_flags & REQ_SOFTBARRIER) {
667 /* barriers are scheduling boundary, update end_sector */
668 if (rq->cmd_type == REQ_TYPE_FS ||
669 (rq->cmd_flags & REQ_DISCARD)) {
670 q->end_sector = rq_end_sector(rq);
671 q->boundary_rq = rq;
672 }
673 } else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
674 where == ELEVATOR_INSERT_SORT)
675 where = ELEVATOR_INSERT_BACK;
676
664 switch (where) { 677 switch (where) {
665 case ELEVATOR_INSERT_REQUEUE: 678 case ELEVATOR_INSERT_REQUEUE:
666 case ELEVATOR_INSERT_FRONT: 679 case ELEVATOR_INSERT_FRONT:
@@ -722,24 +735,6 @@ void elv_insert(struct request_queue *q, struct request *rq, int where)
722 BUG(); 735 BUG();
723 } 736 }
724} 737}
725
726void __elv_add_request(struct request_queue *q, struct request *rq, int where)
727{
728 BUG_ON(rq->cmd_flags & REQ_ON_PLUG);
729
730 if (rq->cmd_flags & REQ_SOFTBARRIER) {
731 /* barriers are scheduling boundary, update end_sector */
732 if (rq->cmd_type == REQ_TYPE_FS ||
733 (rq->cmd_flags & REQ_DISCARD)) {
734 q->end_sector = rq_end_sector(rq);
735 q->boundary_rq = rq;
736 }
737 } else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
738 where == ELEVATOR_INSERT_SORT)
739 where = ELEVATOR_INSERT_BACK;
740
741 elv_insert(q, rq, where);
742}
743EXPORT_SYMBOL(__elv_add_request); 738EXPORT_SYMBOL(__elv_add_request);
744 739
745void elv_add_request(struct request_queue *q, struct request *rq, int where) 740void elv_add_request(struct request_queue *q, struct request *rq, int where)