Home | History | Annotate | Download | only in raidframe
History log of /src/sys/dev/raidframe/rf_driver.c
RevisionDateAuthorComments
 1.144  19-Sep-2024  andvar s/conficts/conflicts/ in comment.
 1.143  09-Oct-2023  oster branches: 1.143.6;
Make the name of the condition more reflective of the name of the condition variable. From Edgar Fuß.
 1.142  25-Sep-2023  oster We no longer need the deprecated copyback functionality now that
incorporating a used spare is automatic.

Copyback has always been an issue, as to do a copyback all IO to
the array had to be suspended, and so was very, very unlikely to
have been used in anything resembling a production system.
 1.141  17-Sep-2023  oster Implement hot removal of spares and components. From manu@.

Implement a long desired feature of automatically incorporating
a used spare into the array after a reconstruct.

Given the configuration:
Components:
/dev/wd0e: failed
/dev/wd1e: optimal
/dev/wd2e: optimal
Spares:
/dev/wd3e: spare

Running 'raidctl -F /dev/wd0e raid0' will now result in the
following configuration after a successful rebuild:
Components:
/dev/wd3e: optimal
/dev/wd1e: optimal
/dev/wd2e: optimal
No spares.

Thanks to manu@ for the development of the initial set of changes
which allowed the changes to automatically incorporate a used spare
to come to fruition. Thanks also to manu@ for useful discussions
about and additional testing of these changes.
 1.140  10-Aug-2022  mrg branches: 1.140.4;
raidframe: reject invalid values for numCol and numSpares

numCol and numSpares are "int" so they can be "-1" internally,
which means negative values need to be rejected, as well as
values higher than RF_MAXCOL/RF_MAXSPARES.

explicitly nul-terminate all strings coming from userland.

some minor CSE that avoids signed arith.

this fixes issues in the RAIDFRAME_ADD_HOT_SPARE,
RAIDFRAME_CONFIGURE, RAIDFRAME_DELETE_COMPONENT,
RAIDFRAME_INCORPORATE_HOT_SPARE, and RAIDFRAME_REBUILD_IN_PLACE
ioctl commands.

Reported-by: syzbot+b584943ad1f8ab9d4fe0@syzkaller.appspotmail.com

https://syzkaller.appspot.com/bug?id=61e07e418261f8eec8a37a9226725fe31820edd0
https://syzkaller.appspot.com/bug?id=ca0c997b40de81c0f0b44790217731f142003149
https://syzkaller.appspot.com/bug?id=6fc452d228453494655a85264591dd9054cc0b08
https://syzkaller.appspot.com/bug?id=873f0271682713a27adc9a49dd7109c70b35fda3


XXX: pullup-8, pullup-9.

ok oster@ riastradh@
 1.139  23-Jul-2021  oster All IO is async in the RAIDframe kernel driver, so desc->async_flag
isn't needed. Cleanup the flag from rf_DoAccess() and its caller as
well.
 1.138  23-Jul-2021  oster Extensive mechanical changes to the pools used in RAIDframe.

Alloclist remains not per-RAID, so initialize that pool
separately/differently than the rest.

The remainder of pools in RF_Pools_s are now per-RAID pools. Mostly
mechanical changes to functions to allocate/destroy per-RAID pools.
Needed to make raidPtr available in certain cases to be able to find
the per-RAID pools.

Extend rf_pool_init() to now populate a per-RAID wchan value that is
unique to each pool for a given RAID device.

TODO: Complete the analysis of the minimum number of items that are
required for each pool to allow IO to progress (i.e. so that a request
for pool resources can always be satisfied), and dynamically scale
minimum pool sizes based on RAID configuration.
 1.137  26-May-2021  mrg support different endian raidframe component label.

there are two on-disk formats in use in raidframe:
- the component label
- the parity map

the parity map is a bitmap implemented as bytes, so it has no
endian issue. the component label is the problem, as most of
the fields are 32 bit. this change only supports version 2 of
raidframe (active since the year 2000.)

as component labels are read and used before a raidPtr for the
raid set has been created, there is no obvious storage for the
swapped indicator, so the in-core version remains the on-disk
version, while the rest of in-core label is swapped.

in raidread_component_label() and raidwrite_component_label(),
check if the swapped version, and if so, call new rf_swap_label()
and ensure that the in-core label is native-byte order. for the
write method, an on-stack copy is modified before writing, so
that the in-core version remains valid. (this stack usage is
below other stack usage in similar functions here.)

adjust the label ioctls RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_GET_COMPONENT_LABEL80 to return the byte-swapped
version so that eg, raidctl -s reports the right version.

when performing final configuration of a raidset, report if a
label swapped, and also complain if there are differently swapped
versions on the other components.


tested on arm64, sparc64 and amd64
ok @oster
 1.136  10-Oct-2019  christos branches: 1.136.12; 1.136.14;
fix the function pointer and callback mess:
- callback functions return 0 and their result is not checked; make them void.
- there are two types of callbacks and they used to overload their parameters
and the callback structure; separate them into "function" and "value"
callbacks.
- make the wait function signature consistent.
 1.135  09-Feb-2019  christos branches: 1.135.4;
- Change the allocation macros to be more like function calls
- Change sizeof(type) -> sizeof(*variable)
- Use macros for the long buffer length allocations
- Remove "bit polishing" memsets() -- do them only once
- Remove unnecessary casts

Thanks to oster@ for finding bugs and testing.
 1.134  08-Jan-2019  mrg remove the final tsleep/wakeup pair in raidframe.
 1.133  10-Dec-2016  maya branches: 1.133.14; 1.133.16;
raidframe: use existing routines to print an error and panic.

fixes the i386 ALL build with clang which complained about the
format string not being a string literal, and lets us get rid of
rf_panicbuf.

note: kern_assert is not KASSERT. it should panic as long as the
string is not NULL.

No functional change intended.
 1.132  26-Dec-2015  pgoyette branches: 1.132.2;
Modularize the raidframe driver, including rework of the unit attach
code to permit detaching (and possible module unloading). Also,
convert tsleep()/wakeup() locking to use cv_wait_sig()/cv_broadcast().

