Cleanups: Fixed IOPs in btt left over at end of run
authorAlan D. Brunelle <alan.brunelle@hp.com>
Wed, 13 Feb 2008 16:46:22 +0000 (11:46 -0500)
committerAlan D. Brunelle <alan.brunelle@hp.com>
Wed, 13 Feb 2008 16:47:22 +0000 (11:47 -0500)
o  Using valgrind, determined we had Q IOPs left over that weren't
   used. Added "all" list, and then deleted these at end.

o  Removed old debug stuff (COUNT_IOS, DEBUG, ...)

o  Fixed a bunch of white space at end of lines.

Signed-off-by: Alan D. Brunelle <alan.brunelle@hp.com>
19 files changed:
btt/Makefile
btt/args.c
btt/bno_dump.c
btt/bt_timeline.c
btt/devs.c
btt/dip_rb.c
btt/globals.h
btt/inlines.h
btt/iostat.c
btt/misc.c
btt/mmap.c
btt/output.c
btt/proc.c
btt/seek.c
btt/trace.c
btt/trace_complete.c
btt/trace_issue.c
btt/trace_queue.c
btt/unplug_hist.c

index 094f77f8fde2a79ee14ee2c69dd1e99b305c0b18..a6b078ec6489cd36c04826cf9713e7914da53a80 100644 (file)
@@ -8,9 +8,8 @@
 CC     = gcc
 CFLAGS = -Wall -W -O2 -g
 INCS   = -I. -I..
-OCFLAGS        = -UCOUNT_IOS -UDEBUG -DNDEBUG
 XCFLAGS        = -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-override CFLAGS += $(INCS) $(XCFLAGS) $(OCFLAGS)
+override CFLAGS += $(INCS) $(XCFLAGS)
 
 PROGS  = btt
 LIBS   = $(PLIBS) $(ELIBS)
index 9e918c9524fac6cf070bc2ced7194572f0020fad..5930f14ba60683ab088658affdede21a10ab4544 100644 (file)
@@ -205,7 +205,6 @@ static FILE *setup_ofile(char *fname)
                }
 
                buf = malloc(SETBUFFER_SIZE);
-               assert(buf);
 
                setbuffer(ofp, buf, SETBUFFER_SIZE);
                add_file(&arg_files, ofp, fname);
index d1bc6abdef4520f06ac8752f1d82eceb1e791a84..1f5433b16701565a74a3b0914a731d137e607323 100644 (file)
@@ -69,7 +69,7 @@ void bno_dump_exit(void *param)
 static inline void bno_dump_write(FILE *fp, struct io *iop)
 {
        fprintf(fp, "%15.9lf %lld %lld\n",
-               BIT_TIME(iop->t.time), 
+               BIT_TIME(iop->t.time),
                (long long)BIT_START(iop), (long long)BIT_END(iop));
 }
 
index 17a1b23de2cad716d20c513a58676e058856b43d..30b1e6e8d07e592aebf7406cb26f5a4b1c7cade6 100644 (file)
@@ -38,6 +38,7 @@ unsigned int n_devs;
 time_t genesis, last_vtrace;
 LIST_HEAD(all_devs);
 LIST_HEAD(all_procs);
+LIST_HEAD(all_ios);
 LIST_HEAD(free_ios);
 LIST_HEAD(free_bilinks);
 __u64 q_histo[N_HIST_BKTS], d_histo[N_HIST_BKTS];
@@ -50,15 +51,6 @@ struct region_info all_regions = {
        .cranges = LIST_HEAD_INIT(all_regions.cranges),
 };
 
-#if defined(DEBUG)
-       int rb_tree_size;
-#endif
-
-#if defined(COUNT_IOS)
-unsigned long nios_reused, nios_alloced, nios_freed;
-LIST_HEAD(cios);
-#endif
-
 int process(void);
 
 int main(int argc, char *argv[])
@@ -75,9 +67,9 @@ int main(int argc, char *argv[])
                iostat_dump_stats(iostat_last_stamp, 1);
        }
 
-       if (ranges_ofp != stdout) 
+       if (ranges_ofp != stdout)
                fclose(ranges_ofp);
-       if (avgs_ofp != stdout) 
+       if (avgs_ofp != stdout)
                fclose(avgs_ofp);
 
        seek_clean();
