Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Maintain our own storage for volume and disk ID ...
details: https://anonhg.NetBSD.org/src/rev/c3fe9555ff41
branches: trunk
changeset: 766301:c3fe9555ff41
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Mon Jun 20 13:26:58 2011 +0000
description:
Maintain our own storage for volume and disk ID info rather than
(ab)using envstat's storage.
XXX Compile-tested only.
diffstat:
sys/dev/pci/arcmsr.c | 54 ++++++++++++++++++++++++++----------------------
sys/dev/pci/arcmsrvar.h | 10 +++++++-
2 files changed, 37 insertions(+), 27 deletions(-)
diffs (166 lines):
diff -r 1d2643e65b07 -r c3fe9555ff41 sys/dev/pci/arcmsr.c
--- a/sys/dev/pci/arcmsr.c Mon Jun 20 13:09:38 2011 +0000
+++ b/sys/dev/pci/arcmsr.c Mon Jun 20 13:26:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arcmsr.c,v 1.27 2011/06/04 13:25:56 pgoyette Exp $ */
+/* $NetBSD: arcmsr.c,v 1.28 2011/06/20 13:26:58 pgoyette Exp $ */
/* $OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */
/*
@@ -21,7 +21,7 @@
#include "bio.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.27 2011/06/04 13:25:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.28 2011/06/20 13:26:58 pgoyette Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -1735,8 +1735,8 @@
kthread_exit(0);
sc->sc_sme = sysmon_envsys_create();
- slen = sizeof(envsys_data_t) * sc->sc_nsensors;
- sc->sc_sensors = kmem_zalloc(slen, KM_SLEEP);
+ slen = sizeof(arc_edata_t) * sc->sc_nsensors;
+ sc->sc_arc_sensors = kmem_zalloc(slen, KM_SLEEP);
/* Attach sensors for volumes and disks */
for (i = 0; i < bi.bi_novol; i++) {
@@ -1745,44 +1745,47 @@
if (arc_bio_vol(sc, &bv) != 0)
goto bad;
- sc->sc_sensors[count].units = ENVSYS_DRIVE;
- sc->sc_sensors[count].flags = ENVSYS_FMONSTCHANGED;
+ sc->sc_arc_sensors[count].arc_sensor.units = ENVSYS_DRIVE;
+ sc->sc_arc_sensors[count].arc_sensor.flags =
+ ENVSYS_FMONSTCHANGED;
/* Skip passthrough volumes */
if (bv.bv_level == BIOC_SVOL_PASSTHRU)
continue;
if (bv.bv_level == BIOC_SVOL_RAID10)
- snprintf(sc->sc_sensors[count].desc,
- sizeof(sc->sc_sensors[count].desc),
+ snprintf(sc->sc_arc_sensors[count].arc_sensor.desc,
+ sizeof(sc->sc_arc_sensors[count].arc_sensor.desc),
"RAID 1+0 volume%d (%s)", i, bv.bv_dev);
else
- snprintf(sc->sc_sensors[count].desc,
- sizeof(sc->sc_sensors[count].desc),
+ snprintf(sc->sc_arc_sensors[count].arc_sensor.desc,
+ sizeof(sc->sc_arc_sensors[count].arc_sensor.desc),
"RAID %d volume%d (%s)", bv.bv_level, i,
bv.bv_dev);
- sc->sc_sensors[count].value_max = i;
+ sc->sc_arc_sensors[count].arc_volid = i;
if (sysmon_envsys_sensor_attach(sc->sc_sme,
- &sc->sc_sensors[count]))
+ &sc->sc_arc_sensors[count].arc_sensor))
goto bad;
count++;
/* Attach disk sensors for this volume */
for (j = 0; j < bv.bv_nodisk; j++) {
- sc->sc_sensors[count].units = ENVSYS_DRIVE;
- sc->sc_sensors[count].flags = ENVSYS_FMONSTCHANGED;
+ sc->sc_arc_sensors[count].arc_sensor.units =
+ ENVSYS_DRIVE;
+ sc->sc_arc_sensors[count].arc_sensor.flags =
+ ENVSYS_FMONSTCHANGED;
- snprintf(sc->sc_sensors[count].desc,
- sizeof(sc->sc_sensors[count].desc),
+ snprintf(sc->sc_arc_sensors[count].arc_sensor.desc,
+ sizeof(sc->sc_arc_sensors[count].arc_sensor.desc),
"disk%d volume%d (%s)", j, i, bv.bv_dev);
- sc->sc_sensors[count].value_max = i;
- sc->sc_sensors[count].private = j + 10;
+ sc->sc_arc_sensors[count].arc_volid = i;
+ sc->sc_arc_sensors[count].arc_diskid = j + 10;
if (sysmon_envsys_sensor_attach(sc->sc_sme,
- &sc->sc_sensors[count]))
+ &sc->sc_arc_sensors[count].arc_sensor))
goto bad;
count++;
@@ -1806,10 +1809,10 @@
bad:
sysmon_envsys_destroy(sc->sc_sme);
- kmem_free(sc->sc_sensors, slen);
+ kmem_free(sc->sc_arc_sensors, slen);
sc->sc_sme = NULL;
- sc->sc_sensors = NULL;
+ sc->sc_arc_sensors = NULL;
kthread_exit(0);
}
@@ -1820,13 +1823,14 @@
struct arc_softc *sc = sme->sme_cookie;
struct bioc_vol bv;
struct bioc_disk bd;
+ arc_edata_t *arcdata = (arc_edata_t *)edata;
/* sanity check */
if (edata->units != ENVSYS_DRIVE)
return;
memset(&bv, 0, sizeof(bv));
- bv.bv_volid = edata->value_max;
+ bv.bv_volid = arcdata->arc_volid;
if (arc_bio_vol(sc, &bv)) {
edata->value_cur = ENVSYS_DRIVE_EMPTY;
@@ -1835,10 +1839,10 @@
}
/* Current sensor is handling a disk volume member */
- if (edata->private) {
+ if (arcdata->arc_diskid) {
memset(&bd, 0, sizeof(bd));
- bd.bd_volid = edata->value_max;
- bd.bd_diskid = edata->private - 10;
+ bd.bd_volid = arcdata->arc_volid;
+ bd.bd_diskid = arcdata->arc_diskid - 10;
if (arc_bio_disk_volume(sc, &bd)) {
edata->value_cur = ENVSYS_DRIVE_OFFLINE;
diff -r 1d2643e65b07 -r c3fe9555ff41 sys/dev/pci/arcmsrvar.h
--- a/sys/dev/pci/arcmsrvar.h Mon Jun 20 13:09:38 2011 +0000
+++ b/sys/dev/pci/arcmsrvar.h Mon Jun 20 13:26:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arcmsrvar.h,v 1.13 2008/09/23 22:22:41 christos Exp $ */
+/* $NetBSD: arcmsrvar.h,v 1.14 2011/06/20 13:26:58 pgoyette Exp $ */
/* Derived from $OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */
/*
@@ -407,6 +407,12 @@
struct arc_ccb;
TAILQ_HEAD(arc_ccb_list, arc_ccb);
+typedef struct arc_edata {
+ envsys_data_t arc_sensor;
+ int arc_diskid;
+ int arc_volid;
+} arc_edata_t;
+
struct arc_softc {
struct scsipi_channel sc_chan;
struct scsipi_adapter sc_adapter;
@@ -434,7 +440,7 @@
krwlock_t sc_rwlock;
struct sysmon_envsys *sc_sme;
- envsys_data_t *sc_sensors;
+ arc_edata_t *sc_arc_sensors;
int sc_nsensors;
size_t sc_maxraidset; /* max raid sets */
Home |
Main Index |
Thread Index |
Old Index