path: root/btt
diff options
authorDave Boutcher <>2008-01-03 10:21:32 -0500
committerAlan D. Brunelle <adb@bannor.(none)>2008-01-03 10:21:32 -0500
commit461afe819c41fa811f9c6264524cb8edbd2acc63 (patch)
tree3be614c8339093d499dee0cb43aa7e8b01ca8c97 /btt
parentae6d30f4475181d685d1f33faf056755803f189b (diff)
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 <>
Diffstat (limited to 'btt')
2 files changed, 12 insertions, 0 deletions
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);