@@ -121,40 +113,13 @@ int process(void)
 
        if (verbose) {
                double tps, dt_input = tv2dbl(&tve) - tv2dbl(&tvs);
-               
+
                tps = (double)n_traces / dt_input;
                printf("\r                                        "
                       "                                        \r");
                printf("%10lu traces @ %.1lf Ktps in %.6lf seconds\n",
                        n_traces, tps/1000.0,
                        dt_input);
-
-#              if defined(DEBUG)
-                       printf("\ttree = |%d|\n", rb_tree_size);
-                       if (rb_tree_size > 0)
-                               dump_rb_trees();
-#              endif
-
-#              if defined(COUNT_IOS)
-                       {
-                               struct io *_iop;
-                               struct list_head *_p;
-                               FILE *_ofp = fopen("cios.txt", "w");
-                               printf("(%ld + %ld) = %ld - %ld = %ld\n", 
-                                       nios_alloced, nios_reused, 
-                                       nios_alloced + nios_reused, 
-                                       nios_freed, 
-                                       (nios_alloced + nios_reused) 
-                                                               - nios_freed);
-
-                               __list_for_each(_p, &cios) {
-                                       _iop = list_entry(_p, struct io, 
-                                                               cio_head);
-                                       __dump_iop(_ofp, _iop, 0);
-                               }
-                               fclose(_ofp);
-                       }
-#              endif
        }
 
        return ret;
index 38007d1e50d67e3fa7bdff150605a1dec97b057c..3cf7a6c480f0eeb5ac4a3ce652a342f6ccddbb10 100644 (file)
@@ -52,50 +52,6 @@ static void __destroy_heads(struct rb_root *roots)
        free(roots);
 }
 
-#if defined(DEBUG)
-void __dump_rb_node(struct rb_node *n)
-{
-       struct io *iop = rb_entry(n, struct io, rb_node);
-
-       dbg_ping();
-       __dump_iop(stdout, iop, 0);
-       if (n->rb_left)
-               __dump_rb_node(n->rb_left);
-       if (n->rb_right)
-               __dump_rb_node(n->rb_right);
-}
-
-void __dump_rb_tree(struct d_info *dip, enum iop_type type)
-{
-       struct rb_root *roots = dip->heads;
-       struct rb_root *root = &roots[type];
-       struct rb_node *n = root->rb_node;
-
-       if (n) {
-               printf("\tIOP_%c\n", type2c(type));
-               __dump_rb_node(n);
-       }
-}
-
-void dump_rb_trees(void)
-{
-       int i;
-       enum iop_type type;
-       struct d_info *dip;
-       struct list_head *p;
-
-       for (i = 0; i < N_DEV_HASH; i++) {
-               __list_for_each(p, &dev_heads[i]) {
-                       dip = list_entry(p, struct d_info, hash_head);
-                       printf("Trees for %3d,%-3d\n", MAJOR(dip->device),
-                              MINOR(dip->device));
-                       for (type = IOP_Q; type < N_IOP_TYPES; type++)
-                               __dump_rb_tree(dip, type);
-               }
-       }
-}
-#endif
-
 void init_dev_heads(void)
 {
        int i;
@@ -184,11 +140,6 @@ struct d_info *dip_add(__u32 device, struct io *iop)
        iop->linked = dip_rb_ins(dip, iop);
        dip->end_time = BIT_TIME(iop->t.time);
 
-#      if defined(DEBUG)
-               if (iop->linked) 
-                       rb_tree_size++;
-#      endif
-
        return dip;
 }
 
@@ -200,7 +151,7 @@ void dip_rem(struct io *iop)
        }
 }
 
