Commit Graph

37 Commits

Author SHA1 Message Date
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
oster b2c52e1175 Take care of six more mallocs:
- Pull rf_FreePhysDiskAddr() out from under a #ifdef, since we're now
going to use it.

- Add a pda_cleanup_list into the DAG header.  Use it in rf_FreeDAG() to
cleanup any PDA's that get allocated but have no "easy" way of being
located and freed when the DAG completes.

- numStripeUnitsAccessed is a per-stripe value, and has a maximum
value equal to the number of colums (thus limited by RF_MAXCOL).
Use this knowledge to set a high-bound on overlappingPDAs, and stuff
it on the stack instead of malloc'ing it all the time!  This costs us
a whopping 40 bytes on the stack, but saves a malloc() and a free().
2004-03-19 15:16:18 +00:00
oster 5ac8fbad7f Add a comment. Will hopefully save time next time someone tries
to figure out where the allocated memory is freed.
2004-03-19 02:57:34 +00:00
oster 208b461a96 Introduce 3 more pools and 6 functions to handle allocating/freeing
elements from the pools.

Re-work rf_SelectAlgorithm() to get rid of all the 8 malloc's, and to
use the new functions to get/put these 'support structures'.  I'm not
overly happy with some of the variable names, but them's the breaks.

In the process of changing things, fix a bug:
 - in the case where we can't create a dag, free asmh_b and blockFuncs
too!!

[if you were able to look at the source code related to these changes,
and comprehend what was going on without having your eyes bleed or
getting dizzy, please contact me...  I'm sure I'll have more code
which would benefit by you having a look at it before I commit it :) ]
2004-03-19 02:27:44 +00:00
oster f95359dd19 - Introduce rf_pools which contains all of the various global pools used
by RAIDframe.  Convert all other RAIDframe global pools to use pools
defined within this new structure.
- Introduce rf_pool_init(), used for initializing a single pool in
RAIDframe.  Teach each of the configuration routines to use
rf_pool_init().
- Cleanup a few pool-related comments.
- Cleanup revent initialization and #defines.
- Add a missing pool_destroy() for the reconbuffer pool.

(Saves another 1K off of an i386 GENERIC kernel, and makes
stuff a lot more readable)
2004-03-07 22:15:19 +00:00
oster 834d494bb2 - Introduce rf_pools which contains all of the various global pools used
by RAIDframe.  Convert all other RAIDframe global pools to use pools
defined within this new structure.
- Introduce rf_pool_init(), used for initializing a single pool in
RAIDframe.  Teach each of the configuration routines to use
rf_pool_init().
- Cleanup a few pool-related comments.
- Cleanup revent initialization and #defines.
- Add a missing pool_destroy() for the reconbuffer pool.

(Saves another 1K off of an i386 GENERIC kernel, and makes
stuff a lot more readable)
2004-03-07 21:57:44 +00:00
oster dd0716f291 We don't need 2-fault tollerant stuff here in the default case.
Use #if's to conditionalize the code compilation.
(Saves another 1K on i386 GENERIC kernels)
2004-03-07 02:59:25 +00:00
oster a0413593bc - remove the RF_*_INC's, as necessary. They are not needed any more.
- introduce RF_MIN_*'s, as necessary.  These will indicate the
low-water mark for pools as well as the pool_prime() value.
- add pool_setlowat() for the critical pools.
- pool_prime() and pool_setlowat() the raidframe_cbufpool.
- re-order some pool_prime()'s and pool_sethiwat()'s for clarity.
2004-03-05 02:53:55 +00:00
oster 5a02af5b21 Adjust _rf_ShutdownCreate() so that it is willing to wait for more
memory.  Since we only now ever "return(0)", just return (void)
instead.

