Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/dkwedge dk(4): Use device_lookup_private for dkwedge...



details:   https://anonhg.NetBSD.org/src/rev/87724e6b7f8d
branches:  trunk
changeset: 375929:87724e6b7f8d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon May 22 14:58:50 2023 +0000

description:
dk(4): Use device_lookup_private for dkwedge_lookup.

No longer necessary to go through the dkwedges array.

Currently device_lookup_private still involves touching other global
locks, but that will change eventually to a lockless pserialized fast
path.

diffstat:

 sys/dev/dkwedge/dk.c |  15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diffs (37 lines):

diff -r 2cd3c1b0a81a -r 87724e6b7f8d sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Mon May 22 14:58:41 2023 +0000
+++ b/sys/dev/dkwedge/dk.c      Mon May 22 14:58:50 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.160 2023/05/22 14:58:41 riastradh Exp $       */
+/*     $NetBSD: dk.c,v 1.161 2023/05/22 14:58:50 riastradh 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.160 2023/05/22 14:58:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.161 2023/05/22 14:58:50 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1164,17 +1164,8 @@ dkwedge_read(struct disk *pdk, struct vn
 static struct dkwedge_softc *
 dkwedge_lookup(dev_t dev)
 {
-       const int unit = minor(dev);
-       struct dkwedge_softc *sc;
 
-       rw_enter(&dkwedges_lock, RW_READER);
-       if (unit < 0 || unit >= ndkwedges)
-               sc = NULL;
-       else
-               sc = dkwedges[unit];
-       rw_exit(&dkwedges_lock);
-
-       return sc;
+       return device_lookup_private(&dk_cd, minor(dev));
 }
 
 static int



Home | Main Index | Thread Index | Old Index