Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src Pull up following revision(s) (requested by mlelstv in ti...
details: https://anonhg.NetBSD.org/src/rev/44a0b70a3d93
branches: netbsd-7
changeset: 798539:44a0b70a3d93
user: martin <martin%NetBSD.org@localhost>
date: Tue Nov 11 10:36:40 2014 +0000
description:
Pull up following revision(s) (requested by mlelstv in ticket #201):
sbin/dkctl/dkctl.8: revision 1.24
sbin/dkctl/dkctl.8: revision 1.25
sys/dev/scsipi/sd.c: revision 1.310
sys/dev/ata/wd.c: revision 1.415
sbin/dkctl/dkctl.c: revision 1.21
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.315
sys/dev/ld.c: revision 1.78
sys/dev/vnd.c: revision 1.234
sys/dev/dksubr.c: revision 1.54
sys/sys/dkio.h: revision 1.20
sys/dev/dkwedge/dk.c: revision 1.74
Add ioctl to autodiscover wedges.
Implement DIOCMWEDGES ioctl that triggers wedge autodiscovery.
Also fix a reference counting bug and clean up some code.
support DIOCMWEDGES ioctl.
Add 'makewedges' option to autodiscover wedges from a changed label.
New sentence, new line. Bump date for previous.
diffstat:
sbin/dkctl/dkctl.8 | 10 +-
sbin/dkctl/dkctl.c | 24 +++++-
sys/dev/ata/wd.c | 13 ++-
sys/dev/dksubr.c | 14 ++-
sys/dev/dkwedge/dk.c | 150 +++++++++++++++++++++++++-----------
sys/dev/ld.c | 14 ++-
sys/dev/raidframe/rf_netbsdkintf.c | 9 +-
sys/dev/scsipi/sd.c | 13 ++-
sys/dev/vnd.c | 11 ++-
sys/sys/dkio.h | 5 +-
10 files changed, 199 insertions(+), 64 deletions(-)
diffs (truncated from 629 to 300 lines):
diff -r 8222c212cbe7 -r 44a0b70a3d93 sbin/dkctl/dkctl.8
--- a/sbin/dkctl/dkctl.8 Tue Nov 11 10:31:16 2014 +0000
+++ b/sbin/dkctl/dkctl.8 Tue Nov 11 10:36:40 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: dkctl.8,v 1.23 2011/01/04 23:29:51 wiz Exp $
+.\" $NetBSD: dkctl.8,v 1.23.24.1 2014/11/11 10:36:40 martin Exp $
.\"
.\" Copyright 2002 Wasabi Systems, Inc.
.\" All rights reserved.
@@ -33,7 +33,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd January 5, 2011
+.Dd November 4, 2014
.Dt DKCTL 8
.Os
.Sh NAME
@@ -165,6 +165,12 @@
in this case is the wedge name.
.It Ic listwedges
List all of the wedges configured on the specified disk.
+.It Ic makewedges
+Delete all wedges configured on the specified disk, and autodiscover
+the wedges again.
+Wedges that are in use are not deleted and conflicting
+or overlapping wedges are not created.
+You need to list wedges to find out what has changed.
.It Ic strategy Op Ar name
Get and set the disk I/O scheduler (buffer queue strategy) on the
drive.
diff -r 8222c212cbe7 -r 44a0b70a3d93 sbin/dkctl/dkctl.c
--- a/sbin/dkctl/dkctl.c Tue Nov 11 10:31:16 2014 +0000
+++ b/sbin/dkctl/dkctl.c Tue Nov 11 10:36:40 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dkctl.c,v 1.20 2011/08/27 16:34:38 joerg Exp $ */
+/* $NetBSD: dkctl.c,v 1.20.20.1 2014/11/11 10:36:40 martin Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: dkctl.c,v 1.20 2011/08/27 16:34:38 joerg Exp $");
+__RCSID("$NetBSD: dkctl.c,v 1.20.20.1 2014/11/11 10:36:40 martin Exp $");
#endif
@@ -101,6 +101,7 @@
static void disk_delwedge(int, char *[]);
static void disk_getwedgeinfo(int, char *[]);
static void disk_listwedges(int, char *[]);
+static void disk_makewedges(int, char *[]);
static void disk_strategy(int, char *[]);
static struct command commands[] = {
@@ -149,6 +150,11 @@
disk_listwedges,
O_RDONLY },
+ { "makewedges",
+ "",
+ disk_makewedges,
+ O_RDWR },
+
{ "strategy",
"[name]",
disk_strategy,
@@ -666,6 +672,20 @@
}
}
+static void
+disk_makewedges(int argc, char *argv[])
+{
+ int bits;
+
+ if (argc != 0)
+ usage();
+
+ if (ioctl(fd, DIOCMWEDGES, &bits) == -1)
+ err(1, "%s: makewedges", dvname);
+ else
+ printf("successfully scanned %s.\n", dvname);
+}
+
static int
dkw_sort(const void *a, const void *b)
{
diff -r 8222c212cbe7 -r 44a0b70a3d93 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c Tue Nov 11 10:31:16 2014 +0000
+++ b/sys/dev/ata/wd.c Tue Nov 11 10:36:40 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wd.c,v 1.412 2014/08/10 16:44:35 tls Exp $ */
+/* $NetBSD: wd.c,v 1.412.2.1 2014/11/11 10:36:41 martin Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.412 2014/08/10 16:44:35 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.412.2.1 2014/11/11 10:36:41 martin Exp $");
#include "opt_ata.h"
@@ -1511,6 +1511,15 @@
return (dkwedge_list(&wd->sc_dk, dkwl, l));
}
+ case DIOCMWEDGES:
+ {
+ if ((flag & FWRITE) == 0)
+ return (EBADF);
+
+ dkwedge_discover(&wd->sc_dk);
+ return 0;
+ }
+
case DIOCGSTRATEGY:
{
struct disk_strategy *dks = (void *)addr;
diff -r 8222c212cbe7 -r 44a0b70a3d93 sys/dev/dksubr.c
--- a/sys/dev/dksubr.c Tue Nov 11 10:31:16 2014 +0000
+++ b/sys/dev/dksubr.c Tue Nov 11 10:36:40 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.51 2014/06/14 07:39:00 hannken Exp $ */
+/* $NetBSD: dksubr.c,v 1.51.2.1 2014/11/11 10:36:41 martin Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.51 2014/06/14 07:39:00 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.51.2.1 2014/11/11 10:36:41 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -304,6 +304,7 @@
case DIOCAWEDGE:
case DIOCDWEDGE:
case DIOCLWEDGES:
+ case DIOCMWEDGES:
case DIOCCACHESYNC:
#ifdef __HAVE_OLD_DISKLABEL
case ODIOCGDINFO:
@@ -433,6 +434,15 @@
return (dkwedge_list(&dksc->sc_dkdev, dkwl, l));
}
+ case DIOCMWEDGES:
+ {
+ if ((flag & FWRITE) == 0)
+ return (EBADF);
+
+ dkwedge_discover(&dksc->sc_dkdev);
+ return 0;
+ }
+
case DIOCGSTRATEGY:
{
struct disk_strategy *dks = (void *)data;
diff -r 8222c212cbe7 -r 44a0b70a3d93 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c Tue Nov 11 10:31:16 2014 +0000
+++ b/sys/dev/dkwedge/dk.c Tue Nov 11 10:36:40 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.72.2.1 2014/08/29 11:49:41 martin Exp $ */
+/* $NetBSD: dk.c,v 1.72.2.2 2014/11/11 10:36:41 martin Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.72.2.1 2014/08/29 11:49:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.72.2.2 2014/11/11 10:36:41 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -98,7 +98,10 @@
static void dkminphys(struct buf *);
static int dklastclose(struct dkwedge_softc *);
+static int dkwedge_cleanup_parent(struct dkwedge_softc *, int);
static int dkwedge_detach(device_t, int);
+static void dkwedge_delall1(struct disk *, bool);
+static int dkwedge_del1(struct dkwedge_info *, int);
static dev_type_open(dkopen);
static dev_type_close(dkclose);
@@ -198,7 +201,7 @@
* Compute the parent disk's dev_t.
*/
static int
-dkwedge_compute_pdev(const char *pname, dev_t *pdevp)
+dkwedge_compute_pdev(const char *pname, dev_t *pdevp, enum vtype type)
{
const char *name, *cp;
devmajor_t pmaj;
@@ -206,7 +209,18 @@
char devname[16];
name = pname;
- if ((pmaj = devsw_name2blk(name, devname, sizeof(devname))) == -1)
+ switch (type) {
+ case VBLK:
+ pmaj = devsw_name2blk(name, devname, sizeof(devname));
+ break;
+ case VCHR:
+ pmaj = devsw_name2chr(name, devname, sizeof(devname));
+ break;
+ default:
+ pmaj = -1;
+ break;
+ }
+ if (pmaj == -1)
return (ENODEV);
name += strlen(devname);
@@ -282,7 +296,7 @@
if (pdk == NULL)
return (ENODEV);
- error = dkwedge_compute_pdev(pdk->dk_name, &pdev);
+ error = dkwedge_compute_pdev(pdk->dk_name, &pdev, VBLK);
if (error)
return (error);
@@ -331,9 +345,14 @@
break;
}
}
- if (lsc != NULL)
- error = EINVAL;
- else {
+ if (lsc != NULL) {
+ if (sc->sc_offset == lsc->sc_offset &&
+ sc->sc_size == lsc->sc_size &&
+ strcmp(sc->sc_wname, lsc->sc_wname) == 0)
+ error = EEXIST;
+ else
+ error = EINVAL;
+ } else {
pdk->dk_nwedges++;
LIST_INSERT_HEAD(&pdk->dk_wedges, sc, sc_plink);
}
@@ -497,17 +516,23 @@
int
dkwedge_del(struct dkwedge_info *dkw)
{
+ return dkwedge_del1(dkw, 0);
+}
+
+int
+dkwedge_del1(struct dkwedge_info *dkw, int flags)
+{
struct dkwedge_softc *sc = NULL;
/* Find our softc. */
if ((sc = dkwedge_find(dkw, NULL)) == NULL)
return (ESRCH);
- return config_detach(sc->sc_dev, DETACH_FORCE | DETACH_QUIET);
+ return config_detach(sc->sc_dev, flags);
}
static int
-dkwedge_begindetach(struct dkwedge_softc *sc, int flags)
+dkwedge_cleanup_parent(struct dkwedge_softc *sc, int flags)
{
struct disk *dk = &sc->sc_dk;
int rc;
@@ -546,7 +571,7 @@
}
if (unit == ndkwedges)
rc = ENXIO;
- else if ((rc = dkwedge_begindetach(sc, flags)) == 0) {
+ else if ((rc = dkwedge_cleanup_parent(sc, flags)) == 0) {
/* Mark the wedge as dying. */
sc->sc_state = DKW_STATE_DYING;
}
@@ -579,20 +604,7 @@
vdevgone(cmaj, unit, unit, VCHR);
/* Clean up the parent. */
- mutex_enter(&sc->sc_dk.dk_openlock);
- if (sc->sc_dk.dk_openmask) {
- mutex_enter(&sc->sc_parent->dk_rawlock);
- if (sc->sc_parent->dk_rawopens-- == 1) {
- KASSERT(sc->sc_parent->dk_rawvp != NULL);
- mutex_exit(&sc->sc_parent->dk_rawlock);
- (void) vn_close(sc->sc_parent->dk_rawvp, FREAD | FWRITE,
- NOCRED);
- sc->sc_parent->dk_rawvp = NULL;
- } else
Home |
Main Index |
Thread Index |
Old Index