NetBSD/sys/dev/raidframe/rf_map.h
oster 0ff2145648 For each RAID set, pre-allocate a number of "emergency buffers" to be
used in the event that we can't malloc a buffer of the appropriate
size in the traditional way.  rf_AllocIOBuffer() and rf_FreeIOBuffer()
deal with allocating/freeing these structures.  These buffers are
stored in a list on the 'iobuf' list.  iobuf_count keeps track of how
many buffers are available, and numEmergencyBuffers is the effective
"high-water" mark for the freelist.  The buffers allocated by
rf_AllocIOBuffer() are stripe-unit sized, which is the maximum
size requested by any of the callers.

Add an iobufs entry to RF_DagHeader_s.  Use it for keeping track of
buffers that get allocated from the free-list.

Add a "generic list" pool (VoidPointerListElement Pool) for elements
used to maintain a list of allocated memory.  [It is somewhat less
than ideal to add another little pool to handle this...]

Teach rf_AllocBuffer() to use the new rf_AllocIOBuffer().  Modify
other Mallocs to use rf_AllocIOBuffer(), and to update dag_h->iobufs as
appropriate.

Update rf_FreeDAG() to handle cleanup of dag_h->iobufs.

While here, add some missing pool_destroy() calls for a number of pools.

With these changes, it should (in theory) be possible to swap on
RAID 5 sets again.  That said, I've not had any success there yet --
but the last issue I saw at least wasn't in RAIDframe. :-}

[There is room for this code to become a bit more consise, but I
wanted to do a checkpoint here with something known to work :) ]
2004-03-20 04:22:05 +00:00

71 lines
2.9 KiB
C

/* $NetBSD: rf_map.h,v 1.11 2004/03/20 04:22:05 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Mark Holland
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
/* rf_map.h */
#ifndef _RF__RF_MAP_H_
#define _RF__RF_MAP_H_
#include <dev/raidframe/raidframevar.h>
#include "rf_alloclist.h"
#include "rf_raid.h"
/* mapping structure allocation and free routines */
RF_AccessStripeMapHeader_t *rf_MapAccess(RF_Raid_t *, RF_RaidAddr_t,
RF_SectorCount_t, caddr_t, int);
void rf_MarkFailuresInASMList(RF_Raid_t *, RF_AccessStripeMapHeader_t *);
int rf_ConfigureMapModule(RF_ShutdownList_t **);
RF_AccessStripeMapHeader_t *rf_AllocAccessStripeMapHeader(void);
void rf_FreeAccessStripeMapHeader(RF_AccessStripeMapHeader_t *);
RF_PhysDiskAddr_t *rf_AllocPhysDiskAddr(void);
RF_PhysDiskAddr_t *rf_AllocPDAList(int);
void rf_FreePhysDiskAddr(RF_PhysDiskAddr_t *);
RF_AccessStripeMap_t *rf_AllocASMList(int);
void rf_FreeAccessStripeMap(RF_AccessStripeMapHeader_t *);
int rf_CheckStripeForFailures(RF_Raid_t *, RF_AccessStripeMap_t *);
int rf_NumFailedDataUnitsInStripe(RF_Raid_t *, RF_AccessStripeMap_t *);
void rf_PrintAccessStripeMap(RF_AccessStripeMapHeader_t *);
void rf_PrintFullAccessStripeMap(RF_AccessStripeMapHeader_t *, int);
void rf_PrintRaidAddressInfo(RF_Raid_t *, RF_RaidAddr_t, RF_SectorCount_t);
void rf_ASMParityAdjust(RF_PhysDiskAddr_t *, RF_StripeNum_t, RF_SectorNum_t,
RF_RaidLayout_t *, RF_AccessStripeMap_t *);
void rf_ASMCheckStatus(RF_Raid_t *, RF_PhysDiskAddr_t *, RF_AccessStripeMap_t *,
RF_RaidDisk_t *, int);
RF_VoidFunctionPointerListElem_t *rf_AllocVFPListElem(void);
void rf_FreeVFPListElem(RF_VoidFunctionPointerListElem_t *);
RF_VoidPointerListElem_t *rf_AllocVPListElem(void);
void rf_FreeVPListElem(RF_VoidPointerListElem_t *);
RF_ASMHeaderListElem_t *rf_AllocASMHeaderListElem(void);
void rf_FreeASMHeaderListElem(RF_ASMHeaderListElem_t *);
RF_FailedStripe_t *rf_AllocFailedStripeStruct(void);
void rf_FreeFailedStripeStruct(RF_FailedStripe_t *);
#endif /* !_RF__RF_MAP_H_ */