tapestat didn't look for the stats dropping back to zero when the st
driver is unloaded then loaded again, so you get one really line of
really large values when that happens. Fix this problem by
adding a check to see if the new stats are less than the old ones and
marking any tape where that happens as having invalid stats. The
information for that drive will disappear until we have all valid stats
again (it's the test for read_time, write_time, and other_time)
The test is only needed for those three since if any of them are less than
the previously read stats someone has unloaded and reloaded the driver
since that's the only time they can reduce in value).
Signed-off-by: Shane M. SEYMOUR <shane.seymour@hp.com>
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
TAPE_STAT_FILE_VAL(TAPE_STAT_PATH "write_cnt", write_count)
TAPE_STAT_FILE_VAL(TAPE_STAT_PATH "other_cnt", other_count)
TAPE_STAT_FILE_VAL(TAPE_STAT_PATH "resid_cnt", resid_count)
+
+ if ((tape_new_stats[i].read_time < tape_old_stats[i].read_time) ||
+ (tape_new_stats[i].write_time < tape_old_stats[i].write_time) ||
+ (tape_new_stats[i].other_time < tape_old_stats[i].other_time)) {
+ tape_new_stats[i].valid = TAPE_STATS_INVALID;
+ }
}
}