From 954775e02cbfedd06104952e24f5943c8f8bc80a Mon Sep 17 00:00:00 2001 From: oster Date: Sat, 14 Sep 2002 17:11:30 +0000 Subject: [PATCH] Add two more debugging #defines: RF_DEBUG_RECONBUFFER and RF_DEBUG_VERIFYPARITY. Use them to reduce kernel bloat by a little more. --- 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(-) diff --git a/sys/dev/raidframe/rf_archs.h b/sys/dev/raidframe/rf_archs.h index b843437f32a6..f77502cb7d89 100644 --- a/sys/dev/raidframe/rf_archs.h +++ b/sys/dev/raidframe/rf_archs.h @@ -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 --git a/sys/dev/raidframe/rf_parityscan.c b/sys/dev/raidframe/rf_parityscan.c index a39e9ab50c2e..abdb1da26cd7 100644 --- a/sys/dev/raidframe/rf_parityscan.c +++ b/sys/dev/raidframe/rf_parityscan.c @@ -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 -__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 @@ -333,18 +333,24 @@ rf_TryToRedirectPDA(raidPtr, pda, parity) 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 --git a/sys/dev/raidframe/rf_raid1.c b/sys/dev/raidframe/rf_raid1.c index f36fbe829e4e..2e01e18be2c3 100644 --- a/sys/dev/raidframe/rf_raid1.c +++ b/sys/dev/raidframe/rf_raid1.c @@ -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 -__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_VerifyParityRAID1( 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 @@ rf_VerifyParityRAID1( * 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 @@ rf_VerifyParityRAID1( 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 @@ rf_VerifyParityRAID1( 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 @@ done: 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_SubmitReconBufferRAID1(rbuf, keep_it, use_committed) 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 @@ rf_SubmitReconBufferRAID1(rbuf, keep_it, use_committed) 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 @@ rf_SubmitReconBufferRAID1(rbuf, keep_it, use_committed) 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); }