Tested in non-modular, modular-builtin, and modular-loaded-at-runtime
environments.
 1.131  10-Dec-2012  msaitoh branches: 1.131.14;
Fix off by one read.
 1.130  30-Oct-2012  mrg fix a problem in half-configured raid devices, found when a "raidctl -c"
failed, and a "raidctl -C" was run afterwards, triggering mutex locking
issues. fix this by moving alloc and destroy of mutex/condvar for a
raid device into separate functions, and call the destroy function from
the DO_RAID_FAIL() macro.

probably needs a netbsd-6 pullup. sigh.
 1.129  27-May-2011  yamt branches: 1.129.4; 1.129.10; 1.129.14; 1.129.16;
don't forget to destroy mutex.
 1.128  11-May-2011  mrg convert the main raidPtr mutex to a kmutex, and add a couple of cv's to
cover the old sleep/wakeup points for adding_hot_spare and waitForReconCond.
convert all remaining simple_lock's to kmutexes (they're not used or compiled
right now... even with all options enabled) and remove the support for them.

this leaves just a pair of tsleep()/wakeup() calls using old scheduling APIs.
 1.127  05-May-2011  mrg convert access_suspend_mutex to a kmutex/cv.
 1.126  30-Apr-2011  mrg - convert rf_printf_mutex to a kmutex
- convert rf_rad_lock and the per-raid "cv" to per-raid kmutex/and real cv
- use rf_mutex_init() in places, and move it with the similar definitions
 1.125  27-Apr-2011  mrg prepare to convert more raidframe old lock/sleep APIs to mutex/condvar:

- remove RF_DECLARE_EXTERN_MUTEX and RF_DECLARE_STATIC_MUTEX, the qualifier
can be provided at the use point with the normal define
- rename the *LGMGR_MUTEX() macros to *mutex2() names, and add some more
defines for use:
rf_declare_mutex2()
rf_declare_cond2()
rf_lock_mutex2()
rf_unlock_mutex2()
rf_init_mutex2()
rf_destroy_mutex2()
rf_init_cond2()
rf_destroy_cond2()
rf_wait_cond2()
rf_signal_cond2()
rf_broadcast_cond2()
- use the new names for the configureMutex(), which previous used some combo
of direct mutex* calls and macros
- convert the node_queue to use a mutex/cv combo
- in rf_ShutdownEngine() and DAGExecutionThread(), also signal the former from
the latter when it is done and about to exit
- convert iodone_lock to use the new macros
 1.124  23-Apr-2011  mrg move the iodone setup and tear down into rf_engine.c. this fixes
"raidctl -u" and should also help the case where we fail to setup
a device part of the way through.
 1.123  23-Apr-2011  mrg convert the iodone_lock to a mutex, and use a condvar for signalling.

this only handles the smallest use of old simple_lock/tsleep/wakeup
APIs inside raidframe, and it points out that cv(9)'s have only one
wait channel per cv, whereas each tsleep() caller can specify a
different wait channel. this change removes the difference between
normal raidio and waiting for IO during shutdown.

i've tested this one 3 systems, ran atf, and had mlelstv and rmind
review the change.
 1.122  17-Nov-2009  jld branches: 1.122.4; 1.122.6;
Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.
 1.121  15-Mar-2009  cegger ansify function definitions
 1.120  20-Dec-2008  oster branches: 1.120.2;
When unconfiguring an array where a reconstruct is in progress, abort
the reconstruct and wait for IOs to drain before pulling the plug.

Should fix the panic reported by der Mouse on tech-kern.
 1.119  18-Nov-2008  ad _KERNEL_OPT
 1.118  28-Apr-2008  martin branches: 1.118.6; 1.118.8; 1.118.10;
Remove clause 3 and 4 from TNF licenses
 1.117  14-Apr-2008  sborrill branches: 1.117.2; 1.117.4;
Fix display of total number of sectors if > 2^32 on 32-bit machines
 1.116  12-Feb-2008  oster branches: 1.116.6;
rf_debugMem.c: remove unused 'rc' variable for RF_DEBUG_MEM.
rf_driver.c: minor comment tweak. Improve debugging output in
RF_DEBUG_QUIESCE.
rf_states.c: fix argument to rf_PrintDAGList() in the
RF_DEBUG_VALIDATE_DAG case.


Changes from Olivier Cherrier. Thanks!!
 1.115  05-Dec-2007  ad lockmgr -> mutex
 1.114  04-Mar-2007  christos branches: 1.114.14; 1.114.16; 1.114.22; 1.114.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.113  16-Nov-2006  christos branches: 1.113.2; 1.113.4; 1.113.8;
__unused removal on arguments; approved by core.
 1.112  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.111  07-Oct-2006  oster It's ok to wait for memory for the emergency buffers. If we don't get
that memory, fail harder, and bail on configuring the RAID array.
Addresses PR#25787.
 1.110  14-Feb-2006  oster branches: 1.110.14; 1.110.16;
RAIDframe was erroneously re-initializing the Parity Stripe Status
pool each time a new array was configured. This causes grief
with things like 'vmstat -m' by causing it to loop. Make RAIDframe
only initialize PSS bits once.

Pointed out by simonb@. Fix tested by simonb@. Thanks!
 1.109  11-Dec-2005  christos branches: 1.109.2; 1.109.4; 1.109.6;
merge ktrace-lwp.
 1.108  29-May-2005  christos branches: 1.108.2;
- avoid variable shadowing
- add a lot of const
- remove parameters from functin declarations
 1.107  27-Feb-2005  perry branches: 1.107.2;
nuke trailing whitespace
 1.106  13-Feb-2005  oster Convert a few "void *"'s to "struct buf *"'s. No functional changes.
 1.105  16-Nov-2004  oster branches: 1.105.4; 1.105.6;
On an idea from Thor (tls@), do not fail a component if doing so would
render the RAID set completely dead. Instead, we retry the IO a
maximum of RF_RETRY_THRESHOLD times (currently '5'), and then just
return an IO error if the IO fails. This should reduce the damage
caused by having multiple disks appear to fail when the culprit is
really something else (power, controllers, etc.)
 1.104  29-Jun-2004  oster Remove a (redundant) check that was already performed in raidstart().
 1.103  27-Jun-2004  oster Address a number of issues:
