Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jdolecek-ncqfixes]: src/sys/dev/ata switch from TAILQ to SIMPLEQ for ata...
details: https://anonhg.NetBSD.org/src/rev/48ff88b31977
branches: jdolecek-ncqfixes
changeset: 1025074:48ff88b31977
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Mon Sep 17 19:00:43 2018 +0000
description:
switch from TAILQ to SIMPLEQ for ata_xfer pending queue to save
space, don't need doubly linked queue
diffstat:
sys/dev/ata/ata.c | 21 +++++++++++----------
sys/dev/ata/ata_subr.c | 6 +++---
sys/dev/ata/atavar.h | 6 +++---
3 files changed, 17 insertions(+), 16 deletions(-)
diffs (142 lines):
diff -r 6e46957d6492 -r 48ff88b31977 sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Mon Sep 17 18:36:13 2018 +0000
+++ b/sys/dev/ata/ata.c Mon Sep 17 19:00:43 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ata.c,v 1.141.6.3 2018/09/17 18:36:13 jdolecek Exp $ */
+/* $NetBSD: ata.c,v 1.141.6.4 2018/09/17 19:00:43 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.3 2018/09/17 18:36:13 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.4 2018/09/17 19:00:43 jdolecek Exp $");
#include "opt_ata.h"
@@ -1062,10 +1062,10 @@
* recovery commands must be run immediatelly.
*/
if ((xfer->c_flags & C_RECOVERY) == 0)
- TAILQ_INSERT_TAIL(&chp->ch_queue->queue_xfer, xfer,
+ SIMPLEQ_INSERT_TAIL(&chp->ch_queue->queue_xfer, xfer,
c_xferchain);
else
- TAILQ_INSERT_HEAD(&chp->ch_queue->queue_xfer, xfer,
+ SIMPLEQ_INSERT_HEAD(&chp->ch_queue->queue_xfer, xfer,
c_xferchain);
/*
@@ -1073,7 +1073,7 @@
*/
if ((xfer->c_flags & (C_POLL | C_WAIT)) == (C_POLL | C_WAIT)) {
while (chp->ch_queue->queue_active > 0 ||
- TAILQ_FIRST(&chp->ch_queue->queue_xfer) != xfer) {
+ SIMPLEQ_FIRST(&chp->ch_queue->queue_xfer) != xfer) {
xfer->c_flags |= C_WAITACT;
cv_wait(&chp->ch_queue->c_active, &chp->ch_lock);
xfer->c_flags &= ~C_WAITACT;
@@ -1137,7 +1137,7 @@
}
/* is there a xfer ? */
- if ((xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer)) == NULL) {
+ if ((xfer = SIMPLEQ_FIRST(&chp->ch_queue->queue_xfer)) == NULL) {
ATADEBUG_PRINT(("%s(chp=%p): channel %d queue_xfer is empty\n",
__func__, chp, chp->ch_channel), DEBUG_XFERS);
goto out;
@@ -1207,6 +1207,8 @@
else
CLR(chp->ch_flags, ATACH_NCQ);
+ SIMPLEQ_REMOVE_HEAD(&chq->queue_xfer, c_xferchain);
+
ata_activate_xfer_locked(chp, xfer);
if (atac->atac_cap & ATAC_CAP_NOIRQ)
@@ -1275,7 +1277,6 @@
KASSERT(chq->queue_active < chq->queue_openings);
KASSERT((chq->active_xfers_used & __BIT(xfer->c_slot)) == 0);
- TAILQ_REMOVE(&chq->queue_xfer, xfer, c_xferchain);
if ((xfer->c_flags & C_RECOVERY) == 0)
TAILQ_INSERT_TAIL(&chq->active_xfers, xfer, c_activechain);
else {
@@ -1419,18 +1420,18 @@
{
struct ata_channel * const chp = drvp->chnl_softc;
struct ata_queue * const chq = chp->ch_queue;
- struct ata_xfer *xfer, *xfernext;
+ struct ata_xfer *xfer;
ata_channel_lock(chp);
/* Kill all pending transfers */
- TAILQ_FOREACH_SAFE(xfer, &chq->queue_xfer, c_xferchain, xfernext) {
+ while ((xfer = SIMPLEQ_FIRST(&chq->queue_xfer))) {
KASSERT(xfer->c_chp == chp);
if (xfer->c_drive != drvp->drive)
continue;
- TAILQ_REMOVE(&chp->ch_queue->queue_xfer, xfer, c_xferchain);
+ SIMPLEQ_REMOVE_HEAD(&chp->ch_queue->queue_xfer, c_xferchain);
/*
* Keep the lock, so that we get deadlock (and 'locking against
diff -r 6e46957d6492 -r 48ff88b31977 sys/dev/ata/ata_subr.c
--- a/sys/dev/ata/ata_subr.c Mon Sep 17 18:36:13 2018 +0000
+++ b/sys/dev/ata/ata_subr.c Mon Sep 17 19:00:43 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ata_subr.c,v 1.6.2.2 2018/09/17 18:36:13 jdolecek Exp $ */
+/* $NetBSD: ata_subr.c,v 1.6.2.3 2018/09/17 19:00:43 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata_subr.c,v 1.6.2.2 2018/09/17 18:36:13 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_subr.c,v 1.6.2.3 2018/09/17 19:00:43 jdolecek Exp $");
#include "opt_ata.h"
@@ -70,7 +70,7 @@
ata_queue_reset(struct ata_queue *chq)
{
/* make sure that we can use polled commands */
- TAILQ_INIT(&chq->queue_xfer);
+ SIMPLEQ_INIT(&chq->queue_xfer);
TAILQ_INIT(&chq->active_xfers);
chq->queue_freeze = 0;
chq->queue_active = 0;
diff -r 6e46957d6492 -r 48ff88b31977 sys/dev/ata/atavar.h
--- a/sys/dev/ata/atavar.h Mon Sep 17 18:36:13 2018 +0000
+++ b/sys/dev/ata/atavar.h Mon Sep 17 19:00:43 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atavar.h,v 1.99.2.2 2018/09/17 18:36:13 jdolecek Exp $ */
+/* $NetBSD: atavar.h,v 1.99.2.3 2018/09/17 19:00:43 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -160,7 +160,7 @@
#define c_scsipi u.c_scsipi
/* Link on the command queue. */
- TAILQ_ENTRY(ata_xfer) c_xferchain;
+ SIMPLEQ_ENTRY(ata_xfer) c_xferchain;
TAILQ_ENTRY(ata_xfer) c_activechain;
/* Links for error handling */
@@ -223,7 +223,7 @@
#define QF_NEED_XFER 0x02 /* someone wants xfer */
int8_t queue_active; /* number of active transfers */
uint8_t queue_openings; /* max number of active xfers */
- TAILQ_HEAD(, ata_xfer) queue_xfer; /* queue of pending commands */
+ SIMPLEQ_HEAD(, ata_xfer) queue_xfer; /* queue of pending commands */
int queue_freeze; /* freeze count for the queue */
kcondvar_t queue_busy; /* c: waiting of xfer */
kcondvar_t queue_drain; /* c: waiting of queue drain */
Home |
Main Index |
Thread Index |
Old Index