block: row: Add some debug information on ROW queues

1. Add a counter for number of requests on queue.
2. Add function to print queues status (number requests
   currently on queue and number of already dispatched requests
   in current dispatch cycle).

Change-Id: I1e98b9ca33853e6e6a8ddc53240f6cd6981e6024
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
This commit is contained in:
Tatyana Brokhman 2013-01-13 22:04:59 +02:00 committed by Stephen Boyd
parent e19f0d6b12
commit 98e48591e3
1 changed files with 30 additions and 6 deletions

View File

@ -1,7 +1,7 @@
/*
* ROW (Read Over Write) I/O scheduler.
*
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -104,6 +104,7 @@ struct rowq_idling_data {
* @nr_dispatched: number of requests already dispatched in
* the current dispatch cycle
* @slice: number of requests to dispatch in a cycle
* @nr_req: number of requests in queue
* @idle_data: data for idling on queues
*
*/
@ -115,6 +116,8 @@ struct row_queue {
unsigned int nr_dispatched;
unsigned int slice;
unsigned int nr_req;
/* used only for READ queues */
struct rowq_idling_data idle_data;
};
@ -191,6 +194,19 @@ static inline int row_rowq_unserved(struct row_data *rd,
return rd->cycle_flags & (1 << qnum);
}
static inline void __maybe_unused row_dump_queues_stat(struct row_data *rd)
{
int i;
row_log(rd->dispatch_queue, " Queues status (curr_queue=%d):",
rd->curr_queue);
for (i = 0; i < ROWQ_MAX_PRIO; i++)
row_log(rd->dispatch_queue,
"queue%d: dispatched= %d, nr_req=%d", i,
rd->row_queues[i].nr_dispatched,
rd->row_queues[i].nr_req);
}
/******************** Static helper functions ***********************/
/*
* kick_queue() - Wake up device driver queue thread
@ -264,6 +280,7 @@ static void row_add_request(struct request_queue *q,
list_add_tail(&rq->queuelist, &rqueue->fifo);
rd->nr_reqs[rq_data_dir(rq)]++;
rqueue->nr_req++;
rq_set_fifo_time(rq, jiffies); /* for statistics*/
if (queue_idling_enabled[rqueue->prio]) {
@ -285,10 +302,11 @@ static void row_add_request(struct request_queue *q,
if (urgent_queues[rqueue->prio] &&
row_rowq_unserved(rd, rqueue->prio)) {
row_log_rowq(rd, rqueue->prio,
"added urgent req curr_queue = %d",
rd->curr_queue);
"added urgent request (total on queue=%d)",
rqueue->nr_req);
} else
row_log_rowq(rd, rqueue->prio, "added request");
row_log_rowq(rd, rqueue->prio,
"added request (total on queue=%d)", rqueue->nr_req);
}
/**
@ -317,8 +335,10 @@ static int row_reinsert_req(struct request_queue *q,
list_add(&rq->queuelist, &rqueue->fifo);
rd->nr_reqs[rq_data_dir(rq)]++;
rqueue->nr_req++;
row_log_rowq(rd, rqueue->prio, "request reinserted");
row_log_rowq(rd, rqueue->prio,
"request reinserted (total on queue=%d)", rqueue->nr_req);
return 0;
}
@ -355,8 +375,10 @@ static void row_remove_request(struct request_queue *q,
struct request *rq)
{
struct row_data *rd = (struct row_data *)q->elevator->elevator_data;
struct row_queue *rqueue = RQ_ROWQ(rq);
rq_fifo_clear(rq);
rqueue->nr_req--;
rd->nr_reqs[rq_data_dir(rq)]--;
}
@ -438,7 +460,8 @@ static int row_dispatch_requests(struct request_queue *q, int force)
if (row_rowq_unserved(rd, i) &&
!list_empty(&rd->row_queues[i].rqueue.fifo)) {
row_log_rowq(rd, currq,
" Preemting for unserved rowq%d", i);
" Preemting for unserved rowq%d. (nr_req=%u)",
i, rd->row_queues[currq].rqueue.nr_req);
rd->curr_queue = i;
row_dispatch_insert(rd);
ret = 1;
@ -584,6 +607,7 @@ static void row_merged_requests(struct request_queue *q, struct request *rq,
struct row_queue *rqueue = RQ_ROWQ(next);
list_del_init(&next->queuelist);
rqueue->nr_req--;
rqueue->rdata->nr_reqs[rq_data_dir(rq)]--;
}