1) Introduce functions to allocate and free the emergency IO buffers.

2) Make sure we free any allocated emergency buffers in the event that
we bail out during configuration, or when we unconfigure an array.

3) if we run out of memory trying to allocate a given type of buffer,
don't continue to try to allocate more of those buffers.
(Partially addresses PR#25787)
 1.102  02-Jun-2004  drochner fix const'ificication, gcc-3.4 will notice it
 1.101  22-Apr-2004  itojun sprintf -> snprintf
 1.100  10-Apr-2004  oster Allocating emergency buffer space is all fine and well, but one should really
remember to return the memory when unconfiguring the array. Same thing goes
for the pool elements used to build the list!
 1.99  09-Apr-2004  oster These changes complete the effective removal of malloc() from all
write paths within RAIDframe. They also resolve the "panics with
RAID 5 sets with more than 3 components" issue which was present
(briefly) in the commits which were previously supposed to address
the malloc() issue.

With this new code the 5-component RAID 5 set panics are now gone.

It is also now also possible to swap to RAID 5.

The changes made are:

1) Introduce rf_AllocStripeBuffer() and rf_FreeStripeBuffer() to
allocate/free one stripe's worth of space. rf_AllocStripeBuffer() is
used in rf_MapUnaccessedPortionOfStripe() where it is not sufficient to
allocate memory using just rf_AllocBuffer(). rf_FreeStripeBuffer() is
called from rf_FreeRaidAccDesc(), well after the DAG is finished.

2) Add a set of emergency "stripe buffers" to struct RF_Raid_s.
Arrange for their initialization in rf_Configure(). In low-memory
situations these buffers will be returned by rf_AllocStripeBuffer()
and re-populated by rf_FreeStripeBuffer().

3) Move RF_VoidPointerListElem_t *iobufs from the dagHeader into
into struct RF_RaidAccessDesc_s. This is more consistent with the
original code, and will not result in items being freed "too early".

4) Add a RF_RaidAccessDesc_t *desc to RF_DagHeader_s so that we have a
way to find desc->iobufs.

5) Arrange for desc in the DagHeader to be initialized in InitHdrNode().

6) Don't cleanup iobufs in rf_FreeDAG() -- the freeing is now delayed
until rf_FreeRaidAccDesc() (which is how the original code handled the
allocList, and for which there seem to be some subtle, undocumented
assumptions).

7) Rename rf_AllocBuffer2() to be rf_AllocBuffer() and remove the
former rf_AllocBuffer(). Fix all callers of rf_AllocBuffer().
(This was how it was *supposed* to be after the last time these
changes were made, before they were backed out).

8) Remove RF_IOBufHeader and all references to it.

9) Remove desc->cleanupList and all references to it.

Fixes PR#20191
 1.98  21-Mar-2004  oster branches: 1.98.2;
Yesterday's fix to rf_disks.c (rev 1.51) was necessary, but not
sufficient to clobber this nasty little bug. The behaviour observed
was a panic when doing a 'raidctl -f' on a component when DAGs were
in flight for the given RAID set. Unfortunatly, the faulty behaviour
was very intermittent, and it was difficult to not only reliably
reproduce the bug (nor determine when it was fixed!) but also to even
figure out what might be the cause of the problem.

The real issue was that ci_vp for the failed component was being
set to NULL in rf_FailDisk(), but with DAGs still in flight, some
of them were still expecting to use ci_vp to determine where to
read to/write from!

The fix is to call rf_SuspendNewRequestsAndWait() from rf_FailDisk()
to make sure the RAID set is quiet and all IOs have completed before
mucking with ci_vp and other data structures. rf_ResumeNewRequests()
is then used to continue on as usual.
 1.97  20-Mar-2004  oster 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 :) ]
 1.96  13-Mar-2004  oster This desc->mutex is only ever initialized -- never used. *toss*
 1.95  13-Mar-2004  oster paramDAG and paramASM are only ever set, but never used. *toss*
 1.94  13-Mar-2004  oster - don't use rf_PrintUserStats() for recon statistics.
rf_PrintUserStats() was mean for the simulator, and doesn't provide
any real info in kernel-space, especially for reconstructs.
Reconstructing actually renders the stats even more useless, since it
resets them all to zero before the reconstruct starts!

- since rf_PrintUserStats() is no longer used, nuke it along with the
routines that feed it. Nothing was using this code, and if we ever
need it again, we know where to find it.
 1.93  09-Mar-2004  oster Use RF_DEBUG_QUIESCE to #if-out some printfs that really only should
be seen when debugging.
 1.92  09-Mar-2004  oster rf_ShutdownList() isn't returning anything useful, and doesn't need to
return anything. Cleanup.

Cleanup function prototypes in rf_shutdown.h

Use #if RF_DEBUG_SHUTDOWN to #if-out more code.
 1.91  07-Mar-2004  oster Rename rf_rad_pool_lock to rf_rad_lock. The latter is far more
accurate.
 1.90  07-Mar-2004  oster - 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)
 1.89  07-Mar-2004  oster - 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)
 1.88  05-Mar-2004  oster - 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.
 1.87  01-Mar-2004  oster Use RF_ACC_TRACE to #if out more chunks of code related only
to access tracing. (not turned on yet)
 1.86  29-Feb-2004  oster 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.
 1.85  27-Feb-2004  oster Use a dynamically allocated linked list of dagLists instead of using a
dynamically allocated variable-sized array (dagArray). Convert code
to use the new linked list stuff instead of the array stuff (the ratio
of one dagList per stripe still applies). The big advantage is in
being able to more efficiently allocate the dagLists on-the-fly, and
not have to know the size(s) of the array beforehand.
 1.84  15-Jan-2004  oster Add missing simple_lock_init(). Noted by skrueger-at-europe-dot-com.
 1.83  14-Jan-2004  oster Add 2 missing RF_LOCK_MUTEX()es. Problem pointed out by
