From 461afe819c41fa811f9c6264524cb8edbd2acc63 Mon Sep 17 00:00:00 2001 From: Dave Boutcher Date: Thu, 3 Jan 2008 10:21:32 -0500 Subject: [PATCH] Fix Q counts during requeue and merges. It looks to me like btt doesn't correctly keep track of the number of requests currently in the queue for a device. n_act_q gets incremented in trace_queue and decremented in trace_issue, but I think it also needs to get updated in trace_merge and trace_requeue. The one thing I'm not sure about is whether we want r_iop->dip->n_qs++ in the new handle_requeue routine. The following patch makes the "active requests at Q" count a little more sane for me. This is against git as of yesterday. Signed-off-by: Alan D. Brunelle --- btt/trace_im.c | 3 +++ btt/trace_requeue.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/btt/trace_im.c b/btt/trace_im.c index c30b4ec..b1d1560 100644 --- a/btt/trace_im.c +++ b/btt/trace_im.c @@ -51,6 +51,9 @@ static void handle_m(struct io *m_iop) q_iop->m_time = m_iop->t.time; update_q2m(q_iop, tdelta(q_iop->t.time, m_iop->t.time)); } + + if (m_iop->dip->n_act_q != 0) + m_iop->dip->n_act_q--; } void trace_getrq(struct io *g_iop) diff --git a/btt/trace_requeue.c b/btt/trace_requeue.c index db5f7b7..f1324d9 100644 --- a/btt/trace_requeue.c +++ b/btt/trace_requeue.c @@ -20,7 +20,16 @@ */ #include "globals.h" +static void handle_requeue(struct io *r_iop) +{ + r_iop->dip->n_qs++; + r_iop->dip->t_act_q += r_iop->dip->n_act_q; + r_iop->dip->n_act_q++; +} + void trace_requeue(struct io *r_iop) { + if (io_setup(r_iop, IOP_R)) + handle_requeue(r_iop); io_release(r_iop); } -- 2.25.1