Cleanup all uses of rf_ShutdownCreate() to not worry about
it ever failing.  Shaves another 600 bytes off of an i386 GENERIC kernel.
2004-02-29 04:03:50 +00:00
oster 0b4f5c68b8 No point keeping 'pt' around. It's only ever assigned to. 2003-12-30 22:12:10 +00:00
oster 5a41c1d7ce rf_FreePDAList() and rf_FreeASMList() wern't using their l_end or
count arguments.  Nuke the unused args, and fix up callers and fn
prototypes.  Rename l_start arguments.
2003-12-30 22:11:14 +00:00
oster c43fc67d7d Some days you wonder if some of the function declaration consistency
was just an accident in the first place.  Cleanup function decls and
a few comments.  [ok.. so I wasn't going to fix this many.. but once
you're on a roll....]
2003-12-30 21:59:03 +00:00
oster 5c71699f0b Clean up comments, and generally make more readable. No functional changes. 2003-12-29 17:13:36 +00:00
oster ee19b085aa - first kick at a major reworking of RAIDframe's memory allocation code:
- all freelists converted to pools
  - initialization of structure members in certain cases where
	code was relying on specific allocation and usage properties
	to keep structures in a "known state" (that doesn't work with
	pools!).
  - make most pool_get() be "PR_WAITOK" until they can be analyzed
	further, and/or have proper error handling added.
  - all RF_Mallocs zero the space returned, so there is no difference
	between RF_Calloc and RF_Malloc.  In fact, all the RF_Calloc()'s
	do is tend to do is get things horribly confused.
	Make RF_Malloc() the "general memory allocator", with
	RF_MallocAndAdd() the "general memory allocator with
	allocation list".
  - some of these RF_Malloc's et al. are destined to disappear.
  - remove rf_rdp_freelist entirely (it's not used anywhere!)
  - remove: #include "rf_freelist.h"
  - to the files that were relying on the above, add: #include "rf_general.h"
  - add: #include "rf_debugMem.h" to rf_shutdown.h to make it happy
	about the loss of: #include "rf_freelist.h".

This shrinks an i386 GENERIC kernel by approx 5K.  RAIDframe now
weighs in at about 162K on i386.
2003-12-29 03:33:47 +00:00
oster 10f077a0fb [Having received a definite lack of strenuous objection, a small amount
of strenuous agreement, and some general agreement, this commit is
going ahead because it's now starting to block some other changes I
wish to make.]

Remove most of the support for the concept of "rows" from RAIDframe.
While the "row" interface has been exported to the world, RAIDframe
internals have really only supported a single row, even though they
have feigned support of multiple rows.

Nothing changes in configuration land -- config files still need to
specify a single row, etc.  All auto-config structures remain fully
forward/backwards compatible.

The only visible difference to the average user should be a
reduction in the size of a GENERIC kernel (i386) by 4.5K.  For those
of us trolling through RAIDframe kernel code, a lot of the driver
configuration code has become a LOT easier to read.
2003-12-29 02:38:17 +00:00
oster cdbecad002 (Although I want this code to Go Away, I might as well fix this bug for completeness)
If we don't have enough memory to allocate the pda freelist, make sure to
cleanup the asm freelist.
2003-12-21 19:36:31 +00:00
oster 8a5a36de43 Cleanup the comment formatting a bit. 2002-09-24 00:12:55 +00:00
oster 3e5db6c469 Ooops.. should have included this 'row' with the last change. 2002-09-23 02:55:03 +00:00
oster d5e5932f5e 'row' was defined and set, but never used. *poof* Thanks to Simon B. 2002-09-23 02:53:58 +00:00
oster 580f8b6e1e rf_FreePhysDiskAddr is only needed by paritylogging.
rf_NumFailedDataUnitsInStripe is only needed by PQ, RAID6 and EVENODD.
rf_PrintAccessStripeMap is only needed for RF_DEBUG_MAP.

Thanks Krister!
2002-09-21 01:18:45 +00:00
oster ce38eb4f8c rf_FreeAccessStripeMapComponent() goes too. Thanks Krister! 2002-09-21 01:14:22 +00:00
oster ce8b221a5e Nuke rf_AllocAccessStripeMapComponent(). Thanks Krister! 2002-09-21 01:12:49 +00:00
oster 5faa29ac7d Introduce RF_DEBUG_MAP, and use it to ignore more rarely used code. 2002-09-19 23:23:19 +00:00
oster a2b9142871 Everyone and their dog was using RF_ERRORMSG3 to print out the same
sort of error message, over and over again, in different files.
Rather than having the same text repeated in multiple .o files,
create a couple of little functions to do the printing, and save a
bundle of space.  Also improves readability of code.
2002-09-14 17:53:57 +00:00
oster 91d1d5d729 Nuke two more functions that arn't used anywhere and are only contributing
to kernel bloat.
2002-08-03 01:06:48 +00:00
wiz 45bbb2368f bcopy -> memcpy. Reviewed by Greg Oster. 2002-05-22 15:40:47 +00:00
oster 19c2127b85 Revert previous. Need to be more careful with what gets chopped out. 2002-01-07 05:30:53 +00:00
oster 345de5b80a Some of this stuff is really just for debugging, so compile it only if
DEBUG is defined.
2002-01-07 02:27:42 +00:00
lukem a3746e00b7 add RCSIDs 2001-11-13 07:11:12 +00:00
oster 035a63f6d3 More #if 0's bite the dust. 2001-10-05 15:41:23 +00:00
oster 765e00d3de Step 2 of the disentanglement. We now look to <dev/raidframe/*> for
the stuff that used to live in rf_types.h, rf_raidframe.h, rf_layout.h,
rf_netbsd.h, rf_raid.h, rf_decluster,h, and a few other places.
Believe it or not, when this is all done, things will be cleaner.

No functional changes to RAIDframe.
2001-10-04 15:58:51 +00:00
thorpej cf56c44a86 bzero -> memset 2001-07-18 06:45:33 +00:00
oster ce2b2827e5 Nuke a printf that *I* added at least as early as Nov, 1998, and which is
as bogus now as it was then.
2000-06-29 00:22:27 +00:00
oster db2eaf18cf rf_sys.h does not need to be #included in any of these files, and, actually,
is no longer needed at all.
1999-08-13 03:41:52 +00:00
oster 0014588545 Phase 2 of the RAIDframe cleanup. The source is now closer to KNF
and is much easier to read.  No functionality changes.
1999-02-05 00:06:06 +00:00
oster 1eecf8e491 RAIDframe cleanup, phase 1. Nuke simulator support, user-land driver,
out-dated comments, and other unneeded stuff.  This helps prepare
for cleaning up the rest of the code, and adding new functionality.

No functional changes to the kernel code in this commit.
1999-01-26 02:33:49 +00:00
oster 38a3987b69 RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University.  Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.
1998-11-13 04:20:26 +00:00