skrueger-at-europe-dot-com. (It turns out that the mutex used to
serve two different purposes, not just one, and for its current use,
it's actually miss-named. Will fix that some other time.)
 1.82  05-Jan-2004  oster remove terminate_disk_queues from RF_Raid_s. The hist_diskreq[]
stuff is only used for the CHAINDECLUSTERING, so hide it with an #if.
 1.81  01-Jan-2004  oster Nuke a bunch of unused variables:
- node_queue_cond
- quiescent_cond
- eq_cond
- desc->cond
- desc->head
- diskqueue->numWaiting

Nuke rf_print_unable_to_init_cond().
Nuke rf_TerminateDiskQueues prototype from rf_diskqueue.h.
 1.80  30-Dec-2003  oster Make function declarations consistent a) with each other and b) with
KNF. Clean up comments.
 1.79  29-Dec-2003  oster rf_lkmgr_mutex_init() is only called from one spot, and it really
can't fail. Simplify life in rf_BootRaidframe(), and then nuke
rf_lkmgr_mutex_init(). Cleanup rf_threadstuff.h a bit more too.
rf_threadstuff.c is about to Go Away.
 1.78  29-Dec-2003  oster Let's see... raidPtr->recon_done_procs is never set to anything
(other than NULL when raidPtr is initialized). That means
SignalReconDone() never does anything useful. Bye-bye!

Say good-bye to recon_done_procs and recon_done_procs_mutex (and its
initializer) as well.
 1.77  29-Dec-2003  oster IO_BUF_ERR really doesn't need to be a macro. Replace the macro.
 1.76  29-Dec-2003  oster _rf_create_managed_cond() is now left doing nothing. Convert callers.
Mash DO_RAID_COND in rf_driver.c out of existance.

