summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2005-11-15 02:38:35 +0000
committerkan <kan@FreeBSD.org>2005-11-15 02:38:35 +0000
commitd5b90683597f09d12419317086200f387bc2b95a (patch)
treeea4b511952371ba086df09be0cb5b33a4e59681a /sys
parent267072f91c36769a3994a91f21382a9acc77974b (diff)
downloadFreeBSD-src-d5b90683597f09d12419317086200f387bc2b95a.zip
FreeBSD-src-d5b90683597f09d12419317086200f387bc2b95a.tar.gz
Keep track of volumes in non-optimal state and expose a simple count
of volumes that might need administrator attention through device specific sysctl to simplify device monitoring. Submitted by: Deomid Ryabkov <myself at rojer dot pp dot ru>
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/mpt/mpt.h1
-rw-r--r--sys/dev/mpt/mpt_raid.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/sys/dev/mpt/mpt.h b/sys/dev/mpt/mpt.h
index c7a7ed0..8baae3a 100644
--- a/sys/dev/mpt/mpt.h
+++ b/sys/dev/mpt/mpt.h
@@ -450,6 +450,7 @@ struct mpt_softc {
u_int raid_resync_rate;
u_int raid_mwce_setting;
u_int raid_queue_depth;
+ u_int raid_nonopt_volumes;
struct proc *raid_thread;
struct callout raid_timer;
diff --git a/sys/dev/mpt/mpt_raid.c b/sys/dev/mpt/mpt_raid.c
index c62b3af..4395ab3 100644
--- a/sys/dev/mpt/mpt_raid.c
+++ b/sys/dev/mpt/mpt_raid.c
@@ -1226,6 +1226,7 @@ mpt_refresh_raid_data(struct mpt_softc *mpt)
size_t len;
int rv;
int i;
+ u_int nonopt_volumes;
if (mpt->ioc_page2 == NULL || mpt->ioc_page3 == NULL)
return;
@@ -1303,6 +1304,7 @@ mpt_refresh_raid_data(struct mpt_softc *mpt)
mpt_vol->flags |= MPT_RVF_ACTIVE;
}
+ nonopt_volumes = 0;
for (i = 0; i < mpt->ioc_page2->MaxVolumes; i++) {
struct mpt_raid_volume *mpt_vol;
uint64_t total;
@@ -1329,6 +1331,10 @@ mpt_refresh_raid_data(struct mpt_softc *mpt)
mpt_vol->flags |= MPT_RVF_ANNOUNCED;
}
+ if (vol_pg->VolumeStatus.State !=
+ MPI_RAIDVOL0_STATUS_STATE_OPTIMAL)
+ nonopt_volumes++;
+
if ((mpt_vol->flags & MPT_RVF_UP2DATE) != 0)
continue;
@@ -1436,6 +1442,8 @@ mpt_refresh_raid_data(struct mpt_softc *mpt)
}
mpt_prtc(mpt, " )\n");
}
+
+ mpt->raid_nonopt_volumes = nonopt_volumes;
}
static void
@@ -1671,4 +1679,8 @@ mpt_raid_sysctl_attach(struct mpt_softc *mpt)
"vol_resync_rate", CTLTYPE_INT | CTLFLAG_RW, mpt, 0,
mpt_raid_sysctl_vol_resync_rate, "I",
"volume resync priority (0 == NC, 1 - 255)");
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "nonoptimal_volumes", CTLFLAG_RD,
+ &mpt->raid_nonopt_volumes, 0,
+ "number of nonoptimal volumes");
}
OpenPOWER on IntegriCloud