summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-08-28 00:53:35 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-08-28 00:53:35 +0000
commitdfe9fe2afb08264b7be7deb2615a95062e0a75f1 (patch)
treea162636c2dc9019f9bd884e27dcfe715677c1fa9 /sys/dev/pci
parentc15a6552ec2a039a98d32645ba01ef8e2b5c0923 (diff)
turns out the volume info contains a bitmap of failed physdisks in it, so
i can just check if this is non zero to see if a volume is degraded. this means i dont have to pull the raid info page to find failed disks in the volume inquiry.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/arc.c40
1 files changed, 7 insertions, 33 deletions
diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c
index 1cd03fdc494..6d12352bc45 100644
--- a/sys/dev/pci/arc.c
+++ b/sys/dev/pci/arc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc.c,v 1.46 2006/08/27 11:29:45 dlg Exp $ */
+/* $OpenBSD: arc.c,v 1.47 2006/08/28 00:53:34 dlg Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -1139,27 +1139,19 @@ int
arc_bio_vol(struct arc_softc *sc, struct bioc_vol *bv)
{
struct arc_fw_volinfo *volinfo;
- struct arc_fw_raidinfo *raidinfo;
struct scsi_link *sc_link;
struct device *dev;
- u_int8_t request[2];
u_int32_t status;
- int i;
int error = 0;
volinfo = malloc(sizeof(struct arc_fw_volinfo), M_TEMP, M_WAITOK);
if (volinfo == NULL)
return (ENOMEM);
- raidinfo = malloc(sizeof(struct arc_fw_raidinfo), M_TEMP, M_WAITOK);
- if (raidinfo == NULL) {
- free(volinfo, M_TEMP);
- return (ENOMEM);
- }
-
arc_lock(sc);
-
error = arc_bio_getvol(sc, bv->bv_volid, volinfo);
+ arc_unlock(sc);
+
if (error != 0)
goto out;
@@ -1168,26 +1160,10 @@ arc_bio_vol(struct arc_softc *sc, struct bioc_vol *bv)
status = letoh32(volinfo->volume_status);
if (status == 0x0) {
- bv->bv_status = BIOC_SVONLINE;
- /*
- * the stupid firmware doesnt care if a volume is degraded,
- * just if it is working or not. go see if any disks are
- * missing and figure out if it's degraded for ourselves.
- */
- request[0] = ARC_FW_RAIDINFO;
- request[1] = volinfo->raid_set_number;
- error = arc_msgbuf(sc, request, sizeof(request), raidinfo,
- sizeof(struct arc_fw_raidinfo));
- if (error != 0)
- goto out;
-
- for (i = 0; i < raidinfo->member_devices; i++) {
- /* a missing disk shows up as 0xff */
- if (raidinfo->device_array[i] == 0xff) {
- bv->bv_status = BIOC_SVDEGRADED;
- break;
- }
- }
+ if (letoh32(volinfo->fail_mask) == 0x0)
+ bv->bv_status = BIOC_SVONLINE;
+ else
+ bv->bv_status = BIOC_SVDEGRADED;
} else if (status & ARC_FW_VOL_STATUS_NEED_REGEN)
bv->bv_status = BIOC_SVDEGRADED;
else if (status & ARC_FW_VOL_STATUS_FAILED)
@@ -1233,8 +1209,6 @@ arc_bio_vol(struct arc_softc *sc, struct bioc_vol *bv)
}
out:
- arc_unlock(sc);
- free(raidinfo, M_TEMP);
free(volinfo, M_TEMP);
return (error);
}