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): Omit redundant microoptimization arou...
details: https://anonhg.NetBSD.org/src/rev/1c16683b4434
branches: trunk
changeset: 359662:1c16683b4434
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Jan 15 19:34:11 2022 +0000
description:
dk(4): Omit redundant microoptimization around cv_broadcast.
cv_broadcast already has a fast path for the no-waiter case.
diffstat:
sys/dev/dkwedge/dk.c | 20 +++++---------------
1 files changed, 5 insertions(+), 15 deletions(-)
diffs (68 lines):
diff -r 6857d0612df6 -r 1c16683b4434 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c Sat Jan 15 19:34:07 2022 +0000
+++ b/sys/dev/dkwedge/dk.c Sat Jan 15 19:34:11 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.109 2021/10/18 11:40:56 simonb Exp $ */
+/* $NetBSD: dk.c,v 1.110 2022/01/15 19:34:11 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.109 2021/10/18 11:40:56 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.110 2022/01/15 19:34:11 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -89,12 +89,9 @@
kmutex_t sc_iolock;
kcondvar_t sc_dkdrn;
u_int sc_iopend; /* I/Os pending */
- int sc_flags; /* flags (sc_iolock) */
int sc_mode; /* parent open mode */
};
-#define DK_F_WAIT_DRAIN 0x0001 /* waiting for I/O to drain */
-
static void dkstart(struct dkwedge_softc *);
static void dkiodone(struct buf *);
static void dkrestart(void *);
@@ -194,10 +191,8 @@
{
mutex_enter(&sc->sc_iolock);
- while (sc->sc_iopend != 0) {
- sc->sc_flags |= DK_F_WAIT_DRAIN;
+ while (sc->sc_iopend != 0)
cv_wait(&sc->sc_dkdrn, &sc->sc_iolock);
- }
mutex_exit(&sc->sc_iolock);
}
@@ -1341,11 +1336,8 @@
while ((bp = bufq_peek(sc->sc_bufq)) != NULL) {
if (sc->sc_state != DKW_STATE_RUNNING) {
(void) bufq_get(sc->sc_bufq);
- if (sc->sc_iopend-- == 1 &&
- (sc->sc_flags & DK_F_WAIT_DRAIN) != 0) {
- sc->sc_flags &= ~DK_F_WAIT_DRAIN;
+ if (--sc->sc_iopend == 0)
cv_broadcast(&sc->sc_dkdrn);
- }
mutex_exit(&sc->sc_iolock);
bp->b_error = ENXIO;
bp->b_resid = bp->b_bcount;
@@ -1430,10 +1422,8 @@
putiobuf(bp);
mutex_enter(&sc->sc_iolock);
- if (sc->sc_iopend-- == 1 && (sc->sc_flags & DK_F_WAIT_DRAIN) != 0) {
- sc->sc_flags &= ~DK_F_WAIT_DRAIN;
+ if (--sc->sc_iopend == 0)
cv_broadcast(&sc->sc_dkdrn);
- }
disk_unbusy(&sc->sc_dk, obp->b_bcount - obp->b_resid,
obp->b_flags & B_READ);
Home |
Main Index |
Thread Index |
Old Index