Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev revert 1.90 of dksubr.c and change sc_deferred back ...
details: https://anonhg.NetBSD.org/src/rev/2cadc8ab9466
branches: trunk
changeset: 348545:2cadc8ab9466
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Mon Oct 24 17:14:27 2016 +0000
description:
revert 1.90 of dksubr.c and change sc_deferred back to simple pointer; the
global sc_busy flag guards against race so it's not actually necessary, and
this place is unlikely to need to be parallelized in near future
discussed with mlelstv@
diffstat:
sys/dev/dksubr.c | 33 ++++++++++++++++-----------------
sys/dev/dkvar.h | 4 ++--
2 files changed, 18 insertions(+), 19 deletions(-)
diffs (103 lines):
diff -r e0c07486d853 -r 2cadc8ab9466 sys/dev/dksubr.c
--- a/sys/dev/dksubr.c Mon Oct 24 06:04:26 2016 +0000
+++ b/sys/dev/dksubr.c Mon Oct 24 17:14:27 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.90 2016/10/22 22:32:33 jdolecek Exp $ */
+/* $NetBSD: dksubr.c,v 1.91 2016/10/24 17:14:27 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.90 2016/10/22 22:32:33 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.91 2016/10/24 17:14:27 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -105,8 +105,6 @@
/* Attach the device into the rnd source list. */
rnd_attach_source(&dksc->sc_rnd_source, dksc->sc_xname,
RND_TYPE_DISK, RND_FLAG_DEFAULT);
-
- TAILQ_INIT(&dksc->sc_deferred);
}
void
@@ -380,27 +378,25 @@
*
* So when a diskstart fails, the buffer is saved
* and tried again before the next buffer is fetched.
- * dk_drain() handles flushing of a saved buffer(s).
+ * dk_drain() handles flushing of a saved buffer.
*
* This keeps order of I/O operations, unlike bufq_put.
*/
- for(;;) {
- bp = TAILQ_FIRST(&dksc->sc_deferred);
- if (__predict_false(bp != NULL))
- TAILQ_REMOVE(&dksc->sc_deferred, bp, b_actq);
- else {
- bp = bufq_get(dksc->sc_bufq);
- if (bp == NULL)
- break;
- }
+ bp = dksc->sc_deferred;
+ dksc->sc_deferred = NULL;
+
+ if (bp == NULL)
+ bp = bufq_get(dksc->sc_bufq);
+
+ while (bp != NULL) {
disk_busy(&dksc->sc_dkdev);
mutex_exit(&dksc->sc_iolock);
error = dkd->d_diskstart(dksc->sc_dev, bp);
mutex_enter(&dksc->sc_iolock);
if (error == EAGAIN) {
- TAILQ_INSERT_TAIL(&dksc->sc_deferred, bp, b_actq);
+ dksc->sc_deferred = bp;
disk_unbusy(&dksc->sc_dkdev, 0, (bp->b_flags & B_READ));
break;
}
@@ -410,6 +406,8 @@
bp->b_resid = bp->b_bcount;
dk_done1(dksc, bp, false);
}
+
+ bp = bufq_get(dksc->sc_bufq);
}
dksc->sc_busy = false;
@@ -453,8 +451,9 @@
struct buf *bp;
mutex_enter(&dksc->sc_iolock);
- while ((bp = TAILQ_FIRST(&dksc->sc_deferred)) != NULL) {
- TAILQ_REMOVE(&dksc->sc_deferred, bp, b_actq);
+ bp = dksc->sc_deferred;
+ dksc->sc_deferred = NULL;
+ if (bp != NULL) {
bp->b_error = EIO;
bp->b_resid = bp->b_bcount;
biodone(bp);
diff -r e0c07486d853 -r 2cadc8ab9466 sys/dev/dkvar.h
--- a/sys/dev/dkvar.h Mon Oct 24 06:04:26 2016 +0000
+++ b/sys/dev/dkvar.h Mon Oct 24 17:14:27 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dkvar.h,v 1.26 2016/10/22 22:32:33 jdolecek Exp $ */
+/* $NetBSD: dkvar.h,v 1.27 2016/10/24 17:14:27 jdolecek Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
kmutex_t sc_iolock; /* protects buffer queue */
struct bufq_state *sc_bufq; /* buffer queue */
int sc_dtype; /* disk type */
- TAILQ_HEAD(, buf) sc_deferred; /* retry after start failed */
+ struct buf *sc_deferred; /* retry after start failed */
bool sc_busy; /* processing buffers */
krndsource_t sc_rnd_source; /* entropy source */
};
Home |
Main Index |
Thread Index |
Old Index