summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2008-10-30 19:20:14 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2008-10-30 19:20:14 +0000
commit988b0a27c7350f7328b201f9b925b03f95cd5bce (patch)
treeee8c0e431b93dc88f836b31247a18198424ee5a7
parent2ba72244dee8f567d09e1cfde30c2fc28d389def (diff)
Fix bug that when there are no volumes but there are hot spares it would
no show the hotspares.
-rw-r--r--sys/dev/ic/mfi.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c
index d234395416a..9a58336961d 100644
--- a/sys/dev/ic/mfi.c
+++ b/sys/dev/ic/mfi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfi.c,v 1.85 2008/10/28 21:44:25 marco Exp $ */
+/* $OpenBSD: mfi.c,v 1.86 2008/10/30 19:20:13 marco Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -1337,6 +1337,12 @@ mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
sizeof(sc->sc_ld_list), &sc->sc_ld_list, NULL))
goto done;
+ if (bv->bv_volid >= sc->sc_ld_list.mll_no_ld) {
+ /* go do hotspares */
+ rv = mfi_bio_hs(sc, bv->bv_volid, MFI_MGMT_VD, bv);
+ goto done;
+ }
+
i = bv->bv_volid;
mbox[0] = sc->sc_ld_list.mll_list[i].mll_ld.mld_target;
DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl_vol target %#x\n",
@@ -1346,12 +1352,6 @@ mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
sizeof(sc->sc_ld_details), &sc->sc_ld_details, mbox))
goto done;
- if (bv->bv_volid >= sc->sc_ld_list.mll_no_ld) {
- /* go do hotspares */
- rv = mfi_bio_hs(sc, bv->bv_volid, MFI_MGMT_VD, bv);
- goto done;
- }
-
strlcpy(bv->bv_dev, sc->sc_ld[i].ld_dev, sizeof(bv->bv_dev));
switch(sc->sc_ld_list.mll_list[i].mll_state) {
@@ -1744,8 +1744,10 @@ mfi_bio_hs(struct mfi_softc *sc, int volid, int type, void *bio_hs)
if (volid < cfg->mfc_no_ld)
goto freeme; /* not a hotspare */
- if (volid > (cfg->mfc_no_ld + cfg->mfc_no_hs))
+ if (volid > (cfg->mfc_no_ld + cfg->mfc_no_hs)) {
+ /* deal with unused disks */
goto freeme; /* not a hotspare */
+ }
/* offset into hotspare structure */
i = volid - cfg->mfc_no_ld;