When running iostat to monitor disk activity,
disconnecting a USB drive from the system then reconnecting another one
didn't make the new one appear on the list.
This patch fixes the problem.
Reported-by: Robert Hoffmann <robert@noreply.servermasters.com>
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
st_hdr_iodev_i = st_hdr_iodev + i;
if (st_hdr_iodev_i->status == DISK_UNREGISTERED) {
st_hdr_iodev_i->status = DISK_REGISTERED;
+ if (st_hdr_iodev_i->used == FALSE) {
+ st_iodev_i = st_iodev[!curr] + i;
+ memset(st_iodev_i, 0, IO_STATS_SIZE);
+ st_hdr_iodev_i->used = TRUE;
+ }
}
st_iodev_i = st_iodev[curr] + i;
*st_iodev_i = *((struct io_stats *) st_io);