Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/raidframe Tidy up comments and do some 80-column fix...



details:   https://anonhg.NetBSD.org/src/rev/8ec5fd263556
branches:  trunk
changeset: 537710:8ec5fd263556
user:      oster <oster%NetBSD.org@localhost>
date:      Fri Oct 04 22:35:08 2002 +0000

description:
Tidy up comments and do some 80-column fixing.  No functional changes.

diffstat:

 sys/dev/raidframe/rf_engine.c |  161 ++++++++++++++++++++++-------------------
 1 files changed, 85 insertions(+), 76 deletions(-)

diffs (truncated from 312 to 300 lines):

diff -r ce6cfd6ed0d6 -r 8ec5fd263556 sys/dev/raidframe/rf_engine.c
--- a/sys/dev/raidframe/rf_engine.c     Fri Oct 04 22:21:57 2002 +0000
+++ b/sys/dev/raidframe/rf_engine.c     Fri Oct 04 22:35:08 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_engine.c,v 1.22 2002/10/04 20:05:15 oster Exp $     */
+/*     $NetBSD: rf_engine.c,v 1.23 2002/10/04 22:35:08 oster Exp $     */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -55,7 +55,7 @@
  ****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.22 2002/10/04 20:05:15 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.23 2002/10/04 22:35:08 oster Exp $");
 
 #include "rf_threadstuff.h"
 
@@ -159,7 +159,9 @@
        if (rf_engineDebug) {
                printf("raid%d: Creating engine thread\n", raidPtr->raidid);
        }
