blktrace: don't stop tracer if not setup trace successfully
[blktrace.git] / btt / trace_issue.c
index 8b1571ac7f94439fecc2c40f287c14fe33863798..976fe1c3736f2065944c95a3de60a17a406ddad6 100644 (file)
@@ -25,33 +25,49 @@ static void handle_issue(struct io *d_iop)
        LIST_HEAD(head);
        struct list_head *p, *q;
 
+       if (d_iop->dip->n_act_q != 0)
+               d_iop->dip->n_act_q--;
+
        seeki_add(d_iop->dip->seek_handle, d_iop);
        bno_dump_add(d_iop->dip->bno_dump_handle, d_iop);
        iostat_issue(d_iop);
        d_iop->dip->n_ds++;
        if (!remapper_dev(d_iop->t.device))
                update_d_histo(d_iop->t.bytes);
+       aqd_issue(d_iop->dip->aqd_handle, BIT_TIME(d_iop->t.time));
 
        dip_foreach_list(d_iop, IOP_Q, &head);
        list_for_each_safe(p, q, &head) {
                struct io *q_iop = list_entry(p, struct io, f_head);
-               
-               update_i2d(q_iop, tdelta(q_iop->gm_time, d_iop->t.time));
+
+               if (q_iop->i_time != (__u64)-1)
+                       update_i2d(q_iop, tdelta(q_iop->i_time, d_iop->t.time));
+               else if (q_iop->m_time != (__u64)-1)
+                       update_m2d(q_iop, tdelta(q_iop->m_time, d_iop->t.time));
+
                d_iop->bytes_left -= q_iop->t.bytes;
-               LIST_DEL(&q_iop->f_head);
+               list_del(&q_iop->f_head);
 
                q_iop->d_time = d_iop->t.time;
                q_iop->d_sec = d_iop->t.sector;
                q_iop->d_nsec = t_sec(&d_iop->t);
-       }
 
-       assert(d_iop->bytes_left == 0);
+               if (output_all_data)
+                       q2d_histo_add(q_iop->dip->q2d_priv,
+                                               d_iop->t.time - q_iop->t.time);
+               latency_q2d(q_iop->dip, d_iop->t.time, 
+                                               d_iop->t.time - q_iop->t.time);
+       }
 }
 
 void trace_issue(struct io *d_iop)
 {
+       if (d_iop->t.bytes == 0)
+               return;
+
        if (io_setup(d_iop, IOP_D))
                handle_issue(d_iop);
+
        io_release(d_iop);
 
 }