diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2013-08-26 10:13:18 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2013-08-26 10:13:18 +0000 |
commit | 069f2b487d24ab9111351b8fbd2c4601aa0164dd (patch) | |
tree | 153fa93556e274f0c60b15f9786af56ad2698c65 /sys/scsi | |
parent | f30324462fe66d9097a8ad64d9162077cf82d19f (diff) |
when i first imagined how paths on mpath worked, i thought the
midlayer would be able to call things on paths to explicitely online
or offline them. turns out thats not how the Real World(tm) works,
instead its better to wait for failure and probe for the status of
paths, and pick the active group of paths from that. there's even
evidence that the mechanisms for forcing controllers into active/passive
roles from the scsi initiator are being deprecated. they expect
hosts to be able to cope with arbitrary controller role changes and
failover
accordingly.
this replaces the online and offline function pointers in the path_ops
structure with a status check function pointer. instead of returning a
state, the checker is expected to call mpath_path_status() when its
finished figuring out what the state is.
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/mpath.c | 8 | ||||
-rw-r--r-- | sys/scsi/mpath_emc.c | 20 | ||||
-rw-r--r-- | sys/scsi/mpath_hds.c | 20 | ||||
-rw-r--r-- | sys/scsi/mpath_rdac.c | 20 | ||||
-rw-r--r-- | sys/scsi/mpath_sym.c | 23 | ||||
-rw-r--r-- | sys/scsi/mpathvar.h | 11 |
6 files changed, 43 insertions, 59 deletions
diff --git a/sys/scsi/mpath.c b/sys/scsi/mpath.c index 80e2da55636..ca0d8546d98 100644 --- a/sys/scsi/mpath.c +++ b/sys/scsi/mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath.c,v 1.29 2013/08/26 07:32:24 dlg Exp $ */ +/* $OpenBSD: mpath.c,v 1.30 2013/08/26 10:13:17 dlg Exp $ */ /* * Copyright (c) 2009 David Gwynne <dlg@openbsd.org> @@ -489,6 +489,12 @@ mpath_path_detach(struct mpath_path *p) return (0); } +void +mpath_path_status(struct mpath_path *p, int status) +{ + +} + struct device * mpath_bootdv(struct device *dev) { diff --git a/sys/scsi/mpath_emc.c b/sys/scsi/mpath_emc.c index 626006ac240..8bcd16ca25d 100644 --- a/sys/scsi/mpath_emc.c +++ b/sys/scsi/mpath_emc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath_emc.c,v 1.10 2013/08/26 07:38:56 dlg Exp $ */ +/* $OpenBSD: mpath_emc.c,v 1.11 2013/08/26 10:13:17 dlg Exp $ */ /* * Copyright (c) 2011 David Gwynne <dlg@openbsd.org> @@ -91,14 +91,12 @@ struct cfdriver emc_cd = { void emc_mpath_start(struct scsi_xfer *); int emc_mpath_checksense(struct scsi_xfer *); -int emc_mpath_online(struct scsi_link *); -int emc_mpath_offline(struct scsi_link *); +void emc_mpath_status(struct scsi_link *); const struct mpath_ops emc_mpath_ops = { "emc", emc_mpath_checksense, - emc_mpath_online, - emc_mpath_offline, + emc_mpath_status, MPATH_ROUNDROBIN }; @@ -218,16 +216,12 @@ emc_mpath_checksense(struct scsi_xfer *xs) return (MPATH_SENSE_DECLINED); } -int -emc_mpath_online(struct scsi_link *link) +void +emc_mpath_status(struct scsi_link *link) { - return (0); -} + struct emc_softc *sc = link->device_softc; -int -emc_mpath_offline(struct scsi_link *link) -{ - return (0); + mpath_path_status(&sc->sc_path, MPATH_S_UNKNOWN); } int diff --git a/sys/scsi/mpath_hds.c b/sys/scsi/mpath_hds.c index 79181a1360e..91644a9606d 100644 --- a/sys/scsi/mpath_hds.c +++ b/sys/scsi/mpath_hds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath_hds.c,v 1.8 2013/08/26 07:38:56 dlg Exp $ */ +/* $OpenBSD: mpath_hds.c,v 1.9 2013/08/26 10:13:17 dlg Exp $ */ /* * Copyright (c) 2011 David Gwynne <dlg@openbsd.org> @@ -86,14 +86,12 @@ struct cfdriver hds_cd = { void hds_mpath_start(struct scsi_xfer *); int hds_mpath_checksense(struct scsi_xfer *); -int hds_mpath_online(struct scsi_link *); -int hds_mpath_offline(struct scsi_link *); +void hds_mpath_status(struct scsi_link *); const struct mpath_ops hds_mpath_ops = { "hds", hds_mpath_checksense, - hds_mpath_online, - hds_mpath_offline, + hds_mpath_status, MPATH_ROUNDROBIN }; @@ -215,16 +213,12 @@ hds_mpath_checksense(struct scsi_xfer *xs) return (MPATH_SENSE_DECLINED); } -int -hds_mpath_online(struct scsi_link *link) +void +hds_mpath_status(struct scsi_link *link) { - return (0); -} + struct hds_softc *sc = link->device_softc; -int -hds_mpath_offline(struct scsi_link *link) -{ - return (0); + mpath_path_status(&sc->sc_path, MPATH_S_UNKNOWN); } int diff --git a/sys/scsi/mpath_rdac.c b/sys/scsi/mpath_rdac.c index bd07adb9502..c1538d7abab 100644 --- a/sys/scsi/mpath_rdac.c +++ b/sys/scsi/mpath_rdac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath_rdac.c,v 1.11 2013/08/26 07:43:04 dlg Exp $ */ +/* $OpenBSD: mpath_rdac.c,v 1.12 2013/08/26 10:13:17 dlg Exp $ */ /* * Copyright (c) 2010 David Gwynne <dlg@openbsd.org> @@ -143,14 +143,12 @@ struct cfdriver rdac_cd = { void rdac_mpath_start(struct scsi_xfer *); int rdac_mpath_checksense(struct scsi_xfer *); -int rdac_mpath_online(struct scsi_link *); -int rdac_mpath_offline(struct scsi_link *); +void rdac_mpath_status(struct scsi_link *); const struct mpath_ops rdac_mpath_ops = { "rdac", rdac_mpath_checksense, - rdac_mpath_online, - rdac_mpath_offline, + rdac_mpath_status, MPATH_ROUNDROBIN }; @@ -282,16 +280,12 @@ rdac_mpath_checksense(struct scsi_xfer *xs) return (MPATH_SENSE_DECLINED); } -int -rdac_mpath_online(struct scsi_link *link) +void +rdac_mpath_status(struct scsi_link *link) { - return (0); -} + struct rdac_softc *sc = link->device_softc; -int -rdac_mpath_offline(struct scsi_link *link) -{ - return (0); + mpath_path_status(&sc->sc_path, MPATH_S_UNKNOWN); } int diff --git a/sys/scsi/mpath_sym.c b/sys/scsi/mpath_sym.c index 31602d7da34..68d4557b9bd 100644 --- a/sys/scsi/mpath_sym.c +++ b/sys/scsi/mpath_sym.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath_sym.c,v 1.11 2013/08/26 07:38:56 dlg Exp $ */ +/* $OpenBSD: mpath_sym.c,v 1.12 2013/08/26 10:13:17 dlg Exp $ */ /* * Copyright (c) 2010 David Gwynne <dlg@openbsd.org> @@ -62,22 +62,19 @@ struct cfdriver sym_cd = { void sym_mpath_start(struct scsi_xfer *); int sym_mpath_checksense(struct scsi_xfer *); -int sym_mpath_online(struct scsi_link *); -int sym_mpath_offline(struct scsi_link *); +void sym_mpath_status(struct scsi_link *); const struct mpath_ops sym_mpath_sym_ops = { "sym", sym_mpath_checksense, - sym_mpath_online, - sym_mpath_offline, + sym_mpath_status, MPATH_ROUNDROBIN }; const struct mpath_ops sym_mpath_asym_ops = { "sym", sym_mpath_checksense, - sym_mpath_online, - sym_mpath_offline, + sym_mpath_status, MPATH_MRU }; @@ -208,14 +205,10 @@ sym_mpath_checksense(struct scsi_xfer *xs) return (MPATH_SENSE_DECLINED); } -int -sym_mpath_online(struct scsi_link *link) +void +sym_mpath_status(struct scsi_link *link) { - return (0); -} + struct sym_softc *sc = link->device_softc; -int -sym_mpath_offline(struct scsi_link *link) -{ - return (0); + mpath_path_status(&sc->sc_path, MPATH_S_UNKNOWN); } diff --git a/sys/scsi/mpathvar.h b/sys/scsi/mpathvar.h index 3367b0abaa2..afb78afc823 100644 --- a/sys/scsi/mpathvar.h +++ b/sys/scsi/mpathvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpathvar.h,v 1.6 2013/08/26 07:38:56 dlg Exp $ */ +/* $OpenBSD: mpathvar.h,v 1.7 2013/08/26 10:13:17 dlg Exp $ */ /* * Copyright (c) 2010 David Gwynne <dlg@openbsd.org> @@ -25,14 +25,17 @@ struct mpath_group; struct mpath_ops { char op_name[16]; int (*op_checksense)(struct scsi_xfer *); - int (*op_online)(struct scsi_link *); - int (*op_offline)(struct scsi_link *); + void (*op_status)(struct scsi_link *); int op_schedule; }; #define MPATH_SENSE_DECLINED 0 /* path driver declined to interpret sense */ #define MPATH_SENSE_FAILOVER 1 /* sense says controllers have failed over */ +#define MPATH_S_UNKNOWN -1 +#define MPATH_S_ACTIVE 0 +#define MPATH_S_PASSIVE 1 + #define MPATH_ROUNDROBIN 0 /* use all active paths */ #define MPATH_NEXT MPATH_ROUNDROBIN #define MPATH_MRU 1 /* use most recently used path */ @@ -52,7 +55,7 @@ struct mpath_path { int mpath_path_probe(struct scsi_link *); int mpath_path_attach(struct mpath_path *, u_int, const struct mpath_ops *); -void mpath_path_state(struct mpath_path *, int); +void mpath_path_status(struct mpath_path *, int); int mpath_path_detach(struct mpath_path *); void mpath_start(struct mpath_path *, struct scsi_xfer *); |