summaryrefslogtreecommitdiff
path: root/sys/dev/dkwedge
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2023-04-21 18:44:58 +0000
committerriastradh <riastradh@NetBSD.org>2023-04-21 18:44:58 +0000
commit42e375244a7659203dfeab0023dca44e0c9d02ea (patch)
tree3063f01e64c3944190540c2f1a8308b28d0a384a /sys/dev/dkwedge
parent6048a439523fe9fb016c5c228dec66f2e3bbc996 (diff)
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.
Diffstat (limited to 'sys/dev/dkwedge')
-rw-r--r--sys/dev/dkwedge/dk.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/sys/dev/dkwedge/dk.c b/sys/dev/dkwedge/dk.c
index 2e40b0f16c2..614a2e426fd 100644
--- a/sys/dev/dkwedge/dk.c
+++ b/sys/dev/dkwedge/dk.c
@@ -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 *va, size_t size)
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 *va, size_t size)
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;
}