-void dip_foreach(struct io *iop, enum iop_type type, 
+void dip_foreach(struct io *iop, enum iop_type type,
                 void (*fnc)(struct io *iop, struct io *this), int rm_after)
 {
        if (rm_after) {
@@ -211,7 +162,7 @@ void dip_foreach(struct io *iop, enum iop_type type,
                dip_rb_fe(iop->dip, type, iop, fnc, &head);
                list_for_each_safe(p, q, &head) {
                        this = list_entry(p, struct io, f_head);
-                       LIST_DEL(&this->f_head);
+                       list_del(&this->f_head);
                        io_release(this);
                }
        }
@@ -244,10 +195,7 @@ void dip_foreach_out(void (*func)(struct d_info *, void *), void *arg)
 
                while (p && ((i = sscanf(p, "%u,%u", &mjr, &mnr)) == 2)) {
                        dip = __dip_find((__u32)((mjr << MINORBITS) | mnr));
-                       ASSERT(dip);
-
                        func(dip, arg);
-
                        p = strchr(p, ';');
                        if (p) p++;
                }
index 13861c7be94e08259d79df72a83d8cb1dbfb1668..867a97bd999773ffe1301e7a7ae45772cfc0ed6e 100644 (file)
@@ -28,7 +28,6 @@ int rb_insert(struct rb_root *root, struct io *iop)
        struct rb_node **p = &root->rb_node;
        __u64 __s, s = BIT_START(iop);
 
-       ASSERT(root != NULL && iop != NULL);
        while (*p) {
                parent = *p;
                __iop = rb_entry(parent, struct io, rb_node);
@@ -65,7 +64,7 @@ struct io *rb_find_sec(struct rb_root *root, __u64 sec)
        return NULL;
 }
 
-void rb_foreach(struct rb_node *n, struct io *iop, 
+void rb_foreach(struct rb_node *n, struct io *iop,
                      void (*fnc)(struct io *iop, struct io *this),
                      struct list_head *head)
 {
@@ -76,10 +75,8 @@ void rb_foreach(struct rb_node *n, struct io *iop,
 
                if ((iop_s <= this_s) && (this_e <= iop_e)) {
                        if (fnc) fnc(iop, this);
-                       if (head) {
-                               ASSERT(this->f_head.next == LIST_POISON1);
+                       if (head)
                                list_add_tail(&this->f_head, head);
-                       }
                }
                if (iop_s < this_s)
                        rb_foreach(n->rb_left, iop, fnc, head);
index 486a3fc9580801ef1516ed38e583aace3324da74..52fb8b0332d169b7c37f88aaecc039882a63265e 100644 (file)
@@ -18,7 +18,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-#include <assert.h>
 #include <stdio.h>
 #include <string.h>
 #include <time.h>
 #define TO_SEC(nanosec)        ((double)(nanosec) / 1.0e9)
 #define TO_MSEC(nanosec) (1000.0 * TO_SEC(nanosec))
 
-#if defined(DEBUG)
-#define DBG_PING()     dbg_ping()
-#define ASSERT(truth)   do {                                           \
-                               if (!(truth)) {                         \
-                                       DBG_PING();                     \
-                                       assert(truth);                  \
-                               }                                       \
-                       } while (0)
-
-
-#define LIST_DEL(hp)   list_del(hp)
-#else
-#define ASSERT(truth)
-#define DBG_PING()
-#define LIST_DEL(hp)   do {                                            \
-                               ASSERT((hp)->next != NULL);             \
-                               ASSERT(!list_empty(hp));                \
-                               list_del(hp);                           \
-                       } while (0)
-#endif
-
 enum iop_type {
        IOP_Q = 0,
        IOP_X = 1,
@@ -182,7 +160,7 @@ struct d_info {
 
 struct io {
        struct rb_node rb_node;
-       struct list_head f_head;
+       struct list_head f_head, a_head;
        struct d_info *dip;
        struct p_info *pip;
        void *pdu;
@@ -193,10 +171,6 @@ struct io {
 
        int linked;
        enum iop_type type;
-
-#if defined(COUNT_IOS)
-       struct list_head cio_head;
-#endif
 };
 
 /* bt_timeline.c */
@@ -213,18 +187,11 @@ extern struct list_head all_devs, all_procs;
 extern struct avgs_info all_avgs;
 extern __u64 last_q;
 extern struct region_info all_regions;
-extern struct list_head free_ios;
+extern struct list_head all_ios, free_ios;
 extern __u64 iostat_interval, iostat_last_stamp;
 extern time_t genesis, last_vtrace;
 extern double t_astart, t_aend;
 extern __u64 q_histo[N_HIST_BKTS], d_histo[N_HIST_BKTS];
-#if defined(DEBUG)
-extern int rb_tree_size;
-#endif
-#if defined(COUNT_IOS)
-extern unsigned long nios_reused, nios_alloced, nios_freed;
-extern struct list_head cios;
-#endif
 
 /* args.c */
 void handle_args(int argc, char *argv[]);
@@ -236,15 +203,12 @@ struct devmap *dev_map_find(__u32 device);
 void dev_map_exit(void);
 
 /* devs.c */
-#if defined(DEBUG)
-void dump_rb_trees(void);
-#endif
 void init_dev_heads(void);
 struct d_info *dip_add(__u32 device, struct io *iop);
 void dip_rem(struct io *iop);
 struct d_info *__dip_find(__u32 device);
 void dip_foreach_list(struct io *iop, enum iop_type type, struct list_head *hd);
-void dip_foreach(struct io *iop, enum iop_type type, 
+void dip_foreach(struct io *iop, enum iop_type type,
                 void (*fnc)(struct io *iop, struct io *this), int rm_after);
 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);
@@ -256,7 +220,7 @@ void dip_exit(void);
 /* dip_rb.c */
 int rb_insert(struct rb_root *root, struct io *iop);
 struct io *rb_find_sec(struct rb_root *root, __u64 sec);
-void rb_foreach(struct rb_node *n, struct io *iop, 
+void rb_foreach(struct rb_node *n, struct io *iop,
                      void (*fnc)(struct io *iop, struct io *this),
                      struct list_head *head);
 
index 875b75b2f70a4f2e69c9b55f7711c44b61740c48..3e7a17e5cbaa59988f4234bcebc563c50d59d758 100644 (file)
@@ -133,49 +133,18 @@ static inline void dip_update_q(struct d_info *dip, struct io *iop)
 
 static inline struct io *io_alloc(void)
 {
-       struct io *iop;
-
-       if (!list_empty(&free_ios)) {
-               iop = list_entry(free_ios.prev, struct io, f_head);
-               LIST_DEL(&iop->f_head);
-
-#              if defined(COUNT_IOS)
-                       nios_reused++;
-#              endif
-       }
-       else {
-               iop = malloc(sizeof(struct io));
-
-#              if defined(COUNT_IOS)
-                       nios_alloced++;
-#              endif
-       }
+       struct io *iop = malloc(sizeof(*iop));
 
        memset(iop, 0, sizeof(struct io));
-
-#      if defined(DEBUG)
-               iop->f_head.next = LIST_POISON1;
-#      endif
-
-#      if defined(COUNT_IOS)
-               list_add_tail(&iop->cio_head, &cios);
-#      endif
+       list_add_tail(&iop->a_head, &all_ios);
 
        return iop;
 }
 
 static inline void io_free(struct io *iop)
 {
-#      if defined(COUNT_IOS)
-               nios_freed++;
-               LIST_DEL(&iop->cio_head);
-#      endif
-
-#      if defined(DEBUG)
-               memset(iop, 0, sizeof(*iop));
-#      endif
-
-       list_add_tail(&iop->f_head, &free_ios);
+       list_del(&iop->a_head);
+       free(iop);
 }
 
 static inline void io_free_all(void)
@@ -183,8 +152,8 @@ static inline void io_free_all(void)
        struct io *iop;
        struct list_head *p, *q;
 
-       list_for_each_safe(p, q, &free_ios) {
-               iop = list_entry(p, struct io, f_head);
+       list_for_each_safe(p, q, &all_ios) {
+               iop = list_entry(p, struct io, a_head);
                free(iop);
        }
 }
@@ -203,11 +172,9 @@ static inline int io_setup(struct io *iop, enum iop_type type)
 
 static inline void io_release(struct io *iop)
 {
-       ASSERT(iop->f_head.next == LIST_POISON1);
-
        if (iop->linked)
                dip_rem(iop);
-       if (iop->pdu) 
+       if (iop->pdu)
                free(iop->pdu);
 
        io_free(iop);
@@ -233,10 +200,6 @@ static inline void io_release(struct io *iop)
 
 static inline void update_q2c(struct io *iop, __u64 c_time)
 {
-#      if defined(DEBUG)
-               if (per_io_ofp) 
-                       fprintf(per_io_ofp, "q2c %13.9f\n", BIT_TIME(c_time));
-#      endif
        if (remapper_dev(iop->dip->device))
                UPDATE_AVGS(q2c_dm, iop, iop->pip, c_time);
        else
@@ -245,10 +208,6 @@ static inline void update_q2c(struct io *iop, __u64 c_time)
 
 static inline void update_q2a(struct io *iop, __u64 a_time)
 {
-#      if defined(DEBUG)
-               if (per_io_ofp) 
-                       fprintf(per_io_ofp, "q2a %13.9f\n", BIT_TIME(a_time));
-#      endif
        if (remapper_dev(iop->dip->device))
                UPDATE_AVGS(q2a_dm, iop, iop->pip, a_time);
        else
@@ -257,11 +216,6 @@ static inline void update_q2a(struct io *iop, __u64 a_time)
 
 static inline void update_q2g(struct io *iop, __u64 g_time)
 {
-#      if defined(DEBUG)
-               if (per_io_ofp) 
-                       fprintf(per_io_ofp, "q2g %13.9f\n", BIT_TIME(g_time));
-#      endif
-
        UPDATE_AVGS(q2g, iop, iop->pip, g_time);
 }
 
@@ -272,11 +226,6 @@ static inline void unupdate_q2g(struct io *iop, __u64 g_time)
 
 static inline void update_g2i(struct io *iop, __u64 i_time)
 {
-#      if defined(DEBUG)
-               if (per_io_ofp) 
-                       fprintf(per_io_ofp, "g2i %13.9f\n", BIT_TIME(i_time));
-#      endif
-
        UPDATE_AVGS(g2i, iop, iop->pip, i_time);
 }
 
@@ -287,11 +236,6 @@ static inline void unupdate_g2i(struct io *iop, __u64 i_time)
 
 static inline void update_q2m(struct io *iop, __u64 m_time)
 {
-#      if defined(DEBUG)
-               if (per_io_ofp) 
-                       fprintf(per_io_ofp, "q2m %13.9f\n", BIT_TIME(m_time));
-#      endif
-
        UPDATE_AVGS(q2m, iop, iop->pip, m_time);
 }
 
@@ -302,11 +246,6 @@ static inline void unupdate_q2m(struct io *iop, __u64 m_time)
 
 static inline void update_i2d(struct io *iop, __u64 d_time)
 {
-#      if defined(DEBUG)
-               if (per_io_ofp) 
-                       fprintf(per_io_ofp, "i2d %13.9f\n", BIT_TIME(d_time));
-#      endif
-
        UPDATE_AVGS(i2d, iop, iop->pip, d_time);
 }
 
@@ -317,11 +256,6 @@ static inline void unupdate_i2d(struct io *iop, __u64 d_time)
 
 static inline void update_m2d(struct io *iop, __u64 d_time)
 {
-#      if defined(DEBUG)
-               if (per_io_ofp) 
-                       fprintf(per_io_ofp, "m2d %13.9f\n", BIT_TIME(d_time));
-#      endif
-
        UPDATE_AVGS(m2d, iop, iop->pip, d_time);
 }
 
@@ -332,11 +266,6 @@ static inline void unupdate_m2d(struct io *iop, __u64 d_time)
 
 static inline void update_d2c(struct io *iop, __u64 c_time)
 {
-#      if defined(DEBUG)
-               if (per_io_ofp) 
-                       fprintf(per_io_ofp, "d2c %13.9f\n", BIT_TIME(c_time));
-#      endif
-
        UPDATE_AVGS(d2c, iop, iop->pip, c_time);
 }
 
@@ -344,7 +273,6 @@ static inline void update_blks(struct io *iop)
 {
        __u64 nblks = iop->t.bytes >> 9;
        avg_update(&all_avgs.blks, nblks);
-       ASSERT(iop->dip != NULL);
        avg_update(&iop->dip->avgs.blks, nblks);
        if (iop->pip)
                avg_update(&iop->pip->avgs.blks, nblks);
@@ -364,21 +292,17 @@ static inline int dip_rb_ins(struct d_info *dip, struct io *iop)
 static inline void dip_rb_rem(struct io *iop)
 {
        rb_erase(&iop->rb_node, __get_root(iop->dip, iop->type));
-
-#      if defined(DEBUG)
-               rb_tree_size--;
-#      endif
 }
 
-static inline void dip_rb_fe(struct d_info *dip, enum iop_type type, 
-                            struct io *iop, 
-                            void (*fnc)(struct io *iop, struct io *this), 
+static inline void dip_rb_fe(struct d_info *dip, enum iop_type type,
+                            struct io *iop,
+                            void (*fnc)(struct io *iop, struct io *this),
                             struct list_head *head)
 {
        rb_foreach(__get_root(dip, type)->rb_node, iop, fnc, head);
 }
 
-static inline struct io *dip_rb_find_sec(struct d_info *dip, 
+static inline struct io *dip_rb_find_sec(struct d_info *dip,
                                         enum iop_type type, __u64 sec)
 {
        return rb_find_sec(__get_root(dip, type), sec);
@@ -448,8 +372,8 @@ static inline void __dump_iop2(FILE *ofp, struct io *a_iop, struct io *l_iop)
        fprintf(ofp, "%5d.%09lu %3d,%-3d %c %10llu+%-4u <- (%3d,%-3d) %10llu\n",
                (int)SECONDS(a_iop->t.time),
                (unsigned long)NANO_SECONDS(a_iop->t.time),
-               MAJOR(a_iop->t.device), MINOR(a_iop->t.device), 
-               type2c(a_iop->type), (unsigned long long)a_iop->t.sector, 
-               t_sec(&a_iop->t), MAJOR(l_iop->t.device), 
+               MAJOR(a_iop->t.device), MINOR(a_iop->t.device),
+               type2c(a_iop->type), (unsigned long long)a_iop->t.sector,
+               t_sec(&a_iop->t), MAJOR(l_iop->t.device),
                MINOR(l_iop->t.device), (unsigned long long)l_iop->t.sector);
 }
index e920c804f4362454fdc85485f58bbb5fd3217ab2..c4ddcb47700a76a684c3922d2c54767d983bcc64 100644 (file)
@@ -81,7 +81,7 @@ void update_idle_time(struct d_info *dip, double now, int force)
 {
        if (dip->stats.cur_dev == 0 || force) {
                dip->stats.idle_time += (now - dip->stats.last_dev_change);
-               dip->all_stats.idle_time += 
+               dip->all_stats.idle_time +=
                                       (now - dip->all_stats.last_dev_change);
        }
        dip->stats.last_dev_change = dip->all_stats.last_dev_change = now;
index 24ade813d4bad62d75c79e0c9ef77ee3f5aed81e..4e721fc2691c026070152c411dfabd4fec0db17e 100644 (file)
@@ -37,8 +37,6 @@ int in_devices(struct blk_io_trace *t)
 
        for (;;) {
                i = sscanf(p, "%u,%u;", &mjr, &mnr);
-               ASSERT(i == 2);
-
                if ((mjr == MAJOR(t->device) && (mnr == MINOR(t->device))))
                        return 1;
 
@@ -101,5 +99,5 @@ void clean_bufs(void)
                free(bip);
        }
 }
-       
+
 void dbg_ping(void) {}
index 3718817823779f8cede33b8f3ab3a9e2dc0c2077..60d4900951a6f66eaa75674021cd50e4d3cc6b79 100644 (file)
@@ -24,7 +24,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <assert.h>
 #include <sys/mman.h>
 #include <string.h>
 
@@ -43,8 +42,8 @@ int data_is_native = -1;
 
 static inline size_t min_len(size_t a, size_t b) { return a < b ? a : b; }
 
-static inline size_t convert_to_cpu(struct blk_io_trace *t, 
-                                    struct blk_io_trace *tp, 
+static inline size_t convert_to_cpu(struct blk_io_trace *t,
+                                    struct blk_io_trace *tp,
                                    void **pdu)
 {
        if (data_is_native == -1)
@@ -66,9 +65,6 @@ static inline size_t convert_to_cpu(struct blk_io_trace *t,
                tp->pdu_len     = be16_to_cpu(t->pdu_len);
        }
 
-       assert(CHECK_MAGIC(tp));
-       assert((tp->magic & 0xff) == SUPPORTED_VERSION);
-
        if (tp->pdu_len) {
                *pdu = malloc(tp->pdu_len);
                memcpy(*pdu, t+1, tp->pdu_len);
index e652bbd4fc9fefc6232f1d62eadb7ae0b8c257d5..a3c887f5a240318088010a7692f0688811ce6ea8 100644 (file)
@@ -349,7 +349,6 @@ void output_seek_mode_info(FILE *ofp, struct o_seek_info *sip)
 {
        struct seek_mode_info *p, *this, *new_list = NULL;
 
-       ASSERT(sip->head != NULL);
        while ((this = sip->head) != NULL) {
                sip->head = this->next;
                this->next = NULL;
@@ -357,7 +356,6 @@ void output_seek_mode_info(FILE *ofp, struct o_seek_info *sip)
                if (new_list == NULL || this->nseeks > new_list->nseeks)
                        new_list = this;
                else if (this->nseeks == new_list->nseeks) {
-                       assert(this->nseeks == new_list->nseeks);
                        for (p = new_list; p != NULL; p = p->next)
                                if (p->mode == this->mode)
                                        break;
index 5818db469799e2c0e92a93f7ade67a4627f46f65..55f8e13a4502de068ebbd4587ca0caf49720a734 100644 (file)
@@ -103,10 +103,8 @@ static void insert_pid(struct p_info *that, __u32 pid)
                        p = &(*p)->rb_left;
                else if (pid > this->u.pid)
                        p = &(*p)->rb_right;
-               else {
-                       ASSERT(strcmp(that->name, this->pip->name) == 0);
+               else
                        return; // Already there
-               }
        }
 
        this = malloc(sizeof(struct pn_info));
@@ -181,7 +179,7 @@ struct p_info *find_process(__u32 pid, char *name)
 
                /*
                 * We're here because we have a pid, and no name, but
-                * we didn't find a process ... 
+                * we didn't find a process ...
                 *
                 * We'll craft one using the pid...
                 */
@@ -192,7 +190,6 @@ struct p_info *find_process(__u32 pid, char *name)
                return __find_process_pid(pid);
        }
 
-       assert(name != NULL);
        return __find_process_name(name);
 }
 
@@ -215,10 +212,10 @@ void pip_update_q(struct io *iop)
 {
        if (iop->pip) {
                if (remapper_dev(iop->dip->device))
-                       update_lq(&iop->pip->last_q, &iop->pip->avgs.q2q_dm, 
+                       update_lq(&iop->pip->last_q, &iop->pip->avgs.q2q_dm,
                                                                iop->t.time);
                else
-                       update_lq(&iop->pip->last_q, &iop->pip->avgs.q2q, 
+                       update_lq(&iop->pip->last_q, &iop->pip->avgs.q2q,
                                                                iop->t.time);
                update_qregion(&iop->pip->regions, iop->t.time);
        }
index cbbd1a32cc3b7dc17b19ddca4a41b1c5816b4d84..a5ba84b9a4209551b68a4fd13d7b9a3c3d1b5e08 100644 (file)
@@ -176,7 +176,7 @@ double seeki_mean(void *handle)
        return sip->total_sectors / sip->tot_seeks;
 }
 
-int __median(struct rb_node *n, long long sofar, long long target, long 
+int __median(struct rb_node *n, long long sofar, long long target, long
                   long *rvp)
 {
        struct seek_bkt *sbp;
@@ -203,7 +203,7 @@ long long seeki_median(void *handle)
        struct seeki *sip = handle;
 
        if (sip->root.rb_node)
-               (void)__median(sip->root.rb_node, 0LL, sip->tot_seeks / 2, 
+               (void)__median(sip->root.rb_node, 0LL, sip->tot_seeks / 2,
                               &rval);
 
        return rval;
@@ -224,7 +224,7 @@ void __mode(struct rb_node *n, struct mode *mp)
        else if (sbp->nseeks > mp->most_seeks)
                mp->nmds = 0;
        else if (sbp->nseeks == mp->most_seeks)
-               mp->modes = realloc(mp->modes, (mp->nmds + 1) * 
+               mp->modes = realloc(mp->modes, (mp->nmds + 1) *
                                                        sizeof(long long));
        else
                return;
@@ -239,7 +239,7 @@ int seeki_mode(void *handle, struct mode *mp)
        struct rb_root *root = &sip->root;
 
        memset(mp, 0, sizeof(struct mode));
-       if (root->rb_node) 
+       if (root->rb_node)
                __mode(root->rb_node, mp);
 
        return mp->nmds;
index 1348e89c1fce082aa7467f1bc9ba329ed8503c0f..39faf76701416c2001d22ec6c3a73749a08598c9 100644 (file)
@@ -28,14 +28,7 @@ static void __add_trace(struct io *iop)
        iostat_check_time(iop->t.time);
 
        if (verbose && ((now - last_vtrace) > 0)) {
-
-#      if defined(DEBUG)
-               printf("%10lu t\ttree size=|%10d|\r", 
-                       n_traces, rb_tree_size);
-#      else
                printf("%10lu t\r", n_traces);
-#      endif
-
                if ((n_traces % 1000000) == 0) printf("\n");
                fflush(stdout);
                last_vtrace = now;
@@ -54,8 +47,8 @@ static void __add_trace(struct io *iop)
        case __BLK_TA_PLUG:             trace_plug(iop); break;
        case __BLK_TA_UNPLUG_IO:        trace_unplug_io(iop); break;
        case __BLK_TA_UNPLUG_TIMER:     trace_unplug_timer(iop); break;
-       default:                        
-               io_release(iop); 
+       default:
+               io_release(iop);
                return;
        }
 }
@@ -64,7 +57,7 @@ void add_trace(struct io *iop)
 {
        if (iop->t.action & BLK_TC_ACT(BLK_TC_NOTIFY)) {
                if (iop->t.action == BLK_TN_PROCESS) {
-                       if (iop->t.pid == 0) 
+                       if (iop->t.pid == 0)
                                add_process(0, "kernel");
                        else {
                                char *slash = strchr(iop->pdu, '/');
index b4dcadddea03150cf74010babf27622aad49c642..50f3cfa9410a101eccd25a068b351099ef062088 100644 (file)
  */
 #include "globals.h"
 
-static inline void __out(FILE *ofp, __u64 tm, enum iop_type type, 
+static inline void __out(FILE *ofp, __u64 tm, enum iop_type type,
                                        __u64 sec, __u32 nsec, int indent)
 {
        if (tm != (__u64)-1) {
-               if (indent) 
+               if (indent)
                        fprintf(ofp, "         ");
-               fprintf(ofp, "%5d.%09lu %c %10llu+%-4u\n", 
+               fprintf(ofp, "%5d.%09lu %c %10llu+%-4u\n",
                        (int)SECONDS(tm), (unsigned long)NANO_SECONDS(tm),
                        type2c(type), (unsigned long long)sec, nsec);
        }
@@ -85,7 +85,7 @@ static void handle_complete(struct io *c_iop)
                        display_io_track(per_io_ofp, q_iop);
                }
 
-               LIST_DEL(&q_iop->f_head);
+               list_del(&q_iop->f_head);
                io_release(q_iop);
        }
 }
index f08135388017636d02d68e94c7cdc84385f98232..56e562922db5a865f1e68f7e2d843b7eae0184c3 100644 (file)
@@ -38,25 +38,23 @@ static void handle_issue(struct io *d_iop)
        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);
-               
+
                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);
 
                if (output_all_data)
-                       q2d_histo_add(q_iop->dip->q2d_priv, 
+                       q2d_histo_add(q_iop->dip->q2d_priv,
                                                d_iop->t.time - q_iop->t.time);
        }
-
-       assert(d_iop->bytes_left == 0);
 }
 
 void trace_issue(struct io *d_iop)
index 60294b6e52b769963536790350e226853a9c1d27..1237f343f0d3c7845412f850d207594577fbfd20 100644 (file)
@@ -33,7 +33,7 @@ static void handle_queue(struct io *q_iop)
                update_lq(&last_q, &all_avgs.q2q, q_iop->t.time);
        }
 
-       q_iop->i_time = q_iop->g_time = q_iop->i_time = q_iop->m_time = 
+       q_iop->i_time = q_iop->g_time = q_iop->i_time = q_iop->m_time =
                                                q_iop->d_time = (__u64)-1;
        q_iop->dip->n_qs++;
 
index aaa4c39116e27db6d489b069069ec2e797311e02..ff31c7dabac10487c008eeb6579a5894ccc467e7 100644 (file)
@@ -47,8 +47,6 @@ void unplug_hist_add(struct io *u_iop)
 {
        struct d_info *dip;
 
-       assert(u_iop->t.pdu_len >= sizeof(__u64));
-
        dip = __dip_find(u_iop->t.device);
        if (dip && dip->unplug_hist_handle) {
                __u64 *val = u_iop->pdu;
@@ -59,7 +57,6 @@ void unplug_hist_add(struct io *u_iop)
                if (idx > EXCESS_BKT)
                        idx = EXCESS_BKT;
 
-               assert((0 <= idx) && (idx <= EXCESS_BKT));
                hbp->hist[idx]++;
        }
 }