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): Explain why no need for device refere...



details:   https://anonhg.NetBSD.org/src/rev/1ce0d089092a
branches:  trunk
changeset: 375938:1ce0d089092a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon May 22 15:00:06 2023 +0000

description:
dk(4): Explain why no need for device reference in dksize, dkdump.

diffstat:

 sys/dev/dkwedge/dk.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r bf1573f77c89 -r 1ce0d089092a sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Mon May 22 14:59:58 2023 +0000
+++ b/sys/dev/dkwedge/dk.c      Mon May 22 15:00:06 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.169 2023/05/22 14:59:58 riastradh Exp $       */
+/*     $NetBSD: dk.c,v 1.170 2023/05/22 15:00:06 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.169 2023/05/22 14:59:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.170 2023/05/22 15:00:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1824,6 +1824,11 @@ dkdiscard(dev_t dev, off_t pos, off_t le
 static int
 dksize(dev_t dev)
 {
+       /*
+        * Don't bother taking a reference because this is only used
+        * either (a) while the device is open (for swap), or (b) while
+        * any multiprocessing is quiescent (for crash dumps).
+        */
        struct dkwedge_softc *sc = dkwedge_lookup(dev);
        uint64_t p_size;
        int rv = -1;
@@ -1855,6 +1860,10 @@ dksize(dev_t dev)
 static int
 dkdump(dev_t dev, daddr_t blkno, void *va, size_t size)
 {
+       /*
+        * Don't bother taking a reference because this is only used
+        * while any multiprocessing is quiescent.
+        */
        struct dkwedge_softc *sc = dkwedge_lookup(dev);
        const struct bdevsw *bdev;
        uint64_t p_size, p_offset;



Home | Main Index | Thread Index | Old Index