- Nuke (already #if 0'ed) _rf_create_managed_lkmgr_mutex() while we're
busy here.

simplify DO_INIT in rf_engine.c
 1.75  29-Dec-2003  oster _rf_create_managed_mutex() is doing just a simple:

rf_mutex_init(m)

now. The rest of the fluff is no longer needed.
It also cannot fail, so error checking on rf_create_managed_mutex()
is just wasting space.

Nuke the #define's associated with rf_create_managed_mutex().
Convert rf_create_managed_mutex(listp,m) to just rf_mutex_init(m).
Remove wasteful "error checking" and simplify all instances where this
is called. (another 0.3K saved in the binary, but the real savings
is in code readability!)
 1.74  29-Dec-2003  oster init_rad() and clean_rad() really do..... very little.. and only serve
to make things look far more complicated than they really are. It was
also impossible for any of the mutex/cond initializations in
init_rad() to actually fail, making the "error detection code"
unneeded. Collapse the little work done by init_rad into
rf_AllocRaidAccDesc(), and nuke init_rad() and clean_rad(). Save
another 0.25K in GENERIC.

[To be accurate/complete, init_rad() and clean_rad() *ARE* used in the
simulator version of RAIDframe. But we're so far removed from that
now that there is no point pretending otherwise.]
 1.73  29-Dec-2003  oster - 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.
 1.72  29-Dec-2003  oster [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.
 1.71  23-Jun-2003  martin branches: 1.71.2;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.70  19-Nov-2002  oster For reconstructs, move checks for failed components to before the
kernel threads are created.
 1.69  16-Nov-2002  oster Cleanup more printfs.
 1.68  14-Nov-2002  oster Don't allow failing more than one component of a set, or
failing a component that has been spared, or "double-failing"
an already failed component. XXX This isn't the right place to fix
this, but better here than no-where (and I'm hoping to move it sometime
soon).
 1.67  09-Nov-2002  oster Nuke a printf() from rf_FailDisk().
 1.66  22-Oct-2002  oster Better protect hot-spare adding, and make it LOCKDEBUG friendly.
 1.65  18-Oct-2002  oster Improve and/or re-arrange a number of locks. While much of the locking is
still a mess, and there are a number of unresolved issues here, this
gets us closer to being happier in LOCKDEBUG land.
 1.64  04-Oct-2002  oster As part of the effort to get RAIDframe playing nicely with LOCKDEBUG,
rework how completed requests are handled. In particular, instead of
doing all sorts of work and locking in interrupt context, completed
requests are now queued. A new kernel thread (rf_RaidIOThread) now
handles calling rf_DiskIOComplete() and (req->CompleteFunc)() for each
completed request. There is still work to be done to make RAIDframe
LOCKDEBUG friendly, but this change is a huge step forward.

Reviewed by (and many thanks to): thorpej
 1.63  23-Sep-2002  oster The 'reconDesc' argument to rf_SignalQuiescenceLock() is a holdover from
simulation code. *poof* Thanks to Simon B.
 1.62  21-Sep-2002  oster rf_UnbootRaidframe isn't used. rf_print_assert_panic_message is
only needed if RAID_DIAGNOSTIC is defined. Thanks Krister!
 1.61  17-Sep-2002  oster RF_DEBUG_ACCESS and RF_DEBUG_QUIESCE make things a little smaller.
 1.60  16-Sep-2002  oster Those of us who might be interested in debugging internal memory usage
of RAIDframe can use RF_DEBUG_MEM. I suspsect the rest of the world would
rather use that 14K of kernel memory for something else.
 1.59  15-Sep-2002  oster Nuke 'numPending' from the RF_RaidAccessDesc_s structure, and minor cleanup.
 1.58  14-Sep-2002  oster 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.
 1.57  11-Sep-2002  oster Nuke unneeded #include "rf_debugprint.h"
 1.56  09-Sep-2002  oster On a 'raidctl -f' or 'raidctl -F', close the failed component.
Thanks to Grant and Matt (phone) for poking me about this.
 1.55  08-Aug-2002  oster make 'configureMutex' be a lockmgr lock instead of a simple lock.
The result is MUCH fewer complaints with kernels compiled with LOCKDEBUG.
 1.54  04-Aug-2002  oster Let's just say that the way things were stored in the array for the
debugging buffer made it much less useful than it appears. More memory
for other things now.
 1.53  03-Aug-2002  oster Improve error messages.
 1.52  03-Aug-2002  oster Cleanup configuration and auto-configuration information printing.
Thanks to mrg for the suggestions.
 1.51  03-Aug-2002  oster Backout some "new stuff" that accidentally got included on the last commit.
 1.50  02-Aug-2002  oster - remove "#include "rf_memchunk.h"
- nuke the call to rf_ConfigureMemChunk() from rf_driver.c
 1.49  24-Jul-2002  oster Don't print the value of protectedSectors all the time.
 1.48  13-Jul-2002  oster Nuke a redundant check.
 1.47  13-Jul-2002  oster Nuke a redundant check that raidPtr->valid is true.
 1.46  07-Jan-2002  oster branches: 1.46.8;
#if 0 rf_SetReconfiguredMode() since it is unused now, but may be
needed someday.
 1.45  15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.44  13-Nov-2001  lukem add RCSIDs
 1.43  04-Oct-2001  oster Nuke a couple of unused extern variable declarations.
 1.42  04-Oct-2001  oster 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.
 1.41  27-Jul-2001  oster branches: 1.41.2;
Nuke the 5 NULL parameters from rf_DoAccess(). Observe that 4 of
the variables are passed directly to rf_AllocRaidAccDesc(), and the 5th
isn't even used. Hunt them down and nuke them too.
 1.40  18-Jul-2001  thorpej bzero -> memset
 1.39  15-Dec-2000  oster branches: 1.39.2; 1.39.4;
For the RF_ASSERT() and RF_PANIC() macros, call a function to do the
sprintf, instead of doing the sprintf in the macros. This means just
1 copy of each of the error messages, chopping about about 16K off the
size of an i386 kernel. Thanks to Simon Burge and Enami Tsugutomo
for providing the inspiration to do this.
 1.38  21-Sep-2000  oster convert tsleep()->ltsleep(), which makes the kernel complain less
when compiled with LOCKDEBUG.
 1.37  04-Jun-2000  oster branches: 1.37.2;
Merge rf_update_component_labels() and rf_final_update_component_labels().
 1.36  29-May-2000  oster Fix a couple of typos. (Thanks Wiz! :) )
 1.35  28-May-2000  oster Abort any parity re-writes before unconfiguring a RAID set.
Partially addresses PR#10182.
 1.34  07-Mar-2000  oster branches: 1.34.2;
Move rf_UnconfigureVnodes to rf_netbsdkintf.c where it will be more at home.
Add prototype to rf_kintf.h, and nuke old prototypes from rf_disks.c and
rf_driver.c .
 1.33  29-Feb-2000  oster Oops.. Need to note the parity status when we unconfigure.
Noted by Aaron J. Grier. (Thanks!)
 1.32  25-Feb-2000  oster When we close autoconfigured components, we need to note that they
are no longer in 'autoconfigured' status.
 1.31  24-Feb-2000  oster Deal with unconfiguring components in the autoconfigure case.
 1.30  23-Feb-2000  oster Be more aggressive about updating component labels in the event
of a real component failure (or a simulated failure):
- add 'numNewFailures' to keep track of the number of disk failures
since mod_counter was last updated for each component label.
- make sure we call rf_update_component_labels() upon any component failure,
real or simulated.
 1.29  23-Feb-2000  oster - cleanup of more component label code
- make current default label values available everywhere
- make sure numBlocks and blockSize in component labels get initialized
for all component labels
- check for component size to be smaller than or equal to the partition size
when autoconfiguring
 1.28  13-Feb-2000  oster Get recent changes into the tree:
- make component_label variables more consistent (==> clabel)
- re-work incorrect component configuration code
- re-work disk configuration code
- cleanup initial configuration of raidPtr info
- add auto-detection of components and RAID sets (Disabled, for now)
- allow / on RAID sets (Disabled, for now)
- rename "config_disk_queue" to "rf_ConfigureDiskQueue" and properly prototype
in rf_diskqueue.h
- protect some headers with #if _KERNEL (XXX this needs to be fixed properly)
and cleanup header formatting.
- expand the component labels (yes, they should be backward/forward compatible)
- other bits and pieces (some function names are still bogus, and will get
changed soon)
 1.27  09-Jan-2000  oster Garbage collect unused code.
 1.26  09-Jan-2000  oster Nuke dependency on rf_diskthreads.h
 1.25  09-Jan-2000  oster Nuke dependencies on rf_cpuutils.h.
 1.24  09-Jan-2000  oster - move a bunch of function prototypes to rf_kintf.h
- general cleanup of a number of prototypes that were scattered around.
 1.23  09-Jan-2000  oster Nuke desc->tid.
 1.22  08-Jan-2000  oster - nuke calls to rf_get_threadid() and associated #include
- change a bunch of debugging printfs from
"[%d] ...", tid (where tid is the "thread id")
to
"raid%d: ...", raidPtr->raidid
- other minor rototillage
 1.21  07-Jan-2000  oster Nuke RF_DECLARE_GLOBAL_THREADID, rf_setup_threadid(), rf_shutdown_threadid(),
and rf_assign_threadid(). rf_threadid.h, your days are numbered.
 1.20  07-Jan-2000  oster Shorten IO_BUF_ERR macro by one (unused) arg.
 1.19  07-Dec-1999  oster Nuke what's left of the DFSTRACE stuff.
 1.18  07-Dec-1999  oster More cleanup. DKUSAGE (what little was left of it) goes bye-bye.
 1.17  07-Dec-1999  oster Nuke the last few bits of RF_DEBUG_ATOMIC that should have
disappeared a while back.
 1.16  03-Dec-1999  oster Nuke some duplicate code.
 1.15  14-Aug-1999  oster branches: 1.15.2; 1.15.8;
Remove a 'struct proc *'-passing abomination that's been bugging me
for quite some time.
 1.14  13-Aug-1999  oster rf_sys.h does not need to be #included in any of these files, and, actually,
is no longer needed at all.
 1.13  13-Aug-1999  oster Nuke configuration of ETimer stuff during main configuration.
 1.12  19-Jul-1999  oster rf_UnconfigureVnodes() needs to be called in the DO_RAID_FAIL macro.
 1.11  14-Mar-1999  oster branches: 1.11.2; 1.11.4;
Disallow interrupting parity re-writes or copybacks by removing PCATCH
from the tsleep()'s (they probably shouldn't have been there in the
first place!). Making parity re-writing and copybacks interruptable
will require re-designing how a few things are done (e.g. how memory
is freed for structures shipped off to routines that run asynchronously
relative to the calling routine). Fix a few other tsleep's while we're at it.
 1.10  09-Mar-1999  oster Move rf_update_component_labels() from here to rf_netbsdkintf.c.
 1.9  02-Mar-1999  oster Update for recent changes including component label support, clean
