Module Name: src
Committed By: pgoyette
Date: Sun Jul 17 21:39:17 UTC 2016
Modified Files:
src/sys/kern [pgoyette-localcount]: init_main.c subr_devsw.c
src/sys/sys [pgoyette-localcount]: conf.h
Log Message:
Instead of initializing the 'pserialize_t psz' while holding a lock,
create a new devsw_detach_init() routine to hande this, and call it
after the pserialize system has been initialized.
To generate a diff of this commit:
cvs rdiff -u -r1.482 -r1.482.2.1 src/sys/kern/init_main.c
cvs rdiff -u -r1.34.2.5 -r1.34.2.6 src/sys/kern/subr_devsw.c
cvs rdiff -u -r1.146.2.1 -r1.146.2.2 src/sys/sys/conf.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.482 src/sys/kern/init_main.c:1.482.2.1
--- src/sys/kern/init_main.c:1.482 Thu Jul 7 06:55:43 2016
+++ src/sys/kern/init_main.c Sun Jul 17 21:39:17 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: init_main.c,v 1.482 2016/07/07 06:55:43 msaitoh Exp $ */
+/* $NetBSD: init_main.c,v 1.482.2.1 2016/07/17 21:39:17 pgoyette Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.482 2016/07/07 06:55:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.482.2.1 2016/07/17 21:39:17 pgoyette Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@@ -311,6 +311,9 @@ main(void)
/* Passive serialization. */
pserialize_init();
+ /* Init the detach capability in devsw */
+ devsw_detach_init();
+
/* Initialize the extent manager. */
extent_init();
Index: src/sys/kern/subr_devsw.c
diff -u src/sys/kern/subr_devsw.c:1.34.2.5 src/sys/kern/subr_devsw.c:1.34.2.6
--- src/sys/kern/subr_devsw.c:1.34.2.5 Sun Jul 17 12:09:21 2016
+++ src/sys/kern/subr_devsw.c Sun Jul 17 21:39:17 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_devsw.c,v 1.34.2.5 2016/07/17 12:09:21 pgoyette Exp $ */
+/* $NetBSD: subr_devsw.c,v 1.34.2.6 2016/07/17 21:39:17 pgoyette Exp $ */
/*-
* Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.5 2016/07/17 12:09:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.6 2016/07/17 21:39:17 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_dtrace.h"
@@ -127,6 +127,13 @@ devsw_init(void)
cv_init(&device_cv, "devsw");
}
+void
+devsw_detach_init(void)
+{
+
+ device_psz = pserialize_create();
+}
+
int
devsw_attach(const char *devname,
const struct bdevsw *bdev, devmajor_t *bmajor,
@@ -397,12 +404,7 @@ devsw_detach_locked(const struct bdevsw
if (j < max_cdevsws )
cdevsw[j] = NULL;
- /*
- * If we haven't already done so, create the serialization
- * stucture. Then wait for all current readers to finish.
- */
- if(__predict_false(device_psz == NULL))
- device_psz = pserialize_create();
+ /* Wait for all current readers to finish with the devsw */
pserialize_perform(device_psz);
/*
Index: src/sys/sys/conf.h
diff -u src/sys/sys/conf.h:1.146.2.1 src/sys/sys/conf.h:1.146.2.2
--- src/sys/sys/conf.h:1.146.2.1 Sat Jul 16 07:54:13 2016
+++ src/sys/sys/conf.h Sun Jul 17 21:39:17 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.h,v 1.146.2.1 2016/07/16 07:54:13 pgoyette Exp $ */
+/* $NetBSD: conf.h,v 1.146.2.2 2016/07/17 21:39:17 pgoyette Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -270,6 +270,7 @@ struct devsw_conv {
};
void devsw_init(void);
+void devsw_detach_init(void);
const char *devsw_blk2name(devmajor_t);
const char *cdevsw_getname(devmajor_t);
const char *bdevsw_getname(devmajor_t);