set_gdd_bit makes sure that we don't try to set bits past the max offset
we used to allocate our gdd array.
But, it only does this when the function is first called, and the whole
byte range for the IO we're recording may go past max offset. This adds
a check to be sure we stay in the right range.
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
last_time = find_last_time(trace);
tf->trace = trace;
- tf->max_seconds = SECONDS(last_time);
- tf->stop_seconds = SECONDS(last_time);
+ tf->max_seconds = SECONDS(last_time) + 1;
+ tf->stop_seconds = SECONDS(last_time) + 1;
find_extreme_offsets(trace, &tf->min_offset, &tf->max_offset,
&max_bank, &max_bank_offset);
filter_outliers(trace, tf->min_offset, tf->max_offset, &ymin, &ymax);
arr_size = (rows + 1) * cols;
/* the number of bytes */
- arr_size /= 8;
+ arr_size = (arr_size + 7) / 8;
gdd = calloc(1, size + arr_size);
if (!gdd) {
if (offset > gdd->max_offset || offset < gdd->min_offset)
return;
-
gdd->total_ios++;
time = time / 1000000000.0;
- while (bytes > 0) {
+ while (bytes > 0 && offset <= gdd->max_offset) {
row = (double)(offset - gdd->min_offset) / bytes_per_row;
col = (time - gdd->min_seconds) / secs_per_col;