Due to no initialization of struct bench, some "ifs" in the code would
show different behavior depending on the junk values they would check.
Now however, there is proper initialization of struct bench.
static inline uint64_t __get_object(struct bench *prefs, uint64_t new)
{
- if (prefs->to < 0)
+ if (prefs->ts > 0)
new = new / (prefs->os / prefs->bs);
return new;
}
uint64_t calculate_offset(struct bench *prefs, uint64_t new)
{
- if (prefs->to < 0)
+ if (prefs->ts > 0)
return (new * prefs->bs) % prefs->os;
else
return 0;
perror("malloc");
return -1;
}
- prefs->flags = 0;
+ memset(prefs, 0, sizeof(struct bench));
prefs->status = malloc(sizeof(struct req_status));
if (!prefs->status) {
perror("malloc");
return -1;
}
+
memset(prefs->status, 0, sizeof(struct req_status));
//Begin reading the benchmark-specific arguments
} else if (total_size[0]) {
if (prefs->op != X_READ && prefs->op != X_WRITE) {
XSEGLOG2(&lc, E,
- "Total objects must be supplied (required by op %s)\n", op);
+ "Total objects must be supplied (required by -op %s)\n", op);
goto arg_fail;
}
prefs->ts = str2num(total_size);