summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan D. Brunelle <alan.brunelle@hp.com>2008-02-13 11:46:22 -0500
committerAlan D. Brunelle <alan.brunelle@hp.com>2008-02-13 11:47:22 -0500
commit8b10aae0cd4137f1cc9848181e4f45a9fa20de24 (patch)
tree09a9447aa680f1d67d4c4e93f2b041ce8b544065
parentc8aea612abc714072e346366cb0e5cf9da8a2f5f (diff)
downloadblktrace-8b10aae0cd4137f1cc9848181e4f45a9fa20de24.tar.gz
blktrace-8b10aae0cd4137f1cc9848181e4f45a9fa20de24.tar.bz2
Cleanups: Fixed IOPs in btt left over at end of run
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>
-rw-r--r--btt/Makefile3
-rw-r--r--btt/args.c1
-rw-r--r--btt/bno_dump.c2
-rw-r--r--btt/bt_timeline.c43
-rw-r--r--btt/devs.c56
-rw-r--r--btt/dip_rb.c7
-rw-r--r--btt/globals.h44
-rw-r--r--btt/inlines.h104
-rw-r--r--btt/iostat.c2
-rw-r--r--btt/misc.c4
-rw-r--r--btt/mmap.c8
-rw-r--r--btt/output.c2
-rw-r--r--btt/proc.c11
-rw-r--r--btt/seek.c8
-rw-r--r--btt/trace.c13
-rw-r--r--btt/trace_complete.c8
-rw-r--r--btt/trace_issue.c8
-rw-r--r--btt/trace_queue.c2
-rw-r--r--btt/unplug_hist.c3
19 files changed, 51 insertions, 278 deletions
diff --git a/btt/Makefile b/btt/Makefile
index 094f77f..a6b078e 100644
--- a/btt/Makefile
+++ b/btt/Makefile
@@ -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)
diff --git a/btt/args.c b/btt/args.c
index 9e918c9..5930f14 100644
--- a/btt/args.c
+++ b/btt/args.c
@@ -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);
diff --git a/btt/bno_dump.c b/btt/bno_dump.c
index d1bc6ab..1f5433b 100644
--- a/btt/bno_dump.c
+++ b/btt/bno_dump.c
@@ -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));
}
diff --git a/btt/bt_timeline.c b/btt/bt_timeline.c
index 17a1b23..30b1e6e 100644
--- a/btt/bt_timeline.c
+++ b/btt/bt_timeline.c
@@ -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;
diff --git a/btt/devs.c b/btt/devs.c
index 38007d1..3cf7a6c 100644
--- a/btt/devs.c
+++ b/btt/devs.c
@@ -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++;
}
diff --git a/btt/dip_rb.c b/btt/dip_rb.c
index 13861c7..867a97b 100644
--- a/btt/dip_rb.c
+++ b/btt/dip_rb.c
@@ -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);
diff --git a/btt/globals.h b/btt/globals.h
index 486a3fc..52fb8b0 100644
--- a/btt/globals.h
+++ b/btt/globals.h
@@ -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>
@@ -47,27 +46,6 @@
#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);
diff --git a/btt/inlines.h b/btt/inlines.h
index 875b75b..3e7a17e 100644
--- a/btt/inlines.h
+++ b/btt/inlines.h
@@ -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);
}
diff --git a/btt/iostat.c b/btt/iostat.c
index e920c80..c4ddcb4 100644
--- a/btt/iostat.c
+++ b/btt/iostat.c
@@ -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;
diff --git a/btt/misc.c b/btt/misc.c
index 24ade81..4e721fc 100644
--- a/btt/misc.c
+++ b/btt/misc.c
@@ -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) {}
diff --git a/btt/mmap.c b/btt/mmap.c
index 3718817..60d4900 100644
--- a/btt/mmap.c
+++ b/btt/mmap.c
@@ -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);
diff --git a/btt/output.c b/btt/output.c
index e652bbd..a3c887f 100644
--- a/btt/output.c
+++ b/btt/output.c
@@ -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;
diff --git a/btt/proc.c b/btt/proc.c
index 5818db4..55f8e13 100644
--- a/btt/proc.c
+++ b/btt/proc.c
@@ -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);
}
diff --git a/btt/seek.c b/btt/seek.c
index cbbd1a3..a5ba84b 100644
--- a/btt/seek.c
+++ b/btt/seek.c
@@ -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;
diff --git a/btt/trace.c b/btt/trace.c
index 1348e89..39faf76 100644
--- a/btt/trace.c
+++ b/btt/trace.c
@@ -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, '/');
diff --git a/btt/trace_complete.c b/btt/trace_complete.c
index b4dcadd..50f3cfa 100644
--- a/btt/trace_complete.c
+++ b/btt/trace_complete.c
@@ -20,13 +20,13 @@
*/
#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);
}
}
diff --git a/btt/trace_issue.c b/btt/trace_issue.c
index f081353..56e5629 100644
--- a/btt/trace_issue.c
+++ b/btt/trace_issue.c
@@ -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)
diff --git a/btt/trace_queue.c b/btt/trace_queue.c
index 60294b6..1237f34 100644
--- a/btt/trace_queue.c
+++ b/btt/trace_queue.c
@@ -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++;
diff --git a/btt/unplug_hist.c b/btt/unplug_hist.c
index aaa4c39..ff31c7d 100644
--- a/btt/unplug_hist.c
+++ b/btt/unplug_hist.c
@@ -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]++;
}
}