Add two more debugging #defines: RF_DEBUG_RECONBUFFER and RF_DEBUG_VERIFYPARITY.

Use them to reduce kernel bloat by a little more.
This commit is contained in:
oster 2002-09-14 17:11:30 +00:00
parent 4c81eb7f69
commit 954775e02c
3 changed files with 41 additions and 5 deletions

View File

@ -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. * Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved. * All rights reserved.
@ -116,6 +116,14 @@
#define RF_DEBUG_STRIPELOCK 0 #define RF_DEBUG_STRIPELOCK 0
#endif #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" #include "rf_options.h"
#endif /* !_RF__RF_ARCHS_H_ */ #endif /* !_RF__RF_ARCHS_H_ */

View File

@ -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. * Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved. * All rights reserved.
@ -33,7 +33,7 @@
*****************************************************************************/ *****************************************************************************/
#include <sys/cdefs.h> #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> #include <dev/raidframe/raidframevar.h>
@ -333,18 +333,24 @@ rf_TryToRedirectPDA(raidPtr, pda, parity)
if (raidPtr->Disks[pda->row][pda->col].status == rf_ds_reconstructing) { if (raidPtr->Disks[pda->row][pda->col].status == rf_ds_reconstructing) {
if (rf_CheckRUReconstructed(raidPtr->reconControl[pda->row]->reconMap, pda->startSector)) { if (rf_CheckRUReconstructed(raidPtr->reconControl[pda->row]->reconMap, pda->startSector)) {
if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) { if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) {
#if RF_DEBUG_VERIFYPARITY
RF_RowCol_t or = pda->row, oc = pda->col; RF_RowCol_t or = pda->row, oc = pda->col;
RF_SectorNum_t os = pda->startSector; RF_SectorNum_t os = pda->startSector;
#endif
if (parity) { if (parity) {
(raidPtr->Layout.map->MapParity) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP); (raidPtr->Layout.map->MapParity) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP);
#if RF_DEBUG_VERIFYPARITY
if (rf_verifyParityDebug) if (rf_verifyParityDebug)
printf("VerifyParity: Redir P r %d c %d sect %ld -> r %d c %d sect %ld\n", 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); or, oc, (long) os, pda->row, pda->col, (long) pda->startSector);
#endif
} else { } else {
(raidPtr->Layout.map->MapSector) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP); (raidPtr->Layout.map->MapSector) (raidPtr, pda->raidAddress, &pda->row, &pda->col, &pda->startSector, RF_REMAP);
#if RF_DEBUG_VERIFYPARITY
if (rf_verifyParityDebug) if (rf_verifyParityDebug)
printf("VerifyParity: Redir D r %d c %d sect %ld -> r %d c %d sect %ld\n", 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); or, oc, (long) os, pda->row, pda->col, (long) pda->startSector);
#endif
} }
} else { } else {
RF_RowCol_t spRow = raidPtr->Disks[pda->row][pda->col].spareRow; RF_RowCol_t spRow = raidPtr->Disks[pda->row][pda->col].spareRow;

View File

@ -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. * Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved. * All rights reserved.
@ -33,7 +33,7 @@
*****************************************************************************/ *****************************************************************************/
#include <sys/cdefs.h> #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_raid.h"
#include "rf_raid1.h" #include "rf_raid1.h"
@ -320,11 +320,13 @@ rf_VerifyParityRAID1(
RF_MallocAndAdd(buf, bcount, (char *), allocList); RF_MallocAndAdd(buf, bcount, (char *), allocList);
if (buf == NULL) if (buf == NULL)
goto done; goto done;
#if RF_DEBUG_VERIFYPARITY
if (rf_verifyParityDebug) { if (rf_verifyParityDebug) {
printf("raid%d: RAID1 parity verify: buf=%lx bcount=%d (%lx - %lx)\n", printf("raid%d: RAID1 parity verify: buf=%lx bcount=%d (%lx - %lx)\n",
raidPtr->raidid, (long) buf, bcount, (long) buf, raidPtr->raidid, (long) buf, bcount, (long) buf,
(long) buf + bcount); (long) buf + bcount);
} }
#endif
/* /*
* Generate a DAG which will read the entire stripe- then we can * Generate a DAG which will read the entire stripe- then we can
* just compare data chunks versus "parity" chunks. * just compare data chunks versus "parity" chunks.
@ -435,13 +437,16 @@ rf_VerifyParityRAID1(
* Check data vs "parity" (mirror copy). * Check data vs "parity" (mirror copy).
*/ */
for (i = 0; i < layoutPtr->numDataCol; i++) { for (i = 0; i < layoutPtr->numDataCol; i++) {
#if RF_DEBUG_VERIFYPARITY
if (rf_verifyParityDebug) { if (rf_verifyParityDebug) {
printf("raid%d: RAID1 parity verify %d bytes: i=%d buf1=%lx buf2=%lx buf=%lx\n", printf("raid%d: RAID1 parity verify %d bytes: i=%d buf1=%lx buf2=%lx buf=%lx\n",
raidPtr->raidid, nbytes, i, (long) buf1, raidPtr->raidid, nbytes, i, (long) buf1,
(long) buf2, (long) buf); (long) buf2, (long) buf);
} }
#endif
ret = memcmp(buf1, buf2, nbytes); ret = memcmp(buf1, buf2, nbytes);
if (ret) { if (ret) {
#if RF_DEBUG_VERIFYPARITY
if (rf_verifyParityDebug > 1) { if (rf_verifyParityDebug > 1) {
for (j = 0; j < nbytes; j++) { for (j = 0; j < nbytes; j++) {
if (buf1[j] != buf2[j]) if (buf1[j] != buf2[j])
@ -456,6 +461,7 @@ rf_VerifyParityRAID1(
if (rf_verifyParityDebug) { if (rf_verifyParityDebug) {
printf("raid%d: RAID1: found bad parity, i=%d\n", raidPtr->raidid, i); printf("raid%d: RAID1: found bad parity, i=%d\n", raidPtr->raidid, i);
} }
#endif
/* /*
* Parity is bad. Keep track of which columns were bad. * Parity is bad. Keep track of which columns were bad.
*/ */
@ -470,9 +476,11 @@ rf_VerifyParityRAID1(
if ((ret != RF_PARITY_OKAY) && correct_it) { if ((ret != RF_PARITY_OKAY) && correct_it) {
ret = RF_PARITY_COULD_NOT_CORRECT; ret = RF_PARITY_COULD_NOT_CORRECT;
#if RF_DEBUG_VERIFYPARITY
if (rf_verifyParityDebug) { if (rf_verifyParityDebug) {
printf("raid%d: RAID1 parity verify: parity not correct\n", raidPtr->raidid); printf("raid%d: RAID1 parity verify: parity not correct\n", raidPtr->raidid);
} }
#endif
if (bbufs == NULL) if (bbufs == NULL)
goto done; goto done;
/* /*
@ -537,10 +545,12 @@ done:
if (mcpair) if (mcpair)
rf_FreeMCPair(mcpair); rf_FreeMCPair(mcpair);
rf_FreeAllocList(allocList); rf_FreeAllocList(allocList);
#if RF_DEBUG_VERIFYPARITY
if (rf_verifyParityDebug) { if (rf_verifyParityDebug) {
printf("raid%d: RAID1 parity verify, returning %d\n", printf("raid%d: RAID1 parity verify, returning %d\n",
raidPtr->raidid, ret); raidPtr->raidid, ret);
} }
#endif
return (ret); return (ret);
} }
@ -571,12 +581,14 @@ rf_SubmitReconBufferRAID1(rbuf, keep_it, use_committed)
RF_ASSERT(rbuf); RF_ASSERT(rbuf);
RF_ASSERT(rbuf->col != reconCtrlPtr->fcol); RF_ASSERT(rbuf->col != reconCtrlPtr->fcol);
#if RF_DEBUG_RECONBUFFER
if (rf_reconbufferDebug) { if (rf_reconbufferDebug) {
printf("raid%d: RAID1 reconbuffer submission r%d c%d psid %ld ru%d (failed offset %ld)\n", printf("raid%d: RAID1 reconbuffer submission r%d c%d psid %ld ru%d (failed offset %ld)\n",
raidPtr->raidid, rbuf->row, rbuf->col, raidPtr->raidid, rbuf->row, rbuf->col,
(long) rbuf->parityStripeID, rbuf->which_ru, (long) rbuf->parityStripeID, rbuf->which_ru,
(long) rbuf->failedDiskSectorOffset); (long) rbuf->failedDiskSectorOffset);
} }
#endif
if (rf_reconDebug) { if (rf_reconDebug) {
printf("RAID1 reconbuffer submit psid %ld buf %lx\n", printf("RAID1 reconbuffer submit psid %ld buf %lx\n",
(long) rbuf->parityStripeID, (long) rbuf->buffer); (long) rbuf->parityStripeID, (long) rbuf->buffer);
@ -601,34 +613,42 @@ rf_SubmitReconBufferRAID1(rbuf, keep_it, use_committed)
t = NULL; t = NULL;
if (keep_it) { if (keep_it) {
#if RF_DEBUG_RECONBUFFER
if (rf_reconbufferDebug) { if (rf_reconbufferDebug) {
printf("raid%d: RAID1 rbuf submission: keeping rbuf\n", printf("raid%d: RAID1 rbuf submission: keeping rbuf\n",
raidPtr->raidid); raidPtr->raidid);
} }
#endif
t = rbuf; t = rbuf;
} else { } else {
if (use_committed) { if (use_committed) {
#if RF_DEBUG_RECONBUFFER
if (rf_reconbufferDebug) { if (rf_reconbufferDebug) {
printf("raid%d: RAID1 rbuf submission: using committed rbuf\n", raidPtr->raidid); printf("raid%d: RAID1 rbuf submission: using committed rbuf\n", raidPtr->raidid);
} }
#endif
t = reconCtrlPtr->committedRbufs; t = reconCtrlPtr->committedRbufs;
RF_ASSERT(t); RF_ASSERT(t);
reconCtrlPtr->committedRbufs = t->next; reconCtrlPtr->committedRbufs = t->next;
t->next = NULL; t->next = NULL;
} else } else
if (reconCtrlPtr->floatingRbufs) { if (reconCtrlPtr->floatingRbufs) {
#if RF_DEBUG_RECONBUFFER
if (rf_reconbufferDebug) { if (rf_reconbufferDebug) {
printf("raid%d: RAID1 rbuf submission: using floating rbuf\n", raidPtr->raidid); printf("raid%d: RAID1 rbuf submission: using floating rbuf\n", raidPtr->raidid);
} }
#endif
t = reconCtrlPtr->floatingRbufs; t = reconCtrlPtr->floatingRbufs;
reconCtrlPtr->floatingRbufs = t->next; reconCtrlPtr->floatingRbufs = t->next;
t->next = NULL; t->next = NULL;
} }
} }
if (t == NULL) { if (t == NULL) {
#if RF_DEBUG_RECONBUFFER
if (rf_reconbufferDebug) { if (rf_reconbufferDebug) {
printf("raid%d: RAID1 rbuf submission: waiting for rbuf\n", raidPtr->raidid); printf("raid%d: RAID1 rbuf submission: waiting for rbuf\n", raidPtr->raidid);
} }
#endif
RF_ASSERT((keep_it == 0) && (use_committed == 0)); RF_ASSERT((keep_it == 0) && (use_committed == 0));
raidPtr->procsInBufWait++; raidPtr->procsInBufWait++;
if ((raidPtr->procsInBufWait == (raidPtr->numCol - 1)) if ((raidPtr->procsInBufWait == (raidPtr->numCol - 1))
@ -686,9 +706,11 @@ rf_SubmitReconBufferRAID1(rbuf, keep_it, use_committed)
out: out:
RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->row, rbuf->parityStripeID); RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->row, rbuf->parityStripeID);
RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex); RF_UNLOCK_MUTEX(reconCtrlPtr->rb_mutex);
#if RF_DEBUG_RECONBUFFER
if (rf_reconbufferDebug) { if (rf_reconbufferDebug) {
printf("raid%d: RAID1 rbuf submission: returning %d\n", printf("raid%d: RAID1 rbuf submission: returning %d\n",
raidPtr->raidid, retcode); raidPtr->raidid, retcode);
} }
#endif
return (retcode); return (retcode);
} }