-       if (RF_CREATE_ENGINE_THREAD(raidPtr->engine_thread, DAGExecutionThread, raidPtr,"raid%d",raidPtr->raidid)) {
+       if (RF_CREATE_ENGINE_THREAD(raidPtr->engine_thread, 
+                                   DAGExecutionThread, raidPtr,
+                                   "raid%d", raidPtr->raidid)) {
                RF_ERRORMSG("RAIDFRAME: Unable to create engine thread\n");
                return (ENOMEM);
        }
@@ -209,9 +211,9 @@
                /* node is currently executing, so we're not done */
                return (RF_FALSE);
        case rf_good:
-               for (i = 0; i < node->numSuccedents; i++)       /* for each succedent */
-                       if (!BranchDone(node->succedents[i]))   /* recursively check
-                                                                * branch */
+               /* for each succedent recursively check branch */
+               for (i = 0; i < node->numSuccedents; i++)
+                       if (!BranchDone(node->succedents[i]))
                                return RF_FALSE;
                return RF_TRUE; /* node and all succedent branches aren't in
                                 * fired state */
@@ -242,7 +244,8 @@
        switch (node->dagHdr->status) {
        case rf_enable:
        case rf_rollForward:
-               if ((node->status == rf_wait) && (node->numAntecedents == node->numAntDone))
+               if ((node->status == rf_wait) && 
+                   (node->numAntecedents == node->numAntDone))
                        ready = RF_TRUE;
                else
                        ready = RF_FALSE;
@@ -251,7 +254,8 @@
                RF_ASSERT(node->numSuccDone <= node->numSuccedents);
                RF_ASSERT(node->numSuccFired <= node->numSuccedents);
                RF_ASSERT(node->numSuccFired <= node->numSuccDone);
-               if ((node->status == rf_good) && (node->numSuccDone == node->numSuccedents))
+               if ((node->status == rf_good) && 
+                   (node->numSuccDone == node->numSuccedents))
                        ready = RF_TRUE;
                else
                        ready = RF_FALSE;
@@ -267,11 +271,10 @@
 
 
 
-/* user context and dag-exec-thread context:
- * Fire a node.  The node's status field determines which function, do or undo,
- * to be fired.
- * This routine assumes that the node's status field has alread been set to
- * "fired" or "recover" to indicate the direction of execution.
+/* user context and dag-exec-thread context: Fire a node.  The node's
+ * status field determines which function, do or undo, to be fired.
+ * This routine assumes that the node's status field has alread been
+ * set to "fired" or "recover" to indicate the direction of execution.
  */
 static void 
 FireNode(RF_DagNode_t * node)
@@ -339,9 +342,11 @@
        for (i = 0; i < numNodes; i++) {
                node = nodeList[i];
                dstat = node->dagHdr->status;
-               RF_ASSERT((node->status == rf_wait) || (node->status == rf_good));
+               RF_ASSERT((node->status == rf_wait) || 
+                         (node->status == rf_good));
                if (NodeReady(node)) {
-                       if ((dstat == rf_enable) || (dstat == rf_rollForward)) {
+                       if ((dstat == rf_enable) || 
+                           (dstat == rf_rollForward)) {
                                RF_ASSERT(node->status == rf_wait);
                                if (node->commitNode)
                                        node->dagHdr->numCommits++;
@@ -351,15 +356,16 @@
                        } else {
                                RF_ASSERT(dstat == rf_rollBackward);
                                RF_ASSERT(node->status == rf_good);
-                               RF_ASSERT(node->commitNode == RF_FALSE);        /* only one commit node
-                                                                                * per graph */
+                               /* only one commit node per graph */
+                               RF_ASSERT(node->commitNode == RF_FALSE);
                                node->status = rf_recover;
                        }
                }
        }
        /* now, fire the nodes */
        for (i = 0; i < numNodes; i++) {
-               if ((nodeList[i]->status == rf_fired) || (nodeList[i]->status == rf_recover))
+               if ((nodeList[i]->status == rf_fired) || 
+                   (nodeList[i]->status == rf_recover))
                        FireNode(nodeList[i]);
        }
 }
@@ -381,9 +387,11 @@
                for (node = nodeList; node; node = next) {
                        next = node->next;
                        dstat = node->dagHdr->status;
-                       RF_ASSERT((node->status == rf_wait) || (node->status == rf_good));
+                       RF_ASSERT((node->status == rf_wait) || 
+                                 (node->status == rf_good));
                        if (NodeReady(node)) {
-                               if ((dstat == rf_enable) || (dstat == rf_rollForward)) {
+                               if ((dstat == rf_enable) || 
+                                   (dstat == rf_rollForward)) {
                                        RF_ASSERT(node->status == rf_wait);
                                        if (node->commitNode)
                                                node->dagHdr->numCommits++;
@@ -393,8 +401,8 @@
                                } else {
                                        RF_ASSERT(dstat == rf_rollBackward);
                                        RF_ASSERT(node->status == rf_good);
-                                       RF_ASSERT(node->commitNode == RF_FALSE);        /* only one commit node
-                                                                                        * per graph */
+                                       /* only one commit node per graph */
+                                       RF_ASSERT(node->commitNode == RF_FALSE);
                                        node->status = rf_recover;
                                }
                        }
@@ -402,7 +410,8 @@
                /* now, fire the nodes */
                for (node = nodeList; node; node = next) {
                        next = node->next;
-                       if ((node->status == rf_fired) || (node->status == rf_recover))
+                       if ((node->status == rf_fired) || 
+                           (node->status == rf_recover))
                                FireNode(node);
                }
        }
@@ -534,14 +543,15 @@
                        if (finishlist->commitNode)
                                finishlist->dagHdr->numCommits++;
                        /*
-                        * Okay, here we're calling rf_FinishNode() on nodes that
-                        * have the null function as their work proc. Such a node
-                        * could be the terminal node in a DAG. If so, it will
-                        * cause the DAG to complete, which will in turn free
-                        * memory used by the DAG, which includes the node in
-                        * question. Thus, we must avoid referencing the node
-                        * at all after calling rf_FinishNode() on it.
-                        */
+                        * Okay, here we're calling rf_FinishNode() on
+                        * nodes that have the null function as their
+                        * work proc. Such a node could be the
+                        * terminal node in a DAG. If so, it will
+                        * cause the DAG to complete, which will in
+                        * turn free memory used by the DAG, which
+                        * includes the node in question. Thus, we
+                        * must avoid referencing the node at all
+                        * after calling rf_FinishNode() on it.  */
                        rf_FinishNode(finishlist, context);     /* recursive call */
                }
                /* fire all nodes in firelist */
@@ -565,13 +575,14 @@
                                        if (context != RF_INTR_CONTEXT) {
                                                /* we only have to enqueue if
                                                 * we're at intr context */
-                                               a->next = firelist;     /* put node on a list to
-                                                                        * be fired after we
-                                                                        * unlock */
+                                               /* put node on a list to be 
+                                                  fired after we unlock */
+                                               a->next = firelist;
+
                                                firelist = a;
-                                       } else {        /* enqueue the node for
-                                                        * the dag exec thread
-                                                        * to fire */
+                                       } else {
+                                               /* enqueue the node for the 
+                                                  dag exec thread to fire */
                                                RF_ASSERT(NodeReady(a));
                                                if (q) {
                                                        q->next = a;
@@ -591,19 +602,20 @@
                        DO_SIGNAL(raidPtr);
                }
                DO_UNLOCK(raidPtr);
-               for (; finishlist; finishlist = next) { /* NIL nodes: no need to
-                                                        * fire them */
+               for (; finishlist; finishlist = next) { 
+                       /* NIL nodes: no need to fire them */
                        next = finishlist->next;
                        finishlist->status = rf_good;
                        /*
-                        * Okay, here we're calling rf_FinishNode() on nodes that
-                        * have the null function as their work proc. Such a node
-                        * could be the first node in a DAG. If so, it will
-                        * cause the DAG to complete, which will in turn free
-                        * memory used by the DAG, which includes the node in
-                        * question. Thus, we must avoid referencing the node
-                        * at all after calling rf_FinishNode() on it.
-                        */
+                        * Okay, here we're calling rf_FinishNode() on
+                        * nodes that have the null function as their
+                        * work proc. Such a node could be the first
+                        * node in a DAG. If so, it will cause the DAG
+                        * to complete, which will in turn free memory
+                        * used by the DAG, which includes the node in
+                        * question. Thus, we must avoid referencing
+                        * the node at all after calling
+                        * rf_FinishNode() on it.  */
                        rf_FinishNode(finishlist, context);     /* recursive call */
                }
                /* fire all nodes in firelist */
@@ -636,15 +648,16 @@
                /* normal case, don't need to do anything */
                break;
        case rf_bad:
-               if ((node->dagHdr->numCommits > 0) || (node->dagHdr->numCommitNodes == 0)) {
-                       node->dagHdr->status = rf_rollForward;  /* crossed commit
-                                                                * barrier */
+               if ((node->dagHdr->numCommits > 0) || 
+                   (node->dagHdr->numCommitNodes == 0)) {
+                       /* crossed commit barrier */
+                       node->dagHdr->status = rf_rollForward;  
                        if (rf_engineDebug || 1) {
                                printf("raid%d: node (%s) returned fail, rolling forward\n", raidPtr->raidid, node->name);
                        }
                } else {
-                       node->dagHdr->status = rf_rollBackward; /* never reached commit
-                                                                * barrier */
+                       /* never reached commit barrier */
+                       node->dagHdr->status = rf_rollBackward; 
                        if (rf_engineDebug || 1) {
                                printf("raid%d: node (%s) returned fail, rolling backward\n", raidPtr->raidid, node->name);
                        }
@@ -688,18 +701,16 @@
 }
 
 
-/* user context:
- * submit dag for execution, return non-zero if we have to wait for completion.
- * if and only if we return non-zero, we'll cause cbFunc to get invoked with
- * cbArg when the DAG has completed.
+/* user context: submit dag for execution, return non-zero if we have
+ * to wait for completion.  if and only if we return non-zero, we'll
+ * cause cbFunc to get invoked with cbArg when the DAG has completed.
  *
- * for now we always return 1.  If the DAG does not cause any I/O, then the callback
- * may get invoked before DispatchDAG returns.  There's code in state 5 of ContinueRaidAccess
- * to handle this.
+ * for now we always return 1.  If the DAG does not cause any I/O,
+ * then the callback may get invoked before DispatchDAG returns.
+ * There's code in state 5 of ContinueRaidAccess to handle this.
  *
- * All we do here is fire the direct successors of the header node.  The
- * DAG execution thread does the rest of the dag processing.
- */
+ * All we do here is fire the direct successors of the header node.
+ * The DAG execution thread does the rest of the dag processing.  */
 int 
 rf_DispatchDAG(
     RF_DagHeader_t * dag,
@@ -732,15 +743,12 @@
        FireNodeArray(dag->numSuccedents, dag->succedents);
        return (1);
 }
-/* dedicated kernel thread:
- * the thread that handles all DAG node firing.
- * To minimize locking and unlocking, we grab a copy of the entire node queue and then set the
- * node queue to NULL before doing any firing of nodes.  This way we only have to release the
- * lock once.  Of course, it's probably rare that there's more than one node in the queue at
- * any one time, but it sometimes happens.
- *
- * In the kernel, this thread runs at spl0 and is not swappable.  I copied these
- * characteristics from the aio_completion_thread.
+/* dedicated kernel thread: the thread that handles all DAG node
+ * firing.  To minimize locking and unlocking, we grab a copy of the
+ * entire node queue and then set the node queue to NULL before doing
+ * any firing of nodes.  This way we only have to release the lock
+ * once.  Of course, it's probably rare that there's more than one
+ * node in the queue at any one time, but it sometimes happens.  
  */
 
 static void 
@@ -840,11 +848,12 @@
 }
 
 /* 
-   rf_RaidIOThread() -- When I/O to a component completes, KernelWakeupFunc()
-   puts the completed request onto raidPtr->iodone TAILQ.  This function



Home | Main Index | Thread Index | Old Index