bits, rebuilding components in-place, adding hot spares, shutdownhooks, etc.
 1.8  27-Feb-1999  oster After a vn_close(), set the vnode * to NULL so we don't try closing it
again later.
 1.7  23-Feb-1999  oster Move vnode cleanup code into one place. Cleanup a bit.
 1.6  05-Feb-1999  oster Phase 2 of the RAIDframe cleanup. The source is now closer to KNF
and is much easier to read. No functionality changes.
 1.5  26-Jan-1999  oster Nuke more bits of RAIDframe "demo" code. We're not "demoing" here,
we're doing the Real Thing!
 1.4  26-Jan-1999  oster 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.
 1.3  15-Jan-1999  explorer Make it so raidframe will only perform synchronous writes, and async
reads. This avoids a problem where many writes will cause the driver
to allocate way too much memory.

This needs to change to a queueing system later, which will provide a
way to limit the memory consumed by the driver.

Without these changes, raidframe would use 24M or more on my machine when
the buffer cache dumped all its dirty blocks. Now it uses around 200k
or so.
 1.2  13-Nov-1998  drochner fix callback type
 1.1  13-Nov-1998  oster 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.
 1.11.4.1  02-Aug-1999  thorpej Update from trunk.
 1.11.2.1  27-Sep-1999  cgd pull up rev 1.12 from trunk (requested by oster):
rf_UnconfigureVnodes() needs to be called in the DO_RAID_FAIL macro.
 1.15.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.2.2  05-Jan-2001  bouyer Sync with HEAD
 1.15.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.34.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.37.2.1  17-Oct-2000  tv Pullup 1.38 [oster]:
convert tsleep()->ltsleep(), which makes the kernel complain less
when compiled with LOCKDEBUG.
 1.39.4.4  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.39.4.3  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.39.4.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.39.4.1  03-Aug-2001  lukem update to -current
 1.39.2.12  11-Dec-2002  thorpej Sync with HEAD.
 1.39.2.11  11-Nov-2002  nathanw Catch up to -current
 1.39.2.10  18-Oct-2002  nathanw Catch up to -current.
 1.39.2.9  17-Sep-2002  nathanw Catch up to -current.
 1.39.2.8  13-Aug-2002  nathanw Catch up to -current.
 1.39.2.7  01-Aug-2002  nathanw Catch up to -current.
 1.39.2.6  28-Feb-2002  nathanw Catch up to -current.
 1.39.2.5  11-Jan-2002  nathanw More catchup.
 1.39.2.4  08-Jan-2002  nathanw Catch up to -current.
 1.39.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.39.2.2  22-Oct-2001  nathanw Catch up to -current.
 1.39.2.1  24-Aug-2001  nathanw Catch up with -current.
 1.41.2.1  11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.46.8.2  29-Aug-2002  gehenna catch up with -current.
 1.46.8.1  15-Jul-2002  gehenna catch up with -current.
 1.71.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.71.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.71.2.5  15-Feb-2005  skrll Sync with HEAD.
 1.71.2.4  29-Nov-2004  skrll Sync with HEAD.
 1.71.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.71.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.71.2.1  03-Aug-2004  skrll Sync with HEAD
 1.98.2.5  01-Jul-2004  jdc branches: 1.98.2.5.2;
Pull up revision 1.104 (requested by oster in ticket #569).

Remove a (redundant) check that was already performed in raidstart().
 1.98.2.4  28-Jun-2004  tron Pull up revision 1.102 (requested by oster in ticket #563):
fix const'ificication, gcc-3.4 will notice it
 1.98.2.3  27-Jun-2004  he Pull up revision 1.103 (requested by go in ticket #559):
Address a number of issues:
1) Introduce functions to allocate and free the emergency
IO buffers.
2) Make sure we free any allocated emergency buffers in the
event that we bail out during configuration, or when we
unconfigure an array.
3) If we run out of memory trying to allocate a given type
of buffer, do not continue to try to allocate more of
those buffers.
Partially addresses PR#25787.
 1.98.2.2  11-Apr-2004  tron Pull up revision 1.100 (requested by oster in ticket #124):
Allocating emergency buffer space is all fine and well, but one should really
remember to return the memory when unconfiguring the array. Same thing goes
for the pool elements used to build the list!
 1.98.2.1  11-Apr-2004  tron Pull up revision 1.99 (requested by oster in ticket #123):
These changes complete the effective removal of malloc() from all
write paths within RAIDframe. They also resolve the "panics with
RAID 5 sets with more than 3 components" issue which was present
(briefly) in the commits which were previously supposed to address
the malloc() issue.
With this new code the 5-component RAID 5 set panics are now gone.
It is also now also possible to swap to RAID 5.
The changes made are:
1) Introduce rf_AllocStripeBuffer() and rf_FreeStripeBuffer() to
allocate/free one stripe's worth of space. rf_AllocStripeBuffer() is
used in rf_MapUnaccessedPortionOfStripe() where it is not sufficient to
allocate memory using just rf_AllocBuffer(). rf_FreeStripeBuffer() is
called from rf_FreeRaidAccDesc(), well after the DAG is finished.
2) Add a set of emergency "stripe buffers" to struct RF_Raid_s.
Arrange for their initialization in rf_Configure(). In low-memory
situations these buffers will be returned by rf_AllocStripeBuffer()
and re-populated by rf_FreeStripeBuffer().
3) Move RF_VoidPointerListElem_t *iobufs from the dagHeader into
into struct RF_RaidAccessDesc_s. This is more consistent with the
original code, and will not result in items being freed "too early".
4) Add a RF_RaidAccessDesc_t *desc to RF_DagHeader_s so that we have a
way to find desc->iobufs.
5) Arrange for desc in the DagHeader to be initialized in InitHdrNode().
6) Don't cleanup iobufs in rf_FreeDAG() -- the freeing is now delayed
until rf_FreeRaidAccDesc() (which is how the original code handled the
allocList, and for which there seem to be some subtle, undocumented
assumptions).
7) Rename rf_AllocBuffer2() to be rf_AllocBuffer() and remove the
former rf_AllocBuffer(). Fix all callers of rf_AllocBuffer().
(This was how it was *supposed* to be after the last time these
changes were made, before they were backed out).
8) Remove RF_IOBufHeader and all references to it.
9) Remove desc->cleanupList and all references to it.
Fixes PR#20191
 1.98.2.5.2.1  06-Apr-2005  tron Pull up revision 1.105 (requested by oster in ticket #1038):
On an idea from Thor (tls@), do not fail a component if doing so would
render the RAID set completely dead. Instead, we retry the IO a
maximum of RF_RETRY_THRESHOLD times (currently '5'), and then just
return an IO error if the IO fails. This should reduce the damage
caused by having multiple disks appear to fail when the culprit is
really something else (power, controllers, etc.)
 1.105.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.105.4.1  29-Apr-2005  kent sync with -current
 1.107.2.3  19-Apr-2008  bouyer Pull up following revision(s) (requested by sborrill in ticket #1922):
sys/dev/raidframe/rf_driver.c: revision 1.117
Fix display of total number of sectors if > 2^32 on 32-bit machines
 1.107.2.2  15-Feb-2006  riz Pull up following revision(s) (requested by oster in ticket #1170):
sys/dev/raidframe/rf_driver.c: revision 1.110
sys/dev/raidframe/rf_psstatus.c: revision 1.31
sys/dev/raidframe/rf_psstatus.h: revision 1.13
RAIDframe was erroneously re-initializing the Parity Stripe Status
pool each time a new array was configured. This causes grief
with things like 'vmstat -m' by causing it to loop. Make RAIDframe
only initialize PSS bits once.
Pointed out by simonb@. Fix tested by simonb@. Thanks!
 1.107.2.1  17-Jun-2005  tron branches: 1.107.2.1.2;
Pull up revision 1.108 (requested by oster in ticket #472):
- avoid variable shadowing
- add a lot of const
- remove parameters from function declarations
 1.107.2.1.2.1  15-Feb-2006  riz Pull up following revision(s) (requested by oster in ticket #1170):
sys/dev/raidframe/rf_driver.c: revision 1.110
sys/dev/raidframe/rf_psstatus.c: revision 1.31
sys/dev/raidframe/rf_psstatus.h: revision 1.13
RAIDframe was erroneously re-initializing the Parity Stripe Status
pool each time a new array was configured. This causes grief
with things like 'vmstat -m' by causing it to loop. Make RAIDframe
only initialize PSS bits once.
Pointed out by simonb@. Fix tested by simonb@. Thanks!
 1.108.2.5  27-Feb-2008  yamt sync with head.
 1.108.2.4  07-Dec-2007  yamt sync with head
 1.108.2.3  03-Sep-2007  yamt sync with head.
 1.108.2.2  30-Dec-2006  yamt sync with head.
 1.108.2.1  21-Jun-2006  yamt sync with head.
 1.109.6.1  22-Apr-2006  simonb Sync with head.
 1.109.4.1  09-Sep-2006  rpaulo sync with head
 1.109.2.1  18-Feb-2006  yamt sync with head.
 1.110.16.2  10-Dec-2006  yamt sync with head.
 1.110.16.1  22-Oct-2006  yamt sync with head
 1.110.14.1  18-Nov-2006  ad Sync with head.
 1.113.8.1  03-Jun-2008  skrll Sync with netbsd-4.
 1.113.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.113.2.2  27-Dec-2008  bouyer Pull up following revision(s) (requested by oster in ticket #1249):
sys/dev/raidframe/rf_driver.c: revision 1.120
sys/dev/raidframe/rf_reconstruct.c: revision 1.106
When unconfiguring an array where a reconstruct is in progress, abort
the reconstruct and wait for IOs to drain before pulling the plug.
Should fix the panic reported by der Mouse on tech-kern.
 1.113.2.1  19-Apr-2008  bouyer Pull up following revision(s) (requested by sborrill in ticket #1126):
sys/dev/raidframe/rf_driver.c: revision 1.117
Fix display of total number of sectors if > 2^32 on 32-bit machines
 1.114.24.1  08-Dec-2007  ad Sync with head.
 1.114.22.2  18-Feb-2008  mjf Sync with HEAD.
 1.114.22.1  08-Dec-2007  mjf Sync with HEAD.
 1.114.16.2  23-Mar-2008  matt sync with HEAD
 1.114.16.1  09-Jan-2008  matt sync with HEAD
 1.114.14.1  09-Dec-2007  jmcneill Sync with HEAD.
 1.116.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.116.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.117.4.3  11-Mar-2010  yamt sync with head
 1.117.4.2  04-May-2009  yamt sync with head.
 1.117.4.1  16-May-2008  yamt sync with head.
 1.117.2.1  18-May-2008  yamt sync with head.
 1.118.10.3  13-Jan-2013  bouyer Pull up following revision(s) (requested by msaitoh in ticket #1827):
sys/dev/raidframe/rf_driver.c: revision 1.131
Fix off by one read.
 1.118.10.2  10-Dec-2009  snj branches: 1.118.10.2.2; 1.118.10.2.6;
Pull up following revision(s) (requested by tron in ticket #1187):
sbin/raidctl/raidctl.8: revisions 1.57-1.59 via patch
sbin/raidctl/raidctl.c: revision 1.42 via patch
sys/dev/raidframe/files.raidframe: revision 1.8 via patch
sys/dev/raidframe/rf_copyback.c: revision 1.42 via patch
sys/dev/raidframe/rf_disks.c: revision 1.72 via patch
sys/dev/raidframe/rf_driver.c: revision 1.122 via patch
sys/dev/raidframe/rf_engine.c: revision 1.40 via patch
sys/dev/raidframe/rf_kintf.h: revision 1.21 via patch
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.269 via patch
sys/dev/raidframe/rf_paritymap.c: revisions 1.1-1.3 via patch
sys/dev/raidframe/rf_paritymap.h: revision 1.1 via patch
sys/dev/raidframe/rf_parityscan.c: revision 1.33 via patch
sys/dev/raidframe/rf_parityscan.h: revision 1.8 via patch
sys/dev/raidframe/rf_raid.h: revision 1.38 via patch
sys/dev/raidframe/rf_reconstruct.c: revision 1.108 via patch
sys/dev/raidframe/rf_states.c: revision 1.44 via patch
sys/dev/raidframe/raidframeio.h: revision 1.6 via patch
sys/dev/raidframe/raidframevar.h: revision 1.13 via patch
Pull up the RAIDframe parity map Summer Of Code project.
Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.
 1.118.10.1  23-Dec-2008  snj branches: 1.118.10.1.2; 1.118.10.1.4;
Pull up following revision(s) (requested by oster in ticket #203):
sys/dev/raidframe/rf_driver.c: revision 1.120
sys/dev/raidframe/rf_reconstruct.c: revision 1.106
When unconfiguring an array where a reconstruct is in progress, abort
the reconstruct and wait for IOs to drain before pulling the plug.
Should fix the panic reported by der Mouse on tech-kern.
 1.118.10.2.6.1  13-Jan-2013  bouyer Pull up following revision(s) (requested by msaitoh in ticket #1827):
sys/dev/raidframe/rf_driver.c: revision 1.131
Fix off by one read.
 1.118.10.2.2.1  13-Jan-2013  bouyer Pull up following revision(s) (requested by msaitoh in ticket #1827):
sys/dev/raidframe/rf_driver.c: revision 1.131
Fix off by one read.
 1.118.10.1.4.1  21-Apr-2010  matt sync to netbsd-5
 1.118.10.1.2.1  13-Jan-2013  bouyer Pull up following revision(s) (requested by msaitoh in ticket #1827):
sys/dev/raidframe/rf_driver.c: revision 1.131
Fix off by one read.
 1.118.8.2  28-Apr-2009  skrll Sync with HEAD.
 1.118.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.118.6.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.120.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.122.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.122.4.1  31-May-2011  rmind sync with head
 1.129.16.1  17-Dec-2012  riz Pull up following revision(s) (requested by msaitoh in ticket #753):
sys/dev/raidframe/rf_driver.c: revision 1.131
Fix off by one read.
 1.129.14.3  03-Dec-2017  jdolecek update from HEAD
 1.129.14.2  25-Feb-2013  tls resync with head
 1.129.14.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.129.10.1  17-Dec-2012  riz Pull up following revision(s) (requested by msaitoh in ticket #753):
sys/dev/raidframe/rf_driver.c: revision 1.131
Fix off by one read.
 1.129.4.1  16-Jan-2013  yamt sync with (a bit old) head
 1.131.14.2  05-Feb-2017  skrll Sync with HEAD
 1.131.14.1  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.132.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.133.16.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.133.16.1  10-Jun-2019  christos Sync with HEAD
 1.133.14.1  18-Jan-2019  pgoyette Synch with HEAD
 1.135.4.1  12-Aug-2022  martin Pull up following revision(s) (requested by mrg in ticket #1500):

sys/dev/raidframe/rf_driver.c: revision 1.140 (patch)
sys/dev/raidframe/rf_disks.c: revision 1.93 (patch)
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.408 (patch)

raidframe: reject invalid values for numCol and numSpares

numCol and numSpares are "int" so they can be "-1" internally,
which means negative values need to be rejected, as well as
values higher than RF_MAXCOL/RF_MAXSPARES.
explicitly nul-terminate all strings coming from userland.


some minor CSE that avoids signed arith.

this fixes issues in the RAIDFRAME_ADD_HOT_SPARE,
RAIDFRAME_CONFIGURE, RAIDFRAME_DELETE_COMPONENT,
RAIDFRAME_INCORPORATE_HOT_SPARE, and RAIDFRAME_REBUILD_IN_PLACE
ioctl commands.


ok oster@ riastradh@
 1.136.14.1  31-May-2021  cjep sync with head
 1.136.12.2  01-Aug-2021  thorpej Sync with HEAD.
 1.136.12.1  17-Jun-2021  thorpej Sync w/ HEAD.
 1.140.4.1  28-Apr-2024  martin Pull up following revision(s) (requested by oster in ticket #674):

sys/dev/raidframe/rf_raid.h: revision 1.52
sbin/raidctl/raidctl.8: revision 1.80
sys/dev/raidframe/rf_driver.c: revision 1.141
sys/dev/raidframe/rf_disks.c: revision 1.94
sys/dev/raidframe/rf_diskqueue.c: revision 1.64
sys/dev/raidframe/rf_diskqueue.h: revision 1.30
sys/dev/raidframe/rf_disks.h: revision 1.15
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.414
sys/dev/raidframe/rf_reconstruct.c: revision 1.129
sys/dev/raidframe/raidframeio.h: revision 1.12
sbin/raidctl/raidctl.c: revision 1.79

Implement hot removal of spares and components. From manu@.

Implement a long desired feature of automatically incorporating
a used spare into the array after a reconstruct.

Given the configuration:

Components:
/dev/wd0e: failed
/dev/wd1e: optimal
/dev/wd2e: optimal
Spares:
/dev/wd3e: spare

Running 'raidctl -F /dev/wd0e raid0' will now result in the
following configuration after a successful rebuild:

Components:
/dev/wd3e: optimal
/dev/wd1e: optimal
/dev/wd2e: optimal
No spares.

Thanks to manu@ for the development of the initial set of changes
which allowed the changes to automatically incorporate a used spare
to come to fruition. Thanks also to manu@ for useful discussions
about and additional testing of these changes.
 1.143.6.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed