Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe Add two more debugging #defines: RF_DEBUG_...



details:   https://anonhg.NetBSD.org/src/rev/29afed9a080d
branches:  trunk
changeset: 536389:29afed9a080d
user:      oster <oster%NetBSD.org@localhost>
date:      Sat Sep 14 17:11:30 2002 +0000

description:
Add two more debugging #defines: RF_DEBUG_RECONBUFFER and RF_DEBUG_VERIFYPARITY.
Use them to reduce kernel bloat by a little more.

diffstat:

 sys/dev/raidframe/rf_archs.h      |  10 +++++++++-
 sys/dev/raidframe/rf_parityscan.c |  10 ++++++++--
 sys/dev/raidframe/rf_raid1.c      |  26 ++++++++++++++++++++++++--
 3 files changed, 41 insertions(+), 5 deletions(-)

diffs (219 lines):

diff -r f80bdb9b16f1 -r 29afed9a080d sys/dev/raidframe/rf_archs.h
--- a/sys/dev/raidframe/rf_archs.h      Sat Sep 14 16:56:10 2002 +0000
+++ b/sys/dev/raidframe/rf_archs.h      Sat Sep 14 17:11:30 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_archs.h,v 1.14 2002/09/11 02:51:21 oster Exp $      */
+/*     $NetBSD: rf_archs.h,v 1.15 2002/09/14 17:11:30 oster Exp $      */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -116,6 +116,14 @@
 #define RF_DEBUG_STRIPELOCK 0
 #endif
 
+#ifndef RF_DEBUG_RECONBUFFER
+#define RF_DEBUG_RECONBUFFER 0
+#endif
+
+#ifndef RF_DEBUG_VERIFYPARITY
+#define RF_DEBUG_VERIFYPARITY 0
+#endif
+
 #include "rf_options.h"
 
 #endif                         /* !_RF__RF_ARCHS_H_ */
diff -r f80bdb9b16f1 -r 29afed9a080d sys/dev/raidframe/rf_parityscan.c
--- a/sys/dev/raidframe/rf_parityscan.c Sat Sep 14 16:56:10 2002 +0000
+++ b/sys/dev/raidframe/rf_parityscan.c Sat Sep 14 17:11:30 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_parityscan.c,v 1.13 2002/07/13 20:14:34 oster Exp $ */
+/*     $NetBSD: rf_parityscan.c,v 1.14 2002/09/14 17:11:30 oster Exp $ */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  *****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.13 2002/07/13 20:14:34 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.14 2002/09/14 17:11:30 oster Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -333,18 +333,24 @@
        if (raidPtr->Disks[pda->row][pda->col].status == rf_ds_reconstructing) {
                if (rf_CheckRUReconstructed(raidPtr->reconControl[pda->row]->reconMap, pda->startSector)) {
                        if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) {
+#if RF_DEBUG_VERIFYPARITY
                                RF_RowCol_t or = pda->row, oc = pda->col;
                                RF_SectorNum_t os = pda->startSector;
+#endif
                                if (parity) {
                                        (raidPtr->Layout.map->MapParity) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP);
+#if RF_DEBUG_VERIFYPARITY
                                        if (rf_verifyParityDebug)
                                                printf("VerifyParity: Redir P r %d c %d sect %ld -> r %d c %d sect %ld\n",
                                                    or, oc, (long) os, pda->row, pda->col, (long) pda->startSector);
+#endif
                                } else {
                                        (raidPtr->Layout.map->MapSector) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP);
+#if RF_DEBUG_VERIFYPARITY
                                        if (rf_verifyParityDebug)
                                                printf("VerifyParity: Redir D r %d c %d sect %ld -> r %d c %d sect %ld\n",
                                                    or, oc, (long) os, pda->row, pda->col, (long) pda->startSector);
+#endif
                                }
                        } else {
                                RF_RowCol_t spRow = raidPtr->Disks[pda->row][pda->col].spareRow;
diff -r f80bdb9b16f1 -r 29afed9a080d sys/dev/raidframe/rf_raid1.c
--- a/sys/dev/raidframe/rf_raid1.c      Sat Sep 14 16:56:10 2002 +0000
+++ b/sys/dev/raidframe/rf_raid1.c      Sat Sep 14 17:11:30 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_raid1.c,v 1.9 2002/07/13 20:14:34 oster Exp $       */
+/*     $NetBSD: rf_raid1.c,v 1.10 2002/09/14 17:11:30 oster Exp $      */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  *****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.9 2002/07/13 20:14:34 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.10 2002/09/14 17:11:30 oster Exp $");
 
 #include "rf_raid.h"
 #include "rf_raid1.h"
@@ -320,11 +320,13 @@
        RF_MallocAndAdd(buf, bcount, (char *), allocList);
        if (buf == NULL)
                goto done;
+#if RF_DEBUG_VERIFYPARITY
        if (rf_verifyParityDebug) {
                printf("raid%d: RAID1 parity verify: buf=%lx bcount=%d (%lx - %lx)\n",
                       raidPtr->raidid, (long) buf, bcount, (long) buf, 
                       (long) buf + bcount);
        }
+#endif
        /*
          * Generate a DAG which will read the entire stripe- then we can
          * just compare data chunks versus "parity" chunks.
@@ -435,13 +437,16 @@
          * Check data vs "parity" (mirror copy).
          */
        for (i = 0; i < layoutPtr->numDataCol; i++) {
+#if RF_DEBUG_VERIFYPARITY
                if (rf_verifyParityDebug) {
                        printf("raid%d: RAID1 parity verify %d bytes: i=%d buf1=%lx buf2=%lx buf=%lx\n",
                               raidPtr->raidid, nbytes, i, (long) buf1, 
                               (long) buf2, (long) buf);
                }
+#endif
                ret = memcmp(buf1, buf2, nbytes);
                if (ret) {
+#if RF_DEBUG_VERIFYPARITY
                        if (rf_verifyParityDebug > 1) {
                                for (j = 0; j < nbytes; j++) {
                                        if (buf1[j] != buf2[j])
@@ -456,6 +461,7 @@
                        if (rf_verifyParityDebug) {
                                printf("raid%d: RAID1: found bad parity, i=%d\n", raidPtr->raidid, i);
                        }
+#endif
                        /*
                         * Parity is bad. Keep track of which columns were bad.
                         */
@@ -470,9 +476,11 @@
 
        if ((ret != RF_PARITY_OKAY) && correct_it) {
                ret = RF_PARITY_COULD_NOT_CORRECT;
+#if RF_DEBUG_VERIFYPARITY
                if (rf_verifyParityDebug) {
                        printf("raid%d: RAID1 parity verify: parity not correct\n", raidPtr->raidid);
                }
+#endif
                if (bbufs == NULL)
                        goto done;
                /*
@@ -537,10 +545,12 @@
        if (mcpair)
                rf_FreeMCPair(mcpair);
        rf_FreeAllocList(allocList);
+#if RF_DEBUG_VERIFYPARITY
        if (rf_verifyParityDebug) {
                printf("raid%d: RAID1 parity verify, returning %d\n", 
                       raidPtr->raidid, ret);
        }
+#endif
        return (ret);
 }
 
@@ -571,12 +581,14 @@
        RF_ASSERT(rbuf);
        RF_ASSERT(rbuf->col != reconCtrlPtr->fcol);
 
+#if RF_DEBUG_RECONBUFFER
        if (rf_reconbufferDebug) {
                printf("raid%d: RAID1 reconbuffer submission r%d c%d psid %ld ru%d (failed offset %ld)\n",
                       raidPtr->raidid, rbuf->row, rbuf->col, 
                       (long) rbuf->parityStripeID, rbuf->which_ru,
                       (long) rbuf->failedDiskSectorOffset);
        }
+#endif
        if (rf_reconDebug) {
                printf("RAID1 reconbuffer submit psid %ld buf %lx\n",
                    (long) rbuf->parityStripeID, (long) rbuf->buffer);
@@ -601,34 +613,42 @@
 
        t = NULL;
        if (keep_it) {
+#if RF_DEBUG_RECONBUFFER
                if (rf_reconbufferDebug) {
                        printf("raid%d: RAID1 rbuf submission: keeping rbuf\n", 
                               raidPtr->raidid);
                }
+#endif
                t = rbuf;
        } else {
                if (use_committed) {
+#if RF_DEBUG_RECONBUFFER
                        if (rf_reconbufferDebug) {
                                printf("raid%d: RAID1 rbuf submission: using committed rbuf\n", raidPtr->raidid);
                        }
+#endif
                        t = reconCtrlPtr->committedRbufs;
                        RF_ASSERT(t);
                        reconCtrlPtr->committedRbufs = t->next;
                        t->next = NULL;
                } else
                        if (reconCtrlPtr->floatingRbufs) {
+#if RF_DEBUG_RECONBUFFER
                                if (rf_reconbufferDebug) {
                                        printf("raid%d: RAID1 rbuf submission: using floating rbuf\n", raidPtr->raidid);
                                }
+#endif
                                t = reconCtrlPtr->floatingRbufs;
                                reconCtrlPtr->floatingRbufs = t->next;
                                t->next = NULL;
                        }
        }
        if (t == NULL) {
+#if RF_DEBUG_RECONBUFFER
                if (rf_reconbufferDebug) {
                        printf("raid%d: RAID1 rbuf submission: waiting for rbuf\n", raidPtr->raidid);
                }
+#endif
                RF_ASSERT((keep_it == 0) && (use_committed == 0));
                raidPtr->procsInBufWait++;
                if ((raidPtr->procsInBufWait == (raidPtr->numCol - 1))
@@ -686,9 +706,11 @@
 out:
        RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->row, rbuf->parityStripeID);
        RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
+#if RF_DEBUG_RECONBUFFER
        if (rf_reconbufferDebug) {
                printf("raid%d: RAID1 rbuf submission: returning %d\n", 
                       raidPtr->raidid, retcode);
        }
+#endif
        return (retcode);
 }



Home | Main Index | Thread Index | Old Index