Module Name: src
Committed By: riastradh
Date: Fri Apr 21 18:44:59 UTC 2023
Modified Files:
src/sys/dev/dkwedge: dk.c
Log Message:
dk(4): Omit needless locking in dksize, dkdump.
All the members these use are stable after initialization, except for
the wedge size, which dkwedge_size safely reads a snapshot of without
locking in the caller.
To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/dev/dkwedge/dk.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.145 src/sys/dev/dkwedge/dk.c:1.146
--- src/sys/dev/dkwedge/dk.c:1.145 Fri Apr 21 18:44:18 2023
+++ src/sys/dev/dkwedge/dk.c Fri Apr 21 18:44:58 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.145 2023/04/21 18:44:18 riastradh Exp $ */
+/* $NetBSD: dk.c,v 1.146 2023/04/21 18:44:58 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.145 2023/04/21 18:44:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.146 2023/04/21 18:44:58 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -1809,9 +1809,6 @@ dksize(dev_t dev)
if (sc->sc_state != DKW_STATE_RUNNING)
return -1;
- mutex_enter(&sc->sc_dk.dk_openlock);
- mutex_enter(&sc->sc_parent->dk_rawlock);
-
/* Our content type is static, no need to open the device. */
p_size = dkwedge_size(sc) << sc->sc_parent->dk_blkshift;
@@ -1823,9 +1820,6 @@ dksize(dev_t dev)
rv = (int)p_size;
}
- mutex_exit(&sc->sc_parent->dk_rawlock);
- mutex_exit(&sc->sc_dk.dk_openlock);
-
return rv;
}
@@ -1847,9 +1841,6 @@ dkdump(dev_t dev, daddr_t blkno, void *v
if (sc->sc_state != DKW_STATE_RUNNING)
return ENXIO;
- mutex_enter(&sc->sc_dk.dk_openlock);
- mutex_enter(&sc->sc_parent->dk_rawlock);
-
/* Our content type is static, no need to open the device. */
if (strcmp(sc->sc_ptype, DKW_PTYPE_SWAP) != 0 &&
@@ -1878,9 +1869,6 @@ dkdump(dev_t dev, daddr_t blkno, void *v
rv = (*bdev->d_dump)(sc->sc_pdev, blkno + p_offset, va, size);
out:
- mutex_exit(&sc->sc_parent->dk_rawlock);
- mutex_exit(&sc->sc_dk.dk_openlock);
-
return rv;
}