UNPLUG does the timing stuff, UNPLUG TIMEOUT only does timeout
authorAlan D. Brunelle <alan.brunelle@hp.com>
Thu, 31 Jan 2008 22:10:52 +0000 (17:10 -0500)
committerAlan D. Brunelle <alan.brunelle@hp.com>
Thu, 31 Jan 2008 22:10:52 +0000 (17:10 -0500)
Each UNPLUG TIMEOUT should be followed by an UNPLUG, so we were getting
double information on time outs.

btt/devs.c
btt/globals.h
btt/output.c
btt/trace_plug.c

index 6a0fcfc5ebf5fd83a8239b97c3f75b74a5fd5cd0..61dd4277c9ba400ad4f836641bb3d1163dd67948 100644 (file)
@@ -264,15 +264,21 @@ void dip_plug(__u32 dev, double cur_time)
        dip->last_plug = cur_time;
 }
 
-void dip_unplug(__u32 dev, double cur_time, int is_timer)
+void dip_unplug(__u32 dev, double cur_time)
 {
        struct d_info *dip = __dip_find(dev);
 
-       if (!dip || !dip->is_plugged) return;
+       if (dip && dip->is_plugged) {
+               dip->nplugs++;
+               dip->plugged_time += (cur_time - dip->last_plug);
+               dip->is_plugged = 0;
+       }
+}
 
-       dip->nplugs++;
-       if (is_timer) dip->n_timer_unplugs++;
+void dip_unplug_tm(__u32 dev)
+{
+       struct d_info *dip = __dip_find(dev);
 
-       dip->plugged_time += (cur_time - dip->last_plug);
-       dip->is_plugged = 0;
+       if (dip && dip->is_plugged)
+               dip->n_timer_unplugs++;
 }
index 4176fb41b8a3236aaaa97cb0d969d2bbf8957181..163986bb4192bf22eed7ea6d82dffc88971930dc 100644 (file)
@@ -247,7 +247,8 @@ void dip_foreach(struct io *iop, enum iop_type type,
 struct io *dip_find_sec(struct d_info *dip, enum iop_type type, __u64 sec);
 void dip_foreach_out(void (*func)(struct d_info *, void *), void *arg);
 void dip_plug(__u32 dev, double cur_time);
-void dip_unplug(__u32 dev, double cur_time, int is_timer);
+void dip_unplug(__u32 dev, double cur_time);
+void dip_unplug_tm(__u32 dev);
 void dip_exit(void);
 
 /* dip_rb.c */
index 33a9a738e78fd3fc4e75144cec9f36e6668e4e3c..fd22a9eca4fbb56dbd36f743f7f9c40486e7b4fa 100644 (file)
@@ -525,7 +525,7 @@ void __dip_output_plug(struct d_info *dip, void *arg)
        double delta, pct;
 
        if (dip->nplugs > 0) {
-               if (dip->is_plugged) dip_unplug(dip->device, dip->end_time, 0);
+               if (dip->is_plugged) dip_unplug(dip->device, dip->end_time);
                delta = dip->end_time - dip->start_time;
                pct = 100.0 * ((dip->plugged_time / delta) / delta);
 
index 06d9fc9564a93819eff1200abe7e19aee99f6704..03076d7cf4011b8a149b0ddbabd8d8320946cfcd 100644 (file)
  */
 #include "globals.h"
 
-static inline void trace_unplug(struct io *u_iop, int is_timer)
+void trace_unplug_io(struct io *u_iop)
 {
        unplug_hist_add(u_iop);
-       dip_unplug(u_iop->t.device, BIT_TIME(u_iop->t.time), is_timer);
+       dip_unplug(u_iop->t.device, BIT_TIME(u_iop->t.time));
        io_release(u_iop);
 }
 
-void trace_unplug_io(struct io *u_iop)
-{
-       trace_unplug(u_iop, 0);
-}
-
-void trace_unplug_timer(struct io *u_iop)
+void trace_unplug_timer(struct io *ut_iop)
 {
-       trace_unplug(u_iop, 1);
+       dip_unplug_tm(ut_iop->t.device);
+       io_release(ut_iop);
 }
 
 void trace_plug(struct io *p_iop)