Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dkwedge dkwedge_add: Allow for expanding the size of...
details: https://anonhg.NetBSD.org/src/rev/be3c41c2b623
branches: trunk
changeset: 933308:be3c41c2b623
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun May 24 14:40:21 2020 +0000
description:
dkwedge_add: Allow for expanding the size of an existing wedge without
having to delete it first, provided that no other parameters have changed.
diffstat:
sys/dev/dkwedge/dk.c | 33 +++++++++++++++++++++++++++++++--
1 files changed, 31 insertions(+), 2 deletions(-)
diffs (61 lines):
diff -r 9f4b6dbb0eba -r be3c41c2b623 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c Sun May 24 14:11:49 2020 +0000
+++ b/sys/dev/dkwedge/dk.c Sun May 24 14:40:21 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.100 2020/03/02 16:01:56 riastradh Exp $ */
+/* $NetBSD: dk.c,v 1.101 2020/05/24 14:40:21 jmcneill 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.100 2020/03/02 16:01:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.101 2020/05/24 14:40:21 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -310,6 +310,34 @@
if (dkw->dkw_offset < 0)
return (EINVAL);
+ /*
+ * Check for an existing wedge at the same disk offset. Allow
+ * updating a wedge if the only change is the size, and the new
+ * size is larger than the old.
+ */
+ sc = NULL;
+ mutex_enter(&pdk->dk_openlock);
+ LIST_FOREACH(lsc, &pdk->dk_wedges, sc_plink) {
+ if (lsc->sc_offset != dkw->dkw_offset)
+ continue;
+ if (strcmp(lsc->sc_wname, dkw->dkw_wname) != 0)
+ break;
+ if (strcmp(lsc->sc_ptype, dkw->dkw_ptype) != 0)
+ break;
+ if (lsc->sc_size > dkw->dkw_size)
+ break;
+
+ sc = lsc;
+ sc->sc_size = dkw->dkw_size;
+ dk_set_geometry(sc, pdk);
+
+ break;
+ }
+ mutex_exit(&pdk->dk_openlock);
+
+ if (sc != NULL)
+ goto announce;
+
sc = malloc(sizeof(*sc), M_DKWEDGE, M_WAITOK|M_ZERO);
sc->sc_state = DKW_STATE_LARVAL;
sc->sc_parent = pdk;
@@ -475,6 +503,7 @@
/* Disk wedge is ready for use! */
sc->sc_state = DKW_STATE_RUNNING;
+announce:
/* Announce our arrival. */
aprint_normal(
"%s at %s: \"%s\", %"PRIu64" blocks at %"PRId64", type: %s\n",
Home |
Main Index |
Thread Index |
Old Index