aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorJerome Marchand <jmarchan@redhat.com>2009-04-22 08:01:49 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-04-24 02:54:21 -0400
commit42dad7647aec49b3ad20dd0cb832b232a6ae514f (patch)
treeb70d4cb7706f2647e65426e24f078ddf14d6e139 /block/blk-core.c
parent097102c2d04974bdfcfa16a5f3062d499842139c (diff)
block: simplify I/O stat accounting
This simplifies I/O stat accounting switching code and separates it completely from I/O scheduler switch code. Requests are accounted according to the state of their request queue at the time of the request allocation. There is no need anymore to flush the request queue when switching I/O accounting state. Signed-off-by: Jerome Marchand <jmarchan@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 07ab75403e1a..2998fe3a2377 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -643,7 +643,7 @@ static inline void blk_free_request(struct request_queue *q, struct request *rq)
643} 643}
644 644
645static struct request * 645static struct request *
646blk_alloc_request(struct request_queue *q, int rw, int priv, gfp_t gfp_mask) 646blk_alloc_request(struct request_queue *q, int flags, int priv, gfp_t gfp_mask)
647{ 647{
648 struct request *rq = mempool_alloc(q->rq.rq_pool, gfp_mask); 648 struct request *rq = mempool_alloc(q->rq.rq_pool, gfp_mask);
649 649
@@ -652,7 +652,7 @@ blk_alloc_request(struct request_queue *q, int rw, int priv, gfp_t gfp_mask)
652 652
653 blk_rq_init(q, rq); 653 blk_rq_init(q, rq);
654 654
655 rq->cmd_flags = rw | REQ_ALLOCED; 655 rq->cmd_flags = flags | REQ_ALLOCED;
656 656
657 if (priv) { 657 if (priv) {
658 if (unlikely(elv_set_request(q, rq, gfp_mask))) { 658 if (unlikely(elv_set_request(q, rq, gfp_mask))) {
@@ -792,6 +792,8 @@ static struct request *get_request(struct request_queue *q, int rw_flags,
792 if (priv) 792 if (priv)
793 rl->elvpriv++; 793 rl->elvpriv++;
794 794
795 if (blk_queue_io_stat(q))
796 rw_flags |= REQ_IO_STAT;
795 spin_unlock_irq(q->queue_lock); 797 spin_unlock_irq(q->queue_lock);
796 798
797 rq = blk_alloc_request(q, rw_flags, priv, gfp_mask); 799 rq = blk_alloc_request(q, rw_flags, priv, gfp_mask);