Skip to content

Commit

Permalink
block: row: Add some debug information on ROW queues
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tatyana Brokhman authored and Daz Jones committed Oct 12, 2013
1 parent cd983db commit 3df28e9
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions block/row-iosched.c
@@ -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
Expand Down Expand Up @@ -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
*
*/
Expand All @@ -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;
};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]) {
Expand All @@ -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);
}

/**
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)]--;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -583,6 +606,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)]--;
}
Expand Down

0 comments on commit 3df28e9

Please sign in to comment.