Home | History | Annotate | Download | only in raidframe
History log of /src/sys/dev/raidframe/rf_netbsdkintf.c
RevisionDateAuthorComments
 1.418  08-Jan-2025  andvar s/ocmponent/component/ and s/abd/and/ in comments.
 1.417  09-Oct-2023  oster spaces->tabs. Noted by Edgar Fuß
 1.416  28-Sep-2023  manu Fix root search in RAID 1 sets

We use the wedge information given by bootstrap, where the kernel was
found. This requires src/sys/arch/i386/stand/i386/lib/biosdisk.c 1.59
to work in all cases.
 1.415  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.414  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.413  16-Sep-2023  oster A component that is in state rf_ds_reconstructing has failed, and should
not be consulted for DIOCGCACHE.

Fixes an observed panic when rf_get_component_caches() does an IOCTL to
a failed device while reconstruction is in progress.

XXX pullup netbsd-10
XXX pullup netbsd-9
 1.412  15-Jun-2023  hannken Undo unlock/relock for VOP_IOCTL().

PR kern/57450 (unplugging hung USB disk triggers panic via _vstate_assert)
 1.411  30-Mar-2023  riastradh raidframe: Nix unused parameter to raidwrite_component_area.

All calls use the same value. Prune dead branches using it.
 1.410  28-Aug-2022  oster branches: 1.410.4;
Simplify the check for what ioctls can be done in raidioctl() without
the device being initialized.
 1.409  28-Aug-2022  oster RAIDframe must be initialized for the RAIDFRAME_SET_LAST_UNIT
and RAIDFRAME_SHUTDOWN ioctls.

XXX Pullup-9

Reported-by: syzbot+1c20fcbe34d72cd7fbda@syzkaller.appspotmail.com
 1.408  10-Aug-2022  mrg 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.407  16-Apr-2022  andvar Fix mistake in error branch locking caused by previous changes.
vput(vp) also unlocks vp, thus unlocking happens twice in error flow
causing kernel to panic with failed assertion lktype != LK_NONE
in vfs_vnode.c#778. Thanks riastradh with finding the issue.
 1.406  16-Apr-2022  hannken Unlock vnode for VOP_IOCTL().
 1.405  28-Mar-2022  wiz Restore another historic RCS Id.
 1.404  28-Mar-2022  riastradh driver(9): devsw_detach never fails. Make it return void.

Prune a whole lotta dead branches as a result of this. (Some logic
calling this is also wrong for other reasons; devsw_detach is final
-- you should never have any reason to decide to roll it back. To be
cleaned up in subsequent commits...)

XXX kernel ABI change to devsw_detach signature requires bump
 1.403  11-Mar-2022  mrg convert non-config-handled "DEBUG_ROOT" to aprint_debug().

now it's possible to get boot-time info about raidframe root
device selection with simple "boot -x".
 1.402  09-Mar-2022  mrg merge two debug lines in auto-root selection.
 1.401  09-Sep-2021  riastradh sys/dev: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.

I think the iwi(4), mcd(4), and ses(4) changes actually plug leaks;
the raidframe(4) change probably doesn't (but doesn't hurt).
 1.400  28-Aug-2021  oster If there is a FS_RAID partition on a disk, then we shouldn't look at
the raw partition. In particular, we now need to account for the case
where an existing FS_RAID partition is now open because it is in use.
If that is the case, we don't look at the raw partition.

Addresses PR kern/56369.
 1.399  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.398  02-Aug-2021  oster Support on-demand re-scanning all devices to look for
autoconfig RAID sets. raidctl now supports looking
for autoconfig RAID sets with a new '-L' flag.
 1.397  26-Jul-2021  oster branches: 1.397.2;
Add support for detecting and configuring nested RAID setups at boot.
 1.396  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.395  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.394  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.393  24-May-2021  mrg make various things static, and minor KNF clean up.
ignore spiflash as a raid device.
 1.392  26-Apr-2021  mrg branches: 1.392.2;
if raidframe sets booted_device, log a debug message about it.
 1.391  11-Apr-2021  mrg branches: 1.391.2;
mark an extremely uncommon, but sometimes seen, log message
with the function name it comes with.
 1.390  27-Sep-2020  christos branches: 1.390.4;
DIOCCACHESYNC takes an int argument, pass it through.
 1.389  25-Aug-2020  skrll KNF
 1.388  31-Jul-2020  christos no need for continue
 1.387  31-Jul-2020  christos - don't overwrite existing error.
- return the error not 0 if failing.
 1.386  31-Jul-2020  christos Factor out the component cache flushing code; add retries.
 1.385  20-Jun-2020  riastradh Nix trailing whitespace.
 1.384  19-Jun-2020  jdolecek pass down b_flags B_PHYS|B_RAW|B_MEDIA_FLAGS from bio subsystem
to component I/O

fixes the xbd(4) KASSERT() triggered by raidframe, noted in PR kern/55397
by Frank Kardel
 1.383  16-Jun-2020  oster Improve wording in comments in raid_dumpblock().
 1.382  13-Apr-2020  chs slightly change and fix the semantics of pool_set*wat(), pool_sethardlimit()
and pool_prime() (and their pool_cache_* counterparts):

- the pool_set*wat() APIs are supposed to specify thresholds for the count of
free items in the pool before pool pages are automatically allocated or freed
during pool_get() / pool_put(), whereas pool_sethardlimit() and pool_prime()
are supposed to specify minimum and maximum numbers of total items
in the pool (both free and allocated). these were somewhat conflated
in the existing code, so separate them as they were intended.

- change pool_prime() to take an absolute number of items to preallocate
rather than an increment over whatever was done before, and wait for
any memory allocations to succeed. since pool_prime() can no longer fail
after this, change its return value to void and adjust all callers.

- pool_setlowat() is documented as not immediately attempting to allocate
any memory, but it was changed some time ago to immediately try to allocate
up to the lowat level, so just fix the manpage to describe the current
behaviour.

- add a pool_cache_prime() to complete the API set.
 1.381  21-Mar-2020  riastradh branches: 1.381.2;
Restore historic $Hdr: ...$ text.

This was presumably eaten by git cvsexportcommit, which is curious
because I thought I had gotten out of the habit of passing -k to it.
 1.380  01-Mar-2020  riastradh Add a flag to dk_dump for virtual disk devices.

If a disk is backed by a physical medium other than itself, such as
cgd(4), then it passes DK_DUMP_RECURSIVE to disable the recursion
detection for dk_dump.

If, however, a device represents a physical medium on its own, such
as wd(4), then it passes 0 instead.

With this, I can now dump to dk on cgd on dk on wd.
 1.379  10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.378  30-Oct-2019  martin Gcc -Os on landisk is not smart enough to follow the conditional
initialization and warns, unconditionaly initialize dksc at declaration
with a XXX gcc comment.
 1.377  30-Oct-2019  maxv Get &rsc->sc_dksc only when we know 'rsc' is not NULL. This was actually
harmless because we didn't use the pointer then.

Reported-by: syzbot+77097fae0e3aad6de088@syzkaller.appspotmail.com
 1.376  01-Mar-2019  pgoyette branches: 1.376.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.375  20-Feb-2019  hannken Fix vnode locking, must lock for VOP_OPEN() and VOP_UNLOCK() when done.
 1.374  09-Feb-2019  christos - 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.373  07-Feb-2019  christos You need a star :-)
 1.372  06-Feb-2019  christos - Restore indirecting through the data pointer
- Don't try to load compat code if the ioctl is not for us.
 1.371  06-Feb-2019  oster Fix GET_INFO. Yes, can probably be simplified.
 1.370  06-Feb-2019  christos use 'data' directly.
 1.369  06-Feb-2019  oster Fix logic inversion. Progress, but still broken.
 1.368  06-Feb-2019  oster Shuffle softc declarations to a different .h file. Create missing
rf_get_raid(). Things compile, but don't work correctly.
 1.367  05-Feb-2019  christos - Redo all the ioctl compat stuff to use a standard "ioctl" interface,
and provide methods to the private softc
- Provide a function for constructing a RF_Raid_t from an RF_Config_t
- Factor out the big inline ioctl code into functions
 1.366  05-Feb-2019  christos - Fix the FAIL_DISK handling (it would prolly trash the wrong disk before
since the request structs are different and the row in the old struct is
the col in the new one).
- Restructure the way compat modules are loaded so that we only load them
for the ioctls that need them. Put a comment explaining why...
- Set retcode after loading compat (now that the fail disk passthrough
hack is gone), so that various ioctls don't always fail.
 1.365  05-Feb-2019  mrg remove duplicated line in previously. noticed by paulg.
 1.364  05-Feb-2019  mrg fix the previous:

rf_netbsd32 is only relevant on _LP64 as all the structures are
the same for arm32 oabi/eabi compat.

only do it for _LP64 *and* COMAPT_NETBSD32.
 1.363  04-Feb-2019  mrg don't assume _LP64 == supports COMPAT_NETBSD32.

this is not true for alpha, ia64 and arm32 ports, and the first two
were not building because of it, and the latter would be missing
the oabi support (likely not a big deal, but still wrong.)

add a makefile fragment that tells you if it is supported and include
it where needed to define COMPAT_NETBSD32 when building the normal
kernel (ie, modules & rump.)


fixes alpha build, probably fixes ia64 build.


XXX: still leaves some netbsd32 code in rf_netbsdkintf.c, that should
be moved into some hooks, but first the configuration setup
needs to be moved into a common function the netbsd32 code can
call into, vs living in the switch case itself.
 1.362  03-Feb-2019  martin When we force COMPAT_NETBSD32 to be defined, force it to the same value
that opt_compate_netbsd32.h would have, otherwise we get a "redefined"
error from gcc.
XXX this looks fishy, Paul, can you have a look, please?
 1.361  03-Feb-2019  pgoyette Don't include the raidframe compat code in the main raid module, the
compat code lives in their own compat_raid_xx modules, which will now
be autoloaded if needed.

While here, extract the compat_netbsd32_raid code into its own module,
too.

Welcome to 8.99.34
 1.360  29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.359  28-Jan-2019  bad print additional debug information. make rf_containsboot() return 0
if bdv == NULL, to aid in the former.

As discussed 1 week ago on tech-kern.
 1.358  27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.357  08-Jan-2019  mrg remove the final tsleep/wakeup pair in raidframe.
 1.356  23-Jan-2018  pgoyette branches: 1.356.2; 1.356.4;
Add "bufq_fcfs" requirement to all those driver modules that explicitly
request it in their calls to bufq_alloc().
 1.355  20-Jan-2018  mrg fixes for the previous, noted by nakayama@.

- RAIDFRAME_CONFIGURE needs to be versioned as the rows was removed,
adding RAIDFRAME_CONFIGURE80, rf_config80() etc.
- RAIDFRAME_CONFIGURE32 changes to match
- rf_get_info80() passed the wrong source to copyout()

some fixes to my original change were independantly made by nakayama@
who confirmed the changes work properly now.
 1.354  19-Jan-2018  skrll Fix some ARM kernel builds. ARM abuses compat32 for ABI compatibility and
this means some ioctls overlap.
 1.353  18-Jan-2018  mrg implement 32-bit compat support for raidframe.

convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly. remove useless 'row' in a few
places. add COMPAT_80 and put the old ioctls there.

raidframeio.h:
RAIDFRAME_TEST_ACC
- remove, unused
RAIDFRAME_GET_COMPONENT_LABEL
- convert to label not pointer to label
RAIDFRAME_CHECK_RECON_STATUS_EXT
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
- convert to progress info not pointer to info
RAIDFRAME_GET_INFO
- version entirely.
raidframevar.h:
- rf_recon_req{} has row, flags and raidPtr removed (they're
not a useful part of this interface.)
- RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
- RF_RaidDisk_s{} is re-ordered slightly to fix alignment
padding - the actual data was already OK.
- InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified. for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.
 1.352  14-Nov-2017  christos check the result of pool_prime.
 1.351  09-Nov-2017  christos add a "booted_method" string to aid in debugging double boot matches.
 1.350  01-Jun-2017  chs branches: 1.350.2;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.349  05-Apr-2017  jdolecek branches: 1.349.4;
rf_get_component_caches(): remove useless condition
 1.348  05-Apr-2017  jdolecek add support for DIOCGCACHE; contrary to DIOCCACHESYNC, query any non-dead
disk in the set, even currently reconstring one
 1.347  19-Sep-2016  jdolecek branches: 1.347.2;
fix mistake fallthrough in the ioctl switch introduced in previous commit
 1.346  19-Sep-2016  jdolecek fix DIOCCACHESYNC ioctl on ld(4) and raid(4) to work again; it got broken
when the code was switched over to dk_ioctl() - countrary to disk_ioctl(),
dk_ioctl() returns ENOTTY for ioctls it doesn't support, so must be called
as last resort, not first

bug was introduced in rev 1.83 (2015-05-02) for ld(4), and 1.335 (2016-01-03)
for raid(4)
 1.345  27-Apr-2016  christos branches: 1.345.2;
provide an empty DPRINTF
 1.344  27-Apr-2016  christos Extend the "a" partition hack to also mean the first partition on the raid,
for non-disklabel based raidframe disks that need root.
 1.343  07-Jan-2016  christos gc unused flags
 1.342  07-Jan-2016  mlelstv CID 1347189: Null pointer dereferences
 1.341  06-Jan-2016  christos Add a SET_LAST_UNIT ioctl.
 1.340  05-Jan-2016  christos revert bp->b_error checking; biowait() is a no-op in that case and it is
valid to call biowait() after biodone. (thanks chuq)
 1.339  05-Jan-2016  mlelstv When autoconfiguring RAID sets:

Pseudo devices like vnd and cgd can be opened but may still
need some configuration. Ignore these quietly.
 1.338  05-Jan-2016  mlelstv handle possible errors from bdev_strategy.
 1.337  04-Jan-2016  mlelstv prevent unconfigure/detach while background threads are running.
 1.336  04-Jan-2016  mlelstv Fix dump on raid.
- offset dump by RF_PROTECTED_SECTORS (thanks oster@ for noticing)
- call component dump function with byte count instead of block count
- return -1 instead of errno values in dk_size for error conditions.

There are still issues with dumping.
- the raid device must be open, neither reading the disklabel
nor flushing the component labels in rfmarkdirty is possible
when dumping.
- dumping to a wedge component fails because the wedge driver only
allows dumping to swap partitions, not raid partitions.
 1.335  03-Jan-2016  mlelstv refactor driver to use common code in dksubr.
 1.334  02-Jan-2016  mlelstv No longer detach opened device directly in RAIDFRAME_SHUTDOWN ioctl,
instead just mark the device for shutdown and detach on last close.

Also don't manually print the detached message but leave this to
config_detach(). This avoids a duplicate message when shutting down.
 1.333  02-Jan-2016  mlelstv RAIDF_INITED state also includes disk attachments, don't undo operations
that haven't been committed.
 1.332  02-Jan-2016  mlelstv Unlock and free in raid_detach to handle error paths.
 1.331  02-Jan-2016  mlelstv use bdev_strategy wrapper to properly use KERNEL_LOCK.
 1.330  26-Dec-2015  pgoyette Another use-after-free()
 1.329  26-Dec-2015  pgoyette If the "finalizer" should fail to register for any reason, just report
the situation (as a WARNING) and continue. Don't return the error code
to the caller. Failure to register should not really happen - if it
does, all we really lose is auto-configuration of raid-sets.
 1.328  26-Dec-2015  pgoyette Resolve a use-after-free reference to the softc. From mlelstv@
 1.327  26-Dec-2015  pgoyette 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.326  08-Dec-2015  christos Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.325  20-Aug-2015  christos include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.324  10-Jul-2015  mrg mark all the device entry points static.
 1.323  26-Apr-2015  mlelstv Use C99-style initializers for struct dkdriver.
 1.322  03-Jan-2015  prlw1 Also print b_error in the IO Error message
 1.321  02-Jan-2015  christos We have three sets of DTYPE_ constants in the kernel:
altq Drop Type
disklabel Disk Type
file Descriptor Type
(not to mention constants that contain the string DTYPE).
Let's make them two, by changing the disklabel one to be DisK TYPE since the
other disklabel constants seem to do that. Not many userland programs use
these constants (and the ones that they do are mostly in ifdefs). They will
be fixed shortly.
 1.320  31-Dec-2014  christos make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
 1.319  31-Dec-2014  christos Centralize wedge ioctls in disk_ioctl.
 1.318  31-Dec-2014  mlelstv disk_blocksize and disk_set_info relay the same information
to the disk subsystem.

Make disk_set_info also set blocksize shift values.
Remove every call to disk_blocksize.

Keep disk_blocksize for ABI compatibility, make it also set dg_secsize.
 1.317  21-Dec-2014  taca Stop useless disklabel warning if there are wedges, using GPT partition.
Fix PR kern/47989.

XXX: Pullup 6 and 7 (maybe 5)
 1.316  14-Nov-2014  oster branches: 1.316.2;


Fix a long-standing bug related to rebooting while a
reconstruct-to-spare is underway but not yet complete.

The issue was that a component was being marked as a used_spare when
the rebuild started, not when the rebuild was actually finished.
Marking it as a used_spare meant that the component label on the spare
was being updated such that after a reboot the component would be
considered up-to-date, regardless of whether the rebuild actually
completed!

This fix includes:
1) Add an additional state "rf_ds_rebuilding_spare" which is used
to denote that a spare is currently being rebuilt from the live
components.
2) Update the comments on the disk states, which were out-of-sync
with reality.
3) When rebuilding to a spare component, that spare now enters the
state rf_ds_rebuilding_spare instead of the state rf_ds_used_spare.
4) When the rebuild is actually complete then the spare component
enters the rf_ds_used_spare state. rf_ds_used_spare is now used
exclusively for the case where the rebuilding to the spare has
completed successfully.

XXX: Someday we need to teach raidctl(8) about this new state, and
take out the backwards compatibility code in rf_netbsdkintf.c (see
RAIDFRAME_GET_INFO in raidioctl()). For today, this fix needs to be
generic enough that it can get backported without major grief.

XXX: Needs pullup to netbsd-5*, netbsd-6*, and netbsd-7

Fixes PR#49244.
 1.315  04-Nov-2014  mlelstv support DIOCMWEDGES ioctl.
 1.314  11-Oct-2014  mlelstv No longer warn about differences bewteen disk size and total sector count
in disklabel when the latter is just clamped to the maximum.
 1.313  11-Oct-2014  mlelstv clamp total number of sectors to UINT32_MAX instead of providing the
lower 32bit of the 64bit number.
 1.312  25-Jul-2014  dholland branches: 1.312.2;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.311  25-Jul-2014  dholland Add d_discard to all struct bdevsw instances I could find.

I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
 1.310  12-May-2014  christos restore defaulting to the 'a' partition for booting with root on raid as
it was before, and explain why we do things this way.
 1.309  08-May-2014  jakllsch Revert default strategy change from 1.298 (which has since moved).

Reverting to "fcfs" nearly doubles the speed of sequential reads from
a level-1 RAID (previously using the default of "priocscan").

Needs pullup via patch for netbsd-6.
 1.308  03-Apr-2014  christos branches: 1.308.2;
Add a "soft" root option, leaving the current default as "force root", so
as not to break existing configurations.
 1.307  03-Apr-2014  christos Fix bugs in raidframe + wedge and root interaction:
1. Don't call cpu_rootconf() just to setup booted_device. Calling cpu_rootconf()
multiple times can have nasty side effects (aside from printing root device
twice). Instead for those who have it, call cpu_bootconf() which is intended
just for that.
2. If the raid component devices are wedges, then matching the booted_device
against the wedges will never work; match instead on the wedges parent.
XXX: perhaps should keep looking if the parent is a wedge too?
 1.306  02-Apr-2014  christos If we are autoconfiguring root, then only change the booted_device if
we booted from one of the components of the root raid set. This allows
us to boot from other media, without forcing the found raid to always
be root. Allow the old behavior with RAIDFRAME_FORCE_ROOT.
XXX: cpu_rootconf() is called twice now, which prints the booted device
message twice. Perhaps we can remember that cpu_rootconf has been called
and avoid calling it twice to avoid that.
 1.305  16-Mar-2014  dholland Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.304  29-May-2013  christos branches: 1.304.2;
phase 1 of disk geometry cleanup:
- centralize the geometry -> plist code so that we don't have
n useless copies of it.
 1.303  23-May-2013  christos PR/47846: Frank Kardel: panic/lockups in raidframe during detach at shutdown
XXX: Fix this properly by using the memory allocated from the autoconf
subsystem and use raidput in all the places needed.
 1.302  29-Apr-2013  christos Set the raidid and the softc together in both places where we initialize
raidPtr.
 1.301  28-Apr-2013  christos no need for raid.h
 1.300  27-Apr-2013  christos allocate devices dynamically.
 1.299  18-Feb-2013  oster Fix a few spelling issues. No functional changes.
 1.298  09-Aug-2012  buhrow branches: 1.298.2;


Implement DIOCGSTRATEGY and DIOCSSTRATEGY to allow raidframe to use
different buffer queue strategies.
Initialize raid sets to use the default buffer queue strategy for the given
architecture, rather than forcing raidframe to use fcfs in all cases.
This should cause raidframe to use the same buffer queue strategy as the
underlying disks.
On I386, I see performance enhancements of between 14 and 16% with raid5
sets with no other change.
See http://mail-index.NetBSD.org/tech-kern/2012/08/08/msg013758.html
for a discussion of this issue.
 1.297  07-Apr-2012  christos If our raid is now accessed from wedges, adjust the root to be the wedge
that corresponds to partition a. Is there a better way?
 1.296  16-Feb-2012  buhrow Add the ability to autoconfigure raid components on raw disks.
This change causes components on raw disks, as opposed to components inside
partitions or wedges, to be autoconfigured if the raid set is configured
for autoconfiguration.

Approved by oster@ and mrg@ for submission after the NetBSD-6 tag. I've
been running these changes in production at my day job for over a year
without a problem.

See http://mail-index.NetBSD.org/tech-kern/2010/11/09/msg009167.html
for the original discussion of this patch and for a version of this patch
that works with NetBSD-5.x systems.
 1.295  05-Nov-2011  erh branches: 1.295.4; 1.295.6;
Statically initialize the raidautoconfig variable when RAID_AUTOCONFIG is set,
instead of setting it in code, so it can easily be checked and changed in an
on-disk kernel with gdb. Use a separate raidautoconfigdone variable to keep
track of whether raid configuration has actually occurred.
 1.294  03-Aug-2011  oster branches: 1.294.2;

Remove unused 'struct lwp *' from rf_getdisksize. No functional changes.
 1.293  30-Jul-2011  jmcneill Add an FSILENT flag and use it to suppress "Medium Not Present" scsipi
spam when trying to access offline drives at boot.
 1.292  29-Jul-2011  oster In rf_disks.c make sure ser_values and ser_count arrays are
initialized before use.

Validate the component label before considering a component for use,
and make sure we only consider components that are optimal.

Fixes PR#44251. All atf RAIDframe tests now pass.
 1.291  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.290  10-May-2011  mrg print "raidN: detached" when unconfiguring a raid device.
 1.289  05-May-2011  mrg finish porting mcpair users to kmutex, and fix a couple of declarations
in rf_netbsdkintf.c. fixes i386/conf/ALL build.
 1.288  01-May-2011  mrg convert rf_tracing_mutex to a kmutex.
 1.287  01-May-2011  mrg convert the (unused) rf_sparet_wait_mutex to a real mutex/cv.
 1.286  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.285  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.284  18-Mar-2011  mrg apply the fix_label hack to partitionSizeHi as well. it's needed there.
to do so, move the call to fix the label inside of rf_reasonable_label()
itself, so we can fix the partition sizes before calling
rf_component_label_partitionsize() itself.

fixes the failure mode where i had garbage not in numBlocksHi but in
partitionSizeHi, and the check against rf_component_label_partitionsize()
would fail and my raid would not auto-configure.
 1.283  04-Mar-2011  oster Remove bogus RF_ASSERT that must have crept in by accident.
Thanks to Jan-Hinrich Fessel for reporting the issue.
 1.282  19-Feb-2011  enami Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.
 1.281  08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.280  07-Jan-2011  christos branches: 1.280.2; 1.280.4;
PR/44340: Brian Buhrow: Raid sets containing wedges cannot be unconfigured
and reconfigured without a reboot.
 1.279  22-Dec-2010  christos print the error code for writing parity.
 1.278  11-Dec-2010  mrg add a hack to fix up old labels that do not have zero's in numBlocksHi:
if the total sectors reported (via disklabel or otherwise) is smaller
than 2^32, but numBlocksHi is set, zero it out instead.

tested by myself and christos, should fix reports of weirdness seen.
 1.277  08-Dec-2010  christos PR/44207: Wolfgang.Stukenbrock:
memory-leak in raid-ioctl(RAIDFRAME_GET_COMPONENT_LAB
 1.276  04-Dec-2010  mrg apply my patch to support non-512K sector disks (at least, upto 16KB
sector disks..) from my tech-kern post:


the following patch let's me access both 512 byte and 4K
sector disks at the same time, as long as they are in
separate raids. the existing rf code assumes/enforces
this part, i just made it support other sets concurrently.

the main change is moving the parity bitmap to the sector
after the component label sector(s), instead of being
immediately after the label, which meant it was on the same
sector as the label for >1024 byte devices.

i'm a little annoyed at having to add a 2nd call to
getdisksize() to enable auto-configure to work, but i
don't see another way that wasn't much uglier.
 1.275  01-Nov-2010  mrg add support for >2TB raid devices.

- add two new members to the component label:
u_int numBlocksHi
u_int partitionSizeHi
and store the top 32 bits of the real number of blocks and
partition size. modify rf_print_component_label(),
rf_does_it_fit(), rf_AutoConfigureDisks() and
rf_ReconstructFailedDiskBasic().

- call disk_blocksize() after disk_attach() [ from mlelstv ]

- shift the block number relative to DEV_BSHIFT in raidstart()
and InitBP() so that accesses work for non 512-byte devices.
[ from mlelstv ]

- update rf_getdisksize() to use the new getdisksize() [ from
mlelstv. this part needs a separate change for netbsd-5. ]


reviewed by: oster, christos and darrenr
 1.274  08-Aug-2010  chs only print the boot-time message if we're being verbose.
 1.273  14-Mar-2010  jld branches: 1.273.2;
For RAID sets which have no parity (i.e., RAID level 0) and therefore can
never have a parity map, make the parity map ioctls fail with EINVAL.

This makes `raidctl -m` print a scary-looking error on such sets, which
is an improvement over the previous behavior of falsely claiming that
the parity map would be enabled on the next configuration.
 1.272  01-Mar-2010  oster Don't merge a good parity map with random stuff in the event that the
first component is missing. (Since the merging just OR's the maps,
this isn't that big of a deal, as it will just over-estimate the
amount of checking that needs to be done.)
 1.271  01-Dec-2009  dyoung branches: 1.271.2;
KNF: whitespace.
 1.270  21-Nov-2009  christos whitespace police
 1.269  17-Nov-2009  jld 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.268  05-Nov-2009  dyoung Use deviter(9) instead of accessing alldevs directly. Compile-tested,
only.
 1.267  13-Oct-2009  pooka raidframe doesn't need sys/user.h (or at least one would hope so ;)
 1.266  23-Jul-2009  dyoung Move the RAID shutdown to the raid(4) detachment routine, and use
config_detach(9) to shutdown a RAID.

Detach raid(4) units at shutdown.

Ok by oster@.
 1.265  10-Jun-2009  pooka Attempt bailout if config_attach_pseudo() fails. Otherwise, a few
moments later, we'll take a fatal plunge because sc_dev is null.
 1.264  06-Jun-2009  haad Fix my previous commit.
 1.263  05-Jun-2009  haad Add support for DIOCGDISKINFO to disk like device drivers. Change
partutil.c::getdiskinfo to use it to get disk geometry info.
Use DIOCGWEDGEINFO ioctl to get information about partition size, if disk
driver doesn't support it use old DIOCGDINFO. This patch adds support for
wedge like devices(lvm logical volumes, ZFS zvol partitions) to newfs and
other tools.

No objections on tech-userlevel@.
 1.262  12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.261  01-May-2009  dyoung Use device_t, cfdata_t, device_private().
 1.260  03-Apr-2009  sborrill Switch various printfs from %ld and %d to PRIu64, etc. to be more consistent
about types (for instance uint32_t was being printed with %d).
 1.259  15-Mar-2009  cegger ansify function definitions
 1.258  14-Mar-2009  ad 'boot -z' bogons
 1.257  28-Feb-2009  oster Nuke a DIAGNOSTIC check that is no longer useful, even for DIAGNOSTIC.
 1.256  28-Feb-2009  oster It seems that some SCSI drivers can block while the spinlock on a given
disk queue is being held. Work around this by dropping the lock before
bdev_strategy(), and re-grabbing the lock afterwards. This is a
temporary measure until I get to gutting this queue locking code.

There has been some success with this in addressing PR#39993.
This patch is from Antti Kantee. Thanks!
 1.255  07-Feb-2009  oster branches: 1.255.2;
Be consistent with wd.c and don't complain loudly if the underlying
device doesn't support flushing the cache. Fixes an issue (reported
privately) where ST39120A drives are not capable of flushing the
cache, and RAIDFrame was incessantly complaining.
 1.254  18-Jan-2009  christos add compat50 ioctls.
 1.253  13-Jan-2009  yamt g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.252  11-Jan-2009  oster Implement DIOCCACHESYNC for RAIDframe too.
 1.251  18-Nov-2008  ad _KERNEL_OPT
 1.250  28-Sep-2008  oster branches: 1.250.2; 1.250.4;
Undo previous change to an #if 0. The code does belong to the
distributed sparing bits, but no-one has compile-tested the code.
Un-breaks the ALL build.
 1.249  27-Sep-2008  oster Cleanup some of the spare table stuff. It is not needed in the general
case, and is only needed for parity declustering with distributed
sparing.
 1.248  16-Jun-2008  oster branches: 1.248.2;
We don't care about md devices here. Fixes issue reported by Jukka Salmi
on current-users. Thanks!
 1.247  07-Jun-2008  oster branches: 1.247.2;
- Use bdev_strategy() instead of VOP_STRATEGY().
- Don't bother taking the v_interlock or bumping b_vp->v_numoutput --
there won't be any other writers for this bp, and so there's no point
doing this locking song'n'dance.

Patch from Juergen Hannken-Illjes. Thanks!!!

Addresses PR#38856. With this change I've been unable to
replicate the hard hangs.
 1.246  28-Apr-2008  martin branches: 1.246.2;
Remove clause 3 and 4 from TNF licenses
 1.245  05-Apr-2008  cegger branches: 1.245.2; 1.245.4;
use aprint_*_dev and device_xname
 1.244  21-Mar-2008  ad Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.243  04-Jan-2008  ad branches: 1.243.6;
Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
 1.242  02-Jan-2008  ad Merge vmlocking2 to head.
 1.241  18-Dec-2007  oster Fix a 'use after free' issue with wedges and RAIDframe.
Problem reported and fix tested by Jeff Rizzo (Thanks!).
 1.240  11-Dec-2007  oster Use CFATTACH_DECL_NEW instead of CFATTACH_DECL... ICB wisdom
is that this will fix the config_devalloc panic.
 1.239  01-Dec-2007  jmcneill branches: 1.239.2; 1.239.4; 1.239.6;
aprintify
 1.238  26-Nov-2007  pooka Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.237  17-Nov-2007  oster Nuke debugging output that is a) misleading at best, and
b) often just wrong. Thanks to wiz for catching this.
 1.236  13-Nov-2007  yamt don't include <sys/namei.h> unnecessarily.
 1.235  08-Nov-2007  oster We need to initialize dk_driver as well. Thanks to Ronald Roskens
for reporting the problem and testing the fix.
 1.234  01-Nov-2007  oster branches: 1.234.2;
Implement support for drvctl in RAIDframe. Thanks to jnemeth@ for
initial patch.
 1.233  08-Oct-2007  ad branches: 1.233.2;
Merge brelse() changes from the vmlocking branch.
 1.232  08-Oct-2007  ad Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
 1.231  05-Oct-2007  oster Implement dumping kernel cores to RAID 1 sets. The component used
for the dump is selected in this order of preference:
1) the master
2) a used_spare of the master
3) the slave
4) a used_spare of the slave
 1.230  29-Jul-2007  ad branches: 1.230.4; 1.230.6; 1.230.8; 1.230.10;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.229  18-Jul-2007  ad Fix fallout from recent kthread changes.
 1.228  24-Jun-2007  christos branches: 1.228.2;
don't leak a vnode in the wedge case.
 1.227  12-Mar-2007  ad branches: 1.227.2;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.226  09-Mar-2007  oster branches: 1.226.2;
In the case of multiple RAID sets that are marked as root, attempt to
use the RAID set that contains the component used for booting. Thanks
to manu@ for the main part of this.
 1.225  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.224  30-Nov-2006  oster branches: 1.224.2; 1.224.4; 1.224.8;
Change a bunch of "#if DEBUG" to "#ifdef DEBUG".
 1.223  30-Nov-2006  oster If the user has specified 'root on foo', then skip changing the booted_device
even if we've detected a 'root on raid' autoconfigure. This change is really
only cosmetic, since setroot() will still do the right thing and honor
the 'root on foo' setting.
 1.222  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.221  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.220  09-Oct-2006  oster Remove unused variable. (Noted by mrg. Thanks.)
 1.219  08-Oct-2006  oster Fix previous a different way. (pseudo_disk_init() needed to be called earlier)
 1.218  08-Oct-2006  christos Call pseudo_disk_init in the autoconfig case.
 1.217  08-Oct-2006  oster Re-work some of the initialization code to now use config_attach_pseudo()
and friends. Addresses PR#32881. BOOT_FROM_RAID_HOOKS dies.
More simplification possible now.
 1.216  05-Oct-2006  oster Revert previous change: Remove an unused variable declaration that was
(likely accidentally) added as the only change in the last commit.
 1.215  05-Oct-2006  tls Protect calls to pool_put/pool_get that may occur in interrupt context
with spl used to protect other allocations and frees, or datastructure
element insertion and removal, in adjacent code.

It is almost unquestionably the case that some of the spl()/splx() calls
added here are superfluous, but it really seems wrong to see:

s=splfoo();
/* frob data structure */
splx(s);
pool_put(x);

and if we think we need to protect the first operation, then it is hard
to see why we should not think we need to protect the next. "Better
safe than sorry".

It is also almost unquestionably the case that I missed some pool
gets/puts from interrupt context with my strategy for finding these
calls; use of PR_NOWAIT is a strong hint that a pool may be used from
interrupt context but many callers in the kernel pass a "can wait/can't
wait" flag down such that my searches might not have found them. One
notable area that needs to be looked at is pf.

See also:

http://mail-index.netbsd.org/tech-kern/2006/07/19/0003.html
http://mail-index.netbsd.org/tech-kern/2006/07/19/0009.html
 1.214  28-Sep-2006  oster Make sure the 'last configured as' field in the component labels
are updated each time the component labels are written.
 1.213  27-Aug-2006  christos branches: 1.213.2; 1.213.4;
- use dk_lookup instead of our home-spun version.
- allow raid to be configured in a wedge
- allow wedges to be configured in a raid
- add autoconfiguration of wedges in a raid
 1.212  07-Aug-2006  oster sc_size should be a 64-bit quantity. Notice by Matthias Drochner.
 1.211  07-Aug-2006  oster Fix a minor typo in a comment.
 1.210  21-Jul-2006  ad - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.209  12-Jun-2006  oster Do the "don't allocate > 1K on the stack" thing for raidioctl().
 1.208  14-May-2006  elad branches: 1.208.2;
integrate kauth.
 1.207  12-Apr-2006  simonb Don't access b_fspriv.bf_private in struct buf directly - use the
b_private macro.

OK'd by oster@
 1.206  28-Mar-2006  thorpej Use device_is_a() and device_unit().
 1.205  25-Mar-2006  rtr free storage of clabel before bailing out.

coverity 2745 / run 11
 1.204  19-Mar-2006  simonb Use tabs instead of spaces with previous change.
 1.203  19-Mar-2006  david Fix memory leaks when some components of a raid where missing during
autoconfig.

From Coverity CIDs 2328, 2324, 2323, 1125
 1.202  01-Mar-2006  oster branches: 1.202.2; 1.202.4; 1.202.6;
Fix lossage related to device_is_a() changes. Fix from cube@ (thanks!).
Tested by me.
 1.201  24-Feb-2006  oster - minor comment cleanup
- nuke an extraneous memset() (RF_Malloc() already does that)
from RAIDFRAME_GET_INFO in raidioctl().
 1.200  21-Feb-2006  thorpej Use device_class() instead of accessing dv_class directly.
 1.199  08-Jan-2006  oster branches: 1.199.2; 1.199.4;
Really move all of the bp initalization bits into InitBP().
 1.198  08-Jan-2006  oster For the normal (read/write) case, do all the buffer initialization
inside of InitBP().
 1.197  08-Jan-2006  oster Cleanup the initialization of buffers a bit, and remove some old code
that works around a bug that no longer exists. From yamt. Thanks!
(a bit more cleanup to follow)
 1.196  08-Jan-2006  yamt raidstrategy: fix weird ENOSPC when reading from/writing to a raw partition.
 1.195  08-Jan-2006  yamt raidioctl:
- don't ignore raidread_component_label error.
- remove an unnessesary memset.
 1.194  07-Jan-2006  oster Remove the component buffer bits, now that I know there is a
"private" structure in struct buf that can be used to keep track of
the request associated with this buffer (the buffer used here is one
allocated from rf_CreateDiskQueueData(), so it's ours to do with what
we please). Shrinks code a little, reduces the run-time memory
footprint a bit, and simplifies both rf_DispatchKernelIO() and
KernelWakeupFunc().

Thanks to yamt for his "why is rf_DispatchKernelIO using another buf"
question which prompted me to revisit this code.
 1.193  04-Jan-2006  oster We need to mark used spares as failed if they encounter IO errors!
Commit fixes problem reported (privately) by Jeff Rizzo.


XXX: Note that we are still are unable to allow a reconstruct of
a failed spare -- it's easy enough to attempt to do it, but the
code in rf_ContinueReconstructFailedDisk() isn't anywhere close to
ready to allow it. Yet another reason why the whole disk/spare thing
needs to be re-worked. *sigh*
 1.192  11-Dec-2005  christos branches: 1.192.2;
merge ktrace-lwp.
 1.191  15-Oct-2005  yamt - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)
 1.190  25-Sep-2005  oster Re-work the handling of incoming I/O in RAIDframe:
- introduce rf_buf_queue_check() which checks to see if there
is work to do in the incoming buffer queue
- rf_RaidIOThread() is now responsible for calling raidstart(), and is
also now the only place that calls raidstart()
- raidstrategy() now just queues requests in buf_queue
and signals rf_RaidIOThread() that work has arrived

Hopefully addresses PR#30233
 1.189  24-Sep-2005  oster This disk_detach() should be pseudo_disk_detach().
 1.188  20-Aug-2005  yamt use pseudo_disk_{init,attach,detach} where appropriate.
 1.187  29-May-2005  christos branches: 1.187.2;
- avoid variable shadowing
- add a lot of const
- remove parameters from functin declarations
 1.186  27-Feb-2005  perry branches: 1.186.2;
nuke trailing whitespace
 1.185  17-Nov-2004  oster branches: 1.185.4; 1.185.6;
Don't allow -f to fail a disk while a reconstruction is taking place
since that would cause a panic. (Problem noticed by dan@.)
 1.184  16-Nov-2004  oster Initialize parity_rewrite_stripes_done to remove the window where
bogus values could be returned at the start of parity rewriting.
 1.183  16-Nov-2004  oster 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.182  28-Oct-2004  yamt move buffer queue related stuffs from buf.h to their own header, bufq.h.
 1.181  15-Oct-2004  thorpej rf_find_raid_components():
- If DIOCGDINFO failed with ENOTTY, don't print an error message; wedges
don't support that ioctl. Clean up the error message.
- If DIOCGDINFO fails, don't proceed to examine an invalid disklabel
structure.
 1.180  01-Jul-2004  oster The result of rf_DoAccess() should *not* be assigned to bp->b_error.
As well, when we do detect some sort of an error, we should be doing a
biodone() here. Thanks to yamt for noting the missing biodone(), as
that led to discovery of the additional lossage.
 1.179  22-Apr-2004  itojun sprintf -> snprintf
 1.178  07-Mar-2004  oster branches: 1.178.2;
- 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.177  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.176  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.175  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.174  08-Feb-2004  oster Relegate some printf's to DEBUG land.
 1.173  25-Jan-2004  hannken Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.

VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp) Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp) Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
 1.172  10-Jan-2004  yamt store a i/o priority hint in struct buf for buffer queue discipline.
 1.171  04-Jan-2004  oster raidPtr->reconControl->percentCompleted only gets used in one
debugging printf, and in rf_netbsdkintf.c. We can do the calculations
inside of RF_DEBUG_RECON for the one debugging printf, and only
perform the percentCompleted calculation "on demand" in the
rf_netbsdkintf.c case. Shaves a few more bytes off an i386 GENERIC
kernel, and ever-so-slightly decreases the amount of work performed
during a reconstruct.
 1.170  31-Dec-2003  oster Remove a couple of incorrect comments. (rf_recon_req needs to be
passed to rf_ReconThread(), and there's no way around that for now.)
 1.169  30-Dec-2003  oster 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....]
 1.168  29-Dec-2003  oster Simplify defn's of rf_mutex_init() and rf_mutex_destroy(). Since
neither of these ever fail, no need to have a return value. That
makes all the "error detection" on these functions completely
unneeded. But since we're here, if we don't have a return value, then
why not make these macros? My.. look how things keep shrinking, with
no loss in functionality!
 1.167  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.166  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.165  30-Oct-2003  simonb Remove some assigned-to but otherwise unused variables.
 1.164  25-Oct-2003  christos Fix uninitialized variable warnings
 1.163  21-Oct-2003  fvdl Correct NULL abuse.
 1.162  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.161  29-Jun-2003  fvdl branches: 1.161.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.160  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.159  10-May-2003  thorpej Change bounds_check_with_label() to take a pointer to the disk structure,
rather than the label itself. This paves the way for some future changes.
 1.158  02-May-2003  dsl Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
 1.157  10-Apr-2003  simonb Remove an assigned-to but unused variable.
 1.156  21-Mar-2003  dsl Use 'void *' instead of 'caddr_t' in prototypes of VOP_IOCTL, VOP_FCNTL
and VOP_ADVLOCK, delete casts from callers (and some to copyin/out).
 1.155  25-Feb-2003  thorpej Add a new BUF_INIT() macro which initializes b_dep and b_interlock, and
use it. This fixes a few places where either b_dep or b_interlock were
not properly initialized.
 1.154  05-Feb-2003  pk Make the buffer cache code MP-safe.
 1.153  01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.152  19-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.151  21-Nov-2002  oster Fix up locking on a call to rf_update_component_labels().
Noticed by Manuel. Thanks Manuel!
 1.150  19-Nov-2002  oster #if out some stuff that's only used for some distributed sparing stuff.
Shaves another 500 bytes from an i386 kernel.
 1.149  19-Nov-2002  oster For reconstructs, move checks for failed components to before the
kernel threads are created.
 1.148  17-Nov-2002  oster When setting root or autoconfig status, be sure to update used_spares too!
 1.147  15-Nov-2002  oster These printf's have outlived their usefulness. *poof*
 1.146  14-Nov-2002  oster rf_markalldirty() needs to update the mod_counter for used_spares too!

This bug appears as "incorrect Mod Counters" in 'raidctl -s'. The
reason it was seen only in 'raidctl -s' is because of the conditions
needed to trigger the bug:
a) a raid set is configured
b) no partitions on that set are mounted or are otherwise in-use
c) a component is failed, and subsequently rebuilt to a hot spare
d) the machine is rebooted while something (e.g. 'raidctl -s') has
the device open (and, therefore, rf_markalldirty() has been called)
but before the final rf_update_component_labels() is done.

Needless to say, the window for this happening is *very* small, and it
was only because I was testing some obscure stuff that I even noticed it.
 1.145  01-Nov-2002  mrg implement separate read/write disk statistics:
- disk_unbusy() gets a new parameter to tell the IO direction.
- struct disk_sysctl gets 4 new members for read/write bytes/transfers.
when processing hw.diskstats, add the read&write bytes/transfers for
the old combined stats to attempt to keep backwards compatibility.

unfortunately, due to multiple bugs, this will cause new kernels and old
vmstat/iostat/systat programs to fail. however, the next time this is
change it will not fail again.

this is just the kernel portion.
 1.144  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.143  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.142  01-Oct-2002  thorpej Add a generic config finalization hook, to be called once all real
devices have been discovered. All finalizer routines are iteratively
invoked until all of them report that they have done no work.

Use this hook to fix a latent bug in RAIDframe autoconfiguration of
RAID sets exposed by the rework of SCSI device discovery.
 1.141  27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.140  27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.139  23-Sep-2002  oster struct proc *p was only assigned to. Thanks Simon B.
 1.138  23-Sep-2002  oster Make this build w/ DEBUG.
 1.137  23-Sep-2002  itojun make it compile with DIAGNOSTIC
 1.136  22-Sep-2002  oster RAIDGETBUF and RAIDPUTBUF were #defines that were only used in
one place. Simplify things by removing them, and clean up more
unneeded instances of 'unit' and 'rs'.
 1.135  22-Sep-2002  oster rf_flags wasn't being used. *poof*
 1.134  22-Sep-2002  oster A little housecleaning to nuke stuff that was unused.
 1.133  21-Sep-2002  oster #if 0 out one other function, and shuffle DEBUG code. Actually
reclaims another 14K!?!?!! Thanks Krister!
 1.132  21-Sep-2002  oster Garbage collect some old mountroothook stuff. Thanks Krister!
 1.131  19-Sep-2002  oster Nuke old (and now incorrect) comment.
 1.130  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.129  07-Aug-2002  oster Let's not bother poking CD's to see if they might have RAID sets
on them.
 1.128  04-Aug-2002  oster Nuke some unneeded #includes.
 1.127  24-Jul-2002  oster RAIDframe doesn't need to be so chatty on autoconfigure. Leave it
a chatty if DEBUG is set... (for now..)
 1.126  21-Jul-2002  hannken Rename bufq_init() to bufq_alloc().
Add bufq_free() to remove a buffer queue.
Avoid MALLOC while holding a spinlock.

From Chuck Silvers.
 1.125  20-Jul-2002  hannken Convert to new device buffer queue interface.
 1.124  13-Jul-2002  oster No need to unlock and then immediately relock a mutex.
 1.123  13-Jul-2002  oster - don't be quite so chatty.
- if we need to print stuff, print out which raid device the information
is related to (where applicable).
 1.122  13-Jul-2002  oster As suggested by MRG, if we have an autoconfig set for root, we should
set booted_device, even if RB_ASKNAME is set. That way the appropriate
device gets set as the default when it asks where you want to look for /.
 1.121  27-Jun-2002  leo Exclude the Atari/Milan floppy driver from being a RAID capable device.
 1.120  23-May-2002  leo Not so fast... Add a bit of comment to the previous change.
 1.119  23-May-2002  leo Treat the "hdfd" (Atari/Hades floppy) like all the other "fd"s. OK-ed by
Greg Oster.
 1.118  22-May-2002  wiz bcopy -> memcpy. Reviewed by Greg Oster.
 1.117  08-Mar-2002  thorpej branches: 1.117.6; 1.117.8;
Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map). Try to deal with this:

* Group all information about the backend allocator for a pool in a
separate structure. The pool references this structure, rather than
the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
to become available, but will still fail if it cannot callocate KVA
space for the pages. If this happens, carefully drain all pools using
the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
some pages, and use that information to make draining easier and more
efficient.
* Get rid of PR_URGENT. There was only one use of it, and it could be
dealt with by the caller.

From art@openbsd.org.
 1.116  09-Jan-2002  thorpej We only need a single component buffer pool.
 1.115  16-Dec-2001  oster Fix an off-by-one error when autoconfig is hunting for a free RAID
device in the rare event that the one it wants is already in use.
Thanks to Wolfgang Stukenbrock for noticing the bug and filing the PR.
This fix addresses PR#14862.
 1.114  28-Nov-2001  lukem use #ifdef RAID_AUTOCONFIG (for consistency with the rest of the kernel)
 1.113  15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.112  13-Nov-2001  lukem add RCSIDs
 1.111  06-Oct-2001  oster Backout a line that accidentally got included when the .h reorg went in.
 1.110  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.109  27-Jul-2001  oster branches: 1.109.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.108  18-Jul-2001  thorpej bzero -> memset
 1.107  16-Jul-2001  oster If we're closing the last partition on a RAID set and the system is
being shutdown, then unconfigure the RAID set too. This fixes a number
of issues with doing proper unconfigures/shutdowns of multi-level RAID
sets.

Thanks to Jason Thorpe and Bill Squier for the ideas/suggestions on
how/where to do this, and to Bill Squier for testing.
 1.106  21-Jun-2001  oster branches: 1.106.2;
We don't need to check for raidautoconfig here, so nuke it and
clean up a little.
 1.105  05-Apr-2001  oster A value of 1 for tracks/cylinder in the disklabel is apparently sub-optimal.
Thus we choose "4 * number_of_columns" as a more reasonable
value (until someone comes up with something better).
This pretends to properly address PR#11989.
 1.104  27-Jan-2001  oster branches: 1.104.2;
Un-'__P'ify.
 1.103  08-Jan-2001  fvdl Return error in the case of using ODIOCGDINFO or ODIOCGDEFLABEL when
the number of partitions is > OLDMAXPARTITIONS. This is better
than silently truncating the label (don't want to silently throw
away partitions when using an old disklabel binary on a label with
> 8 partitions). From Enami Tsugutomo.
 1.102  07-Jan-2001  fvdl Adapt all disk devices in MI directories to handle ODIOC* calls
for ports that have bumped MAXPARTITIONS (and thus define
__HAVE_OLD_DISKLABEL).
 1.101  05-Dec-2000  oster Fix a couple of warnings about uninitialized variables. Thanks go to
Frank van der Linden for pointing these out.
 1.100  20-Nov-2000  chs rationalize the use of b_flags for geteblk() buffers.
rather than assigning to the whole field, set or clear individual flags,
which implies that the B_BUSY and B_INVAL flags will remain set.
this allows us to make the assertion in brelse() that B_BUSY is set,
which is the purpose of all this.
 1.99  20-Oct-2000  oster Move disk_busy() and disk_unbusy() to more sane locations. Values
reported by 'systat iostat' and friends are now much more correct for
RAIDframe devices. Thanks to Andrew Doran for poking me about this,
and for suggestions on and review of the changes.
 1.98  17-Oct-2000  oster Don't touch a failed component at all. Thanks to Robert Elz (kre) for
noting the problem and providing additional comments.
 1.97  21-Sep-2000  oster Correct a few calls to VOP_CLOSE().
 1.96  08-Sep-2000  oster Make sure we are passing a locked vp to VOP_CLOSE.
 1.95  19-Aug-2000  oster Remove a bogus VOP_UNLOCK.
 1.94  19-Aug-2000  oster Don't try to initialize a component label on a failed component.
 1.93  14-Jul-2000  oster Fix the status reporting for copybacks. Thanks to Hubert Feyrer for
reporting the problem.
 1.92  04-Jun-2000  oster branches: 1.92.2;
Remove outdated comment.
 1.91  04-Jun-2000  oster Merge rf_update_component_labels() and rf_final_update_component_labels().
 1.90  03-Jun-2000  oster Allow getting a component label from a spare disk.
 1.89  01-Jun-2000  matt Make booted_device global (and booted_parition for consitency).
Eliminate it from header files and other extern definitions.
 1.88  30-May-2000  oster For a RAID 1 set that has N components, allow the set to auto-configure as
long as at least one of the master or the mirror is available for each
of the N/2 'rows' of the set. (No, RAIDframe doesn't do N-way mirroring..)
Thanks to Manuel Bouyer for noting the problem.
 1.87  29-May-2000  oster Don't let the autodetection code get tripped up by negative mod-counters.
 1.86  28-May-2000  oster We need to be slightly more clever during auto-configuration, to make
sure that we a) don't ignore components with correct mod-counters, and
b) do ignore components with bogus mod-counters.
 1.85  28-May-2000  oster Abort any parity re-writes before unconfiguring a RAID set.
Partially addresses PR#10182.
 1.84  28-May-2000  oster When setting auto-config/rootable bits, only try to update the
component label if the component is actually alive.
 1.83  28-May-2000  oster - Add a mechanism for obtaining finer-grained 'progress' information
regarding reconstructs, copybacks, etc.

- RAID 0 doesn't do copybacks, but don't make raidctl sweat about it.
 1.82  27-May-2000  oster Components which match on everything but the mod_counter are
renegades, and must be handled correctly. In particular, they should
be added to their old auto-config set, but then immediately released.
Failing to do otherwise means that they potentialy end up in a
different (and competing!) RAID set which may auto-configure in place
of the correct one, and cause all sorts of chaos at auto-configure
time.
 1.81  27-May-2000  oster Add a comment to clarify why we actually want the component label to
be considered a 'match' even if the mod_counter is wrong.
 1.80  27-May-2000  oster Checking parity re-write status makes no sense on RAID 0, but let's
return something reasonable anyway.
 1.79  19-May-2000  thorpej branches: 1.79.2;
A foolish consistency; most parts of the kernel use bp->b_data, so
change these from bp->b_un.b_addr to bp->b_data, as well. This also
allows us more flexibility to experiment with other data buffer types
hung off of struct buf.
 1.78  19-May-2000  minoura Add some missing casts of ioctl arg.
Obviously autoconfiguration wouldn't work on big-endian machines.
 1.77  27-Apr-2000  oster Make sure the config structure allocated during autoconfiguration actually
gets initialized properly. Should fix PR#9816.
 1.76  31-Mar-2000  oster Minor cleanup of unneeded verbosity.
 1.75  31-Mar-2000  oster Print out the 'root' status of a RAID set during autoconfiguration.
 1.74  30-Mar-2000  augustss Remove register declarations.
 1.73  26-Mar-2000  oster Add bits for eventual support of deleteing components and moving
hot-spares into the main set.
 1.72  22-Mar-2000  oster Fix up some autoconfigure messages. In particular, don't try printing
the value of an uninitialized variable. Noted by Luke Mewburn.
 1.71  20-Mar-2000  oster Just return "100% done" when asked about reconstruction progress on
a RAID0 set.
 1.70  07-Mar-2000  oster Cleanup a couple of function declarations. No functional changes.
 1.69  07-Mar-2000  oster Create a new rf_close_component() to handle vnode operations for closing
components. Teach rf_UnconfigureVnodes() how to use it, and tell
the copyback and reconstruction code about it too.
 1.68  07-Mar-2000  oster 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.67  07-Mar-2000  oster rf_ protect the component label print routine, and make it more easily
available to the rest of RAIDframe.
 1.66  04-Mar-2000  oster Umm... don't allow attempts to configure the same RAID device multiple times.
The check was there, but the return() was missing :(
 1.65  03-Mar-2000  oster Minor cleanup. No functional changes.
 1.64  27-Feb-2000  oster Nuke some debugging output that got left in by mistake.
 1.63  27-Feb-2000  oster Only mark the components as CLEAN if it's the last thing we're doing.
Marking them CLEAN earlier is (currently) asking for trouble.
(XXX This could have been done more elegantly.)
 1.62  26-Feb-2000  oster Defopt 'RAID_AUTOCONFIG'. Adding 'options RAID_AUTOCONFIG' turns on
the component auto-detection and auto-configuration of RAID sets.
Also, add "#options RAID_AUTOCONFIG" to the GENERIC config files.
 1.61  25-Feb-2000  oster Minor cleanups. Remove extra debugging printouts.
 1.60  25-Feb-2000  oster - ignore the mod_counter when checking to see if a component fits with the
rest of an autoconfig set.
- minor cleanups
 1.59  25-Feb-2000  oster - cleanup raidinit()
- cleanup rf_mountroot_hooks()
- various other cleanups.
 1.58  25-Feb-2000  oster Be *slightly* more consistent about the use of num and numraid in raidattach().
 1.57  24-Feb-2000  oster - mod_counter needs to get incremented more often.
- use raid_init_component_labels instead of hand-rolling a component_label.
(missed doing this for the rf_used_spare case when updating component labels).
- fix serial number initialization in raid_init_component_labels
 1.56  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.55  23-Feb-2000  oster blockSize for the component label is already set correctly here.
 1.54  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.53  22-Feb-2000  oster Note the fact that the first arg of raidinit() may be bogus in
the autoconfig case (the value of the first arg never gets used, but...).
 1.52  22-Feb-2000  oster Bounds-check the 'last unit' a little more closely.
 1.51  22-Feb-2000  oster - implement additional component checking before autoconfiguration
- make component label setting work again(!!!!)
 1.50  21-Feb-2000  oster Umm.. let's set 'numraid' to something useful before we try to use it.
 1.49  16-Feb-2000  oster Some of these function names are bad enough that no one else would probably
pick them, but preface them with rf_ anyway.
 1.48  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.47  21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.46  09-Jan-2000  oster Nuke more debugging stuff and cleanup a tad.
 1.45  09-Jan-2000  oster By popular demand (Hi Thor!) make the cylinder size in a default
disklabel be the size of the (data part) of the stripe.
 1.44  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.43  08-Jan-2000  oster Nuke some (now) incorrect comments. More minor cleanup.
 1.42  08-Jan-2000  oster Replace raidPtrs[unit] with just raidPtr, and assign the former to the
later early on in raidioctl(). Code is easier to read now too.
 1.41  08-Jan-2000  oster Minor tillage on the raidioctl() stuff. More cleanup to follow.
No functional changes.
 1.40  07-Jan-2000  oster In RAIDFRAME_CONFIGURE, don't set values in raidPtrs[unit] unless
the configuration was successful. Noted by Peter Galbavy of OpenBSD.
 1.39  06-Jan-2000  oster - bail if we can't allocate memory for raid_softc's. Set 'numraid' as
appropriate for that condition.
- nuke some debugging stuff that we hope we'll never need again
- minor cleanups
 1.38  05-Jan-2000  oster Make sure we really get something back from RF_Malloc before we use it.
 1.37  05-Jan-2000  oster - update RF_CREATE_THREAD to handle a 'process name' argument.
- fire up a new thread for parity re-writes, copybacks, and reconstructs.
The ioctl's which trigger these actions now return immediately.
- add progress accounting for the above actions.
- minor rototillage of rf_netbsdkintf.c to deal with all of the above.
 1.36  15-Dec-1999  oster Nuke a bunch of debugging cruft. No functional changes.
 1.35  14-Dec-1999  oster Whoops! Neglected to initialize the buffer queues for anything other
than raid0. Fix that...
 1.34  12-Dec-1999  oster Rototill the IO throttle code. Rename rf_DoAccessKernel() to raidstart()
and cleanup arguments. While we're here, cleanup raidstrategy(), and nuke
a bunch of unused debugging stuff.

RAIDframe + softdeps now play very nicely together.
 1.33  03-Dec-1999  oster Kernel memory is not to be wasted. If we're bailing out because of an error,
give any allocated memory back to the kernel so someone else can use it.
 1.32  03-Dec-1999  oster Move LIST_INIT() to a more appropriate place.
 1.31  18-Nov-1999  oster We must initialize bp->b_dep in InitBP().
 1.30  17-Nov-1999  oster Remove some minor stuff that wasn't right, and wasn't even really used.
 1.29  14-Aug-1999  oster branches: 1.29.2; 1.29.8;
Minor cleanup. No functional changes.
 1.28  14-Aug-1999  oster Decrease the number of outstanding IO's threashold slightly.
The previous value may have been too high in some instances.
 1.27  14-Aug-1999  oster Remove a 'struct proc *'-passing abomination that's been bugging me
for quite some time.
 1.26  14-Aug-1999  oster Correct and/or improve detection of bogus row/column values
passed in via ioctls.
 1.25  13-Aug-1999  oster Garbage collect rpcc().
 1.24  10-Aug-1999  oster Don't allow reconstructs, copybacks, or forced failures of components if
using a RAID 0, since RAID 0 can't handle those sorts of things.
 1.23  10-Aug-1999  oster Oops. Make minor change that I forgot when adding the parity check ioctl.
 1.22  10-Aug-1999  oster Add support for easily checking the parity status from userland.
Also: spl protect rf_RewriteParity().
 1.21  21-Jul-1999  oster Need to splbio()/splx() protect some of the reconstruction stuff.
Without this, we have potentially bad interatctions with the pool
code.
 1.20  08-Jul-1999  oster Once upon a time, long long ago, there was a "fix" added to the
RAIDframe driver to stop it from eating too much kernel memory when
writing data. But that fix had a nasty side-affect of hurting write
performance (*much* more than I thought it would). These changes nuke
that "fix", and instead put in a more reasonable mechanism for limiting
the number of simultaneous IO's which can be happening for each RAID device.
The result is a noticeable improvement in write throughput. The End.
 1.19  13-Jun-1999  oster Remember to pass down the proc pointer when adding a hot spare.
(Thanks to Martin J. Laubach for helping track this one down.)
 1.18  12-Apr-1999  oster Fix a couple of compiler warnings on the Alpha. Pointed out by Tim Rightnour.
 1.17  07-Apr-1999  oster Allow re-writing parity on a RAID 0 to trivially succeed, and to set the
clean bit. This is somewhat bogus as RAID 0 does not have any parity,
but is a slightly cleaner than other solutions, and makes the handling
of clean bits for RAID 0 consistent with the handling of clean bits at
other RAID levels.
 1.16  27-Mar-1999  oster branches: 1.16.2;
Cleanup shutdown code - garbage collect (now) unused shutdownhooks() stuff.
 1.15  14-Mar-1999  oster 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.14  09-Mar-1999  oster Cleanup raidattach: move rf_boot's functionality to raidattach, and
nuke rf_boot(). Cleanup raidopen().
 1.13  09-Mar-1999  oster rf_update_component_labels() now lives here. Re-work clean-bit
support a little: clean-bits now also get frobbed on partition
opening/closing, rather than just at device configuration and device
unconfiguration. Schedule shutdownhooks() stuff for nukage at a later
date, since it isn't really necessary any more.
 1.12  02-Mar-1999  oster Update for recent changes including component label support, clean
bits, rebuilding components in-place, adding hot spares, shutdownhooks, etc.
 1.11  23-Feb-1999  oster Cleanup/remove unused cruft. First kick at component labels and clean bits.
Still work in progress. New code is there, but not enabled yet.
 1.10  11-Feb-1999  oster Minor cleanups that got missed last time through.
 1.9  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.8  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.7  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.6  14-Jan-1999  thorpej Use M_RAIDFRAME.
 1.5  22-Dec-1998  oster Clean up some debugging stuff, and make it compile without warnings
with -DDEBUG on alphas.
 1.4  03-Dec-1998  oster Try a bit harder to detect the physical failure of a component, and to
mark that component as dead. Physical failures are handled much better now.
 1.3  15-Nov-1998  hubertf compile with DEBUG=1
 1.2  13-Nov-1998  simonb prototype un-prototyped functions
 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.16.2.9  29-Feb-2000  he Apply patch (requested by oster):
Protect rf_RewriteParity() with splbio().
 1.16.2.8  20-Dec-1999  he Pull up revisions 1.34-1.35 (requested by oster):
Re-work the IO throttle code. Fixes potential panics under high
loads under FFS.
 1.16.2.7  28-Sep-1999  cgd pull up rev 1.26 from trunk (requested by oster):
Correct and/or improve detection of bogus row/column values passed
in via ioctls.
 1.16.2.6  28-Sep-1999  cgd pull up rev 1.24 from trunk (requested by oster):
Don't allow reconstructs, copybacks, or forced failures of components if
using a RAID 0, since RAID 0 can't handle those sorts of things.
 1.16.2.5  27-Sep-1999  cgd pull up rev 1.21 from trunk (requested by oster):
splbio()/splx() protect some reconstruction code to avoid
potentially bad interatctions with the pool code.
 1.16.2.4  26-Sep-1999  cgd pull up rev 1.20 from trunk (requested by oster):
Add a more reasonable throttling mechanism to the RAIDframe code.
Increases write performance, and helps prevent the I/O routines from
using too much kernel memory.
 1.16.2.3  23-Jun-1999  perry pullup 1.18->1.19 (oster)
 1.16.2.2  12-Apr-1999  oster branches: 1.16.2.2.2; 1.16.2.2.4;
Pullup 1.17 to 1.18. Fixup some compiler warnings which get
generated on the Alpha port.
 1.16.2.1  07-Apr-1999  oster Pullup: 1.16 -> 1.17. Re-writing parity on a RAID 0 now trivially succeeds
and sets the clean bit.
 1.16.2.2.4.1  30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.16.2.2.2.2  02-Aug-1999  thorpej Update from trunk.
 1.16.2.2.2.1  21-Jun-1999  thorpej Sync w/ -current.
 1.29.8.3  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.29.8.2  22-Dec-1999  wrstuden DEF_BSIZE is right for raidsize().
 1.29.8.1  21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.29.2.6  21-Apr-2001  bouyer Sync with HEAD
 1.29.2.5  11-Feb-2001  bouyer Sync with HEAD.
 1.29.2.4  18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.29.2.3  08-Dec-2000  bouyer Sync with HEAD.
 1.29.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.29.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.79.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.92.2.9  01-May-2001  he Pull up revisions 1.102-1.103 (requested by fvdl):
Increase the number of BSD disklabel partitions on i386 to 16.
 1.92.2.8  05-Apr-2001  he Pull up revision 1.105 (requested by oster):
In order to improve FFS layout, use a value of "4 * number_of_columns"
instead of "1" for the number of tracks/cylinder in the disklabel.
 1.92.2.7  20-Oct-2000  tv Pullup 1.99 [oster]:
Move disk_busy() and disk_unbusy() to more sane locations. Values
reported by 'systat iostat' and friends are now much more correct for
RAIDframe devices. Thanks to Andrew Doran for poking me about this,
and for suggestions on and review of the changes.
 1.92.2.6  18-Oct-2000  tv Pullup 1.98 [oster]:
Don't touch a failed component at all. Thanks to Robert Elz (kre) for
noting the problem and providing additional comments.
 1.92.2.5  17-Oct-2000  tv Pullup 1.97 [oster]:
Correct a few calls to VOP_CLOSE().
 1.92.2.4  08-Sep-2000  oster Pullup 1.31->1.32 of rf_disks.c
Pullup 1.95->1.96 of rf_netbsdkintf.c
Approved by: thorpej

Make sure we are passing a locked vp to VOP_CLOSE.
 1.92.2.3  19-Aug-2000  oster Pullup 1.94->1.95. Approved by thorpej.
Remove a bogus VOP_UNLOCK.
 1.92.2.2  19-Aug-2000  oster Pullup 1.93->1.94. Approved by thorpej
Don't try to initialize a component label on a failed component.
 1.92.2.1  14-Jul-2000  oster Pullup revision 1.93.
Fix the status reporting for copybacks. Thanks to Hubert Feyrer for
reporting the problem.
Approved by: thorpej
 1.104.2.18  11-Dec-2002  thorpej Sync with HEAD.
 1.104.2.17  11-Nov-2002  nathanw Catch up to -current
 1.104.2.16  18-Oct-2002  nathanw Catch up to -current.
 1.104.2.15  17-Sep-2002  nathanw Catch up to -current.
 1.104.2.14  13-Aug-2002  nathanw Catch up to -current.
 1.104.2.13  01-Aug-2002  nathanw Catch up to -current.
 1.104.2.12  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.104.2.11  24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.104.2.10  20-Jun-2002  nathanw Catch up to -current.
 1.104.2.9  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.104.2.8  28-Feb-2002  nathanw Catch up to -current.
 1.104.2.7  11-Jan-2002  nathanw More catchup.
 1.104.2.6  08-Jan-2002  nathanw Catch up to -current.
 1.104.2.5  18-Nov-2001  scw Fix a reference to curproc.
 1.104.2.4  14-Nov-2001  nathanw Catch up to -current.
 1.104.2.3  22-Oct-2001  nathanw Catch up to -current.
 1.104.2.2  24-Aug-2001  nathanw Catch up with -current.
 1.104.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.106.2.6  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.106.2.5  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.106.2.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.106.2.3  16-Mar-2002  jdolecek Catch up with -current.
 1.106.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.106.2.1  03-Aug-2001  lukem update to -current
 1.109.2.5  11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.109.2.4  30-Sep-2001  fvdl Fix vput typo.
 1.109.2.3  26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.109.2.2  18-Sep-2001  fvdl Various changes to make cloning devices possible:

* Add an extra argument (struct vnode **) to VOP_OPEN. If it is
not NULL, specfs will create a cloned (aliased) vnode during
the call, and return it there. The caller should release and
unlock the original vnode if a new vnode was returned. The
new vnode is returned locked.

* Add a flag field to the cdevsw and bdevsw structures.
DF_CLONING indicates that it wants a new vnode for each
open (XXX is there a better way? devprop?)

* If a device is cloning, always call the close entry
point for a VOP_CLOSE.


Also, rewrite cons.c to do the right thing with vnodes. Use VOPs
rather then direct device entry calls. Suggested by mycroft@

Light to moderate testing done an i386 system (arch doesn't matter
though, these are MI changes).
 1.109.2.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.117.8.3  09-Aug-2002  lukem Pull up revision 1.129 (requested by oster in ticket #652):
Let's not bother poking CD's to see if they might have RAID sets
on them.
 1.117.8.2  29-Jun-2002  lukem Pull up revision 1.121 (requested by leo in ticket #395):
Exclude the Atari/Milan floppy driver from being a RAID capable device.
 1.117.8.1  28-May-2002  lukem Pull up revisions 1.119-1.120 (requested by leo):
Treat the "hdfd" (Atari/Hades floppy) like all the other "fd"s. OK-ed by
Greg Oster.
Not so fast... Add a bit of comment to the previous change.
 1.117.6.4  29-Aug-2002  gehenna catch up with -current.
 1.117.6.3  15-Jul-2002  gehenna catch up with -current.
 1.117.6.2  30-May-2002  gehenna Catch up with -current.
 1.117.6.1  16-May-2002  gehenna Add the block/character device switches.
Replace the direct-access to devsw table with calling devsw API.
 1.161.2.9  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.161.2.8  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.161.2.7  29-Nov-2004  skrll Sync with HEAD.
 1.161.2.6  02-Nov-2004  skrll Sync with HEAD.
 1.161.2.5  19-Oct-2004  skrll Sync with HEAD
 1.161.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.161.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.161.2.2  03-Aug-2004  skrll Sync with HEAD
 1.161.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.178.2.1  02-Jul-2004  he branches: 1.178.2.1.2;
Pull up revision 1.180 (requested by oster in ticket #576):
The result of rf_DoAccess() should not be assigned to
bp->b_error. As well, when we do detect some sort of an
error, we should be doing a biodone() here.
 1.178.2.1.2.3  06-Apr-2005  tron Pull up revision 1.185 (requested by oster in ticket #1040):
Don't allow -f to fail a disk while a reconstruction is taking place
since that would cause a panic. (Problem noticed by dan@.)
 1.178.2.1.2.2  06-Apr-2005  tron Pull up revision 1.184 (requested by oster in ticket #1039):
Initialize parity_rewrite_stripes_done to remove the window where
bogus values could be returned at the start of parity rewriting.
 1.178.2.1.2.1  06-Apr-2005  tron Pull up revision 1.183 (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.185.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.185.4.1  29-Apr-2005  kent sync with -current
 1.186.2.4  19-Dec-2007  ghen Pull up following revision(s) (requested by sborrill in ticket #1892):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.231 via patch
Implement dumping kernel cores to RAID 1 sets. The component used
for the dump is selected in this order of preference:
1) the master
2) a used_spare of the master
3) the slave
4) a used_spare of the slave
 1.186.2.3  11-Jan-2006  tron Pull up following revision(s) (requested by oster in ticket #1114):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.193
We need to mark used spares as failed if they encounter IO errors!
Commit fixes problem reported (privately) by Jeff Rizzo.
XXX: Note that we are still are unable to allow a reconstruct of
a failed spare -- it's easy enough to attempt to do it, but the
code in rf_ContinueReconstructFailedDisk() isn't anywhere close to
ready to allow it. Yet another reason why the whole disk/spare thing
needs to be re-worked. *sigh*
 1.186.2.2  04-Oct-2005  tron branches: 1.186.2.2.2;
Pull up following revision(s) (requested by oster in ticket #853):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.190
sys/dev/raidframe/rf_netbsd.h: revision 1.24
sys/dev/raidframe/rf_states.c: revision 1.39
sys/dev/raidframe/rf_engine.c: revision 1.36
Re-work the handling of incoming I/O in RAIDframe:
- introduce rf_buf_queue_check() which checks to see if there
is work to do in the incoming buffer queue
- rf_RaidIOThread() is now responsible for calling raidstart(), and is
also now the only place that calls raidstart()
- raidstrategy() now just queues requests in buf_queue
and signals rf_RaidIOThread() that work has arrived
Hopefully addresses PR#30233
 1.186.2.1  17-Jun-2005  tron Pull up revision 1.187 (requested by oster in ticket #472):
- avoid variable shadowing
- add a lot of const
- remove parameters from function declarations
 1.186.2.2.2.1  11-Jan-2006  tron Pull up following revision(s) (requested by oster in ticket #1114):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.193
We need to mark used spares as failed if they encounter IO errors!
Commit fixes problem reported (privately) by Jeff Rizzo.
XXX: Note that we are still are unable to allow a reconstruct of
a failed spare -- it's easy enough to attempt to do it, but the
code in rf_ContinueReconstructFailedDisk() isn't anywhere close to
ready to allow it. Yet another reason why the whole disk/spare thing
needs to be re-worked. *sigh*
 1.187.2.8  24-Mar-2008  yamt sync with head.
 1.187.2.7  21-Jan-2008  yamt sync with head
 1.187.2.6  07-Dec-2007  yamt sync with head
 1.187.2.5  15-Nov-2007  yamt sync with head.
 1.187.2.4  27-Oct-2007  yamt sync with head.
 1.187.2.3  03-Sep-2007  yamt sync with head.
 1.187.2.2  30-Dec-2006  yamt sync with head.
 1.187.2.1  21-Jun-2006  yamt sync with head.
 1.192.2.2  01-Mar-2006  yamt sync with head.
 1.192.2.1  15-Jan-2006  yamt sync with head.
 1.199.4.2  01-Jun-2006  kardel Sync with head.
 1.199.4.1  22-Apr-2006  simonb Sync with head.
 1.199.2.1  09-Sep-2006  rpaulo sync with head
 1.202.6.3  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.202.6.2  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.202.6.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.202.4.3  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.202.4.2  19-Apr-2006  elad sync with head.
 1.202.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.202.2.5  03-Sep-2006  yamt sync with head.
 1.202.2.4  11-Aug-2006  yamt sync with head
 1.202.2.3  26-Jun-2006  yamt sync with head.
 1.202.2.2  24-May-2006  yamt sync with head.
 1.202.2.1  01-Apr-2006  yamt sync with head.
 1.208.2.1  19-Jun-2006  chap Sync with head.
 1.213.4.2  10-Dec-2006  yamt sync with head.
 1.213.4.1  22-Oct-2006  yamt sync with head
 1.213.2.2  12-Jan-2007  ad Sync with head.
 1.213.2.1  18-Nov-2006  ad Sync with head.
 1.224.8.1  03-Jun-2008  skrll Sync with netbsd-4.
 1.224.4.2  24-Mar-2007  yamt sync with head.
 1.224.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.224.2.4  25-Sep-2008  bouyer Pull up following revision(s) (requested by oster in ticket #984):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.235
We need to initialize dk_driver as well. Thanks to Ronald Roskens
for reporting the problem and testing the fix.
 1.224.2.3  25-Sep-2008  bouyer Pull up following revision(s) (requested by oster in ticket #981):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.234
Implement support for drvctl in RAIDframe. Thanks to jnemeth@ for
initial patch.
 1.224.2.2  25-Sep-2008  bouyer Pull up following revision(s) (requested by oster in ticket #979):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.228
don't leak a vnode in the wedge case.
 1.224.2.1  19-Dec-2007  ghen Pull up following revision(s) (requested by oster in ticket #1014):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.231 via patch
Implement dumping kernel cores to RAID 1 sets. The component used
for the dump is selected in this order of preference:
1) the master
2) a used_spare of the master
3) the slave
4) a used_spare of the slave
 1.226.2.9  02-Nov-2007  ad InitBP: set b_objlock correctly for the buffer.
 1.226.2.8  09-Oct-2007  ad Sync with head.
 1.226.2.7  24-Aug-2007  ad Sync with buffer cache locking changes. See buf.h/vfs_bio.c for details.
Some minor portions are incomplete and needs to be verified as a whole.
 1.226.2.6  20-Aug-2007  ad - Alter disk attach/detach to fix a panic when closing a vnd device.
- Sync with HEAD.
 1.226.2.5  19-Aug-2007  ad Compile fixes.
 1.226.2.4  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.226.2.3  15-Jul-2007  ad Sync with head.
 1.226.2.2  09-Jun-2007  ad Sync with head.
 1.226.2.1  13-Mar-2007  ad Sync with head.
 1.227.2.1  11-Jul-2007  mjf Sync with head.
 1.228.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.230.10.2  29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.230.10.1  29-Jul-2007  ad file rf_netbsdkintf.c was added on branch matt-mips64 on 2007-07-29 12:50:23 +0000
 1.230.8.2  14-Oct-2007  yamt sync with head.
 1.230.8.1  06-Oct-2007  yamt sync with head.
 1.230.6.3  09-Jan-2008  matt sync with HEAD
 1.230.6.2  08-Nov-2007  matt sync with -HEAD
 1.230.6.1  06-Nov-2007  matt sync with HEAD
 1.230.4.8  01-Dec-2007  jmcneill Sync with HEAD.
 1.230.4.7  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.230.4.6  21-Nov-2007  joerg Sync with HEAD.
 1.230.4.5  14-Nov-2007  joerg Sync with HEAD.
 1.230.4.4  11-Nov-2007  joerg Sync with HEAD.
 1.230.4.3  04-Nov-2007  jmcneill Sync with HEAD.
 1.230.4.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.230.4.1  07-Oct-2007  joerg Sync with HEAD.
 1.233.2.2  18-Nov-2007  bouyer Sync with HEAD
 1.233.2.1  13-Nov-2007  bouyer Sync with HEAD
 1.234.2.4  18-Feb-2008  mjf Sync with HEAD.
 1.234.2.3  27-Dec-2007  mjf Sync with HEAD.
 1.234.2.2  08-Dec-2007  mjf Sync with HEAD.
 1.234.2.1  19-Nov-2007  mjf Sync with HEAD.
 1.239.6.3  08-Jan-2008  bouyer Sync with HEAD
 1.239.6.2  02-Jan-2008  bouyer Sync with HEAD
 1.239.6.1  13-Dec-2007  bouyer Sync with HEAD
 1.239.4.1  11-Dec-2007  yamt sync with head.
 1.239.2.2  26-Dec-2007  ad Sync with head.
 1.239.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.243.6.7  17-Jan-2009  mjf Sync with HEAD.
 1.243.6.6  05-Oct-2008  mjf Sync with HEAD.
 1.243.6.5  29-Jun-2008  mjf Sync with HEAD.
 1.243.6.4  02-Jun-2008  mjf Sync with HEAD.
 1.243.6.3  06-Apr-2008  mjf - after some discussion with agc@ i agreed it would be a good idea to move
device_unregister_* to device_deregister_* to be more like the pmf(9)
functions, especially since a lot of the time the function calls are next
to each other.

- add device_register_name() support for dk(4).
 1.243.6.2  03-Apr-2008  mjf Sync with HEAD.
 1.243.6.1  29-Mar-2008  mjf - etc/devfsd.conf: Add some rules to give nodes like /dev/tty and
/dev/null better default modes, i.e. 0666.

- sbin/init: Run devfsd -s before going to multiuser.

- sys/arch: Provide arm32, i386, sparc with a mem_init() function to request
device nodes for /dev/null, /dev/zero, etc.

- sys/dev: Convert rnd, wd, agp, raid, cd, sd, wsdisplay, wskbd, wsmouse,
wsmux, tty, bpf, swap to devfs New World Order.

- sys/fs/devfs: Make the visibility attribute of device nodes configurable.
Also provide a function to mount a devfs on boot.

- sys/kern: Add a new boot flag, -n. This disables devfs support. Unless
the -n flag is specified the kernel will mount a devfs file
system on boot.
 1.245.4.7  11-Aug-2010  yamt sync with head.
 1.245.4.6  11-Mar-2010  yamt sync with head
 1.245.4.5  19-Aug-2009  yamt sync with head.
 1.245.4.4  20-Jun-2009  yamt sync with head
 1.245.4.3  16-May-2009  yamt sync with head
 1.245.4.2  04-May-2009  yamt sync with head.
 1.245.4.1  16-May-2008  yamt sync with head.
 1.245.2.2  17-Jun-2008  yamt sync with head.
 1.245.2.1  18-May-2008  yamt sync with head.
 1.246.2.2  10-Oct-2008  skrll Sync with HEAD.
 1.246.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.247.2.1  18-Jun-2008  simonb Sync with head.
 1.248.2.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.248.2.1  19-Oct-2008  haad Sync with HEAD.
 1.250.4.14  20-Nov-2014  sborrill Pull up the following revisions(s) (requested by oster in ticket #1933):
sys/dev/raidframe/raidframevar.h: revision 1.17
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.316
sys/dev/raidframe/rf_reconstruct.c: revision 1.121 via patch

Fix a long-standing bug related to rebooting while a reconstruct-to-spare
is underway but not yet complete. Fixes PR kern/49244.
 1.250.4.13  24-Oct-2012  riz branches: 1.250.4.13.2;

sys/dev/raidframe/rf_netbsdkintf.c patch

Implement DIOCGSTRATEGY and DIOCSSTRATEGY for raidframe devices.
(The default strategy is not changed)
[buhrow, ticket #1788]
 1.250.4.12  13-Jun-2012  sborrill Pull up the following revisions(s) (requested by mrg in ticket #1774):
sbin/raidctl/raidctl.c: revision 1.52
sys/dev/raidframe/raidframevar.h: revision 1.15
sys/dev/raidframe/rf_copyback.c: revision 1.45
sys/dev/raidframe/rf_disks.c: revision 1.78
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.282,1.284
sys/dev/raidframe/rf_reconstruct.c: revision 1.111

Fix garbage values in partitionSizeHi with RAID array > 2TB. Stops the check against
rf_component_label_partitionsize() failing and stopping auto-configure.
 1.250.4.11  20-May-2011  bouyer Pull up following revision(s) (requested by buhrow in ticket #1615):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.280 via patch
PR/44340: Brian Buhrow: Raid sets containing wedges cannot be unconfigured
and reconfigured without a reboot.
 1.250.4.10  07-Jan-2011  riz Pull up following revision(s) (requested by mrg in ticket #1511):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.278
add a hack to fix up old labels that do not have zero's in numBlocksHi:
if the total sectors reported (via disklabel or otherwise) is smaller
than 2^32, but numBlocksHi is set, zero it out instead.
tested by myself and christos, should fix reports of weirdness seen.
 1.250.4.9  07-Jan-2011  riz Pull up following revision(s) (requested by mrg in ticket #1522):
sys/dev/raidframe/rf_disks.c: revision 1.76
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.276
apply my patch to support non-512K sector disks (at least, upto 16KB
sector disks..) from my tech-kern post:
the following patch let's me access both 512 byte and 4K
sector disks at the same time, as long as they are in
separate raids. the existing rf code assumes/enforces
this part, i just made it support other sets concurrently.
the main change is moving the parity bitmap to the sector
after the component label sector(s), instead of being
immediately after the label, which meant it was on the same
sector as the label for >1024 byte devices.
i'm a little annoyed at having to add a 2nd call to
getdisksize() to enable auto-configure to work, but i
don't see another way that wasn't much uglier.
 1.250.4.8  21-Nov-2010  riz Pull up following revision(s) (requested by mrg in ticket #1468):
sys/dev/raidframe/rf_disks.c: revision 1.74
sys/dev/raidframe/raidframevar.h: revision 1.14
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.275
sys/dev/raidframe/rf_copyback.c: revision 1.43
sys/dev/raidframe/rf_reconstruct.c: revision 1.109
add support for >2TB raid devices.
- - add two new members to the component label:
u_int numBlocksHi
u_int partitionSizeHi
and store the top 32 bits of the real number of blocks and
partition size. modify rf_print_component_label(),
rf_does_it_fit(), rf_AutoConfigureDisks() and
rf_ReconstructFailedDiskBasic().
- - call disk_blocksize() after disk_attach() [ from mlelstv ]
- - shift the block number relative to DEV_BSHIFT in raidstart()
and InitBP() so that accesses work for non 512-byte devices.
[ from mlelstv ]
- - update rf_getdisksize() to use the new getdisksize() [ from
mlelstv. this part needs a separate change for netbsd-5. ]
reviewed by: oster, christos and darrenr
 1.250.4.7  20-Nov-2010  riz Pull up following revision(s) (requested by hubertf in ticket #1386):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.258
sys/dev/pad/pad.c: revision 1.11
sys/dev/scsipi/cd.c: revision 1.288
sys/dev/isa/pcppi.c: revision 1.33
sys/kern/subr_autoconf.c: revision 1.169
'boot -z' bogons
 1.250.4.6  06-Mar-2010  sborrill branches: 1.250.4.6.2;
Pull up the following revisions(s) (requested by oster in ticket #1324):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.272

Don't merge a good parity map with random stuff in the event that the
first component is missing. (Since the merging just OR's the maps,
this isn't that big a deal, as it will just over-estimate the
amount of checking that needs to be done.)
 1.250.4.5  10-Dec-2009  snj 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.250.4.4  04-Apr-2009  snj branches: 1.250.4.4.4;
Pull up following revision(s) (requested by sborrill in ticket #652):
sys/dev/raidframe/rf_disks.c: revision 1.71
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.260
Switch various printfs from %ld and %d to PRIu64, etc. to be more consistent
about types (for instance uint32_t was being printed with %d).
 1.250.4.3  02-Mar-2009  snj Pull up following revision(s) (requested by oster in ticket #543):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.256
It seems that some SCSI drivers can block while the spinlock on a given
disk queue is being held. Work around this by dropping the lock before
bdev_strategy(), and re-grabbing the lock afterwards. This is a
temporary measure until I get to gutting this queue locking code.
There has been some success with this in addressing PR#39993.
This patch is from Antti Kantee. Thanks!
 1.250.4.2  08-Feb-2009  snj Pull up following revision(s) (requested by oster in ticket #430):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.255
Be consistent with wd.c and don't complain loudly if the underlying
device doesn't support flushing the cache. Fixes an issue (reported
privately) where ST39120A drives are not capable of flushing the
cache, and RAIDFrame was incessantly complaining.
 1.250.4.1  16-Jan-2009  bouyer Pull up following revision(s) (requested by oster in ticket #268):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.252
Implement DIOCCACHESYNC for RAIDframe too,
should help prevent journal corruption that causes PR#39371
 1.250.4.13.2.1  20-Nov-2014  sborrill Pull up the following revisions(s) (requested by oster in ticket #1933):
sys/dev/raidframe/raidframevar.h: revision 1.17
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.316
sys/dev/raidframe/rf_reconstruct.c: revision 1.121 via patch

Fix a long-standing bug related to rebooting while a reconstruct-to-spare
is underway but not yet complete. Fixes PR kern/49244.
 1.250.4.6.2.1  20-Nov-2014  sborrill Pull up the following revisions(s) (requested by oster in ticket #1933):
sys/dev/raidframe/raidframevar.h: revision 1.17
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.316
sys/dev/raidframe/rf_reconstruct.c: revision 1.121 via patch

Fix a long-standing bug related to rebooting while a reconstruct-to-spare
is underway but not yet complete. Fixes PR kern/49244.
 1.250.4.4.4.1  21-Apr-2010  matt sync to netbsd-5
 1.250.2.3  28-Apr-2009  skrll Sync with HEAD.
 1.250.2.2  03-Mar-2009  skrll Sync with HEAD.
 1.250.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.255.2.2  23-Jul-2009  jym Sync with HEAD.
 1.255.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.271.2.3  06-Nov-2010  uebayasi Sync with HEAD.
 1.271.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.271.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.273.2.3  31-May-2011  rmind sync with head
 1.273.2.2  21-Apr-2011  rmind sync with head
 1.273.2.1  05-Mar-2011  rmind sync with head
 1.280.4.2  05-Mar-2011  bouyer Sync with HEAD
 1.280.4.1  17-Feb-2011  bouyer Sync with HEAD
 1.280.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.294.2.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.294.2.3  30-Oct-2012  yamt sync with head
 1.294.2.2  17-Apr-2012  yamt sync with head
 1.294.2.1  10-Nov-2011  yamt sync with head
 1.295.6.4  22-Dec-2014  msaitoh Pull up following revision(s) (requested by taca in ticket #1216):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.317
Stop useless disklabel warning if there are wedges, using GPT partition.
Fix PR kern/47989.
XXX: Pullup 6 and 7 (maybe 5)
 1.295.6.3  02-Dec-2014  snj Pull up following revision(s) (requested by oster in ticket #1194):
sys/dev/raidframe/raidframevar.h: revision 1.17
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.316
sys/dev/raidframe/rf_reconstruct.c: revision 1.121
Fix a long-standing bug related to rebooting while a
reconstruct-to-spare is underway but not yet complete.
The issue was that a component was being marked as a used_spare when
the rebuild started, not when the rebuild was actually finished.
Marking it as a used_spare meant that the component label on the spare
was being updated such that after a reboot the component would be
considered up-to-date, regardless of whether the rebuild actually
completed!
This fix includes:
1) Add an additional state "rf_ds_rebuilding_spare" which is used
to denote that a spare is currently being rebuilt from the live
components.
2) Update the comments on the disk states, which were out-of-sync
with reality.
3) When rebuilding to a spare component, that spare now enters the
state rf_ds_rebuilding_spare instead of the state rf_ds_used_spare.
4) When the rebuild is actually complete then the spare component
enters the rf_ds_used_spare state. rf_ds_used_spare is now used
exclusively for the case where the rebuilding to the spare has
completed successfully.
XXX: Someday we need to teach raidctl(8) about this new state, and
take out the backwards compatibility code in rf_netbsdkintf.c (see
RAIDFRAME_GET_INFO in raidioctl()). For today, this fix needs to be
generic enough that it can get backported without major grief.
XXX: Needs pullup to netbsd-5*, netbsd-6*, and netbsd-7
Fixes PR#49244.
 1.295.6.2  13-Aug-2012  riz branches: 1.295.6.2.4; 1.295.6.2.6;
Pull up following revision(s) (requested by buhrow in ticket #488):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.298
Implement DIOCGSTRATEGY and DIOCSSTRATEGY to allow raidframe to use
different buffer queue strategies.
Initialize raid sets to use the default buffer queue strategy for the given
architecture, rather than forcing raidframe to use fcfs in all cases.
This should cause raidframe to use the same buffer queue strategy as the
underlying disks.
On I386, I see performance enhancements of between 14 and 16% with raid5
sets with no other change.
See http://mail-index.NetBSD.org/tech-kern/2012/08/08/msg013758.html
for a discussion of this issue.
 1.295.6.1  21-Mar-2012  riz Pull up following revision(s) (requested by buhrow in ticket #133):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.296
Add the ability to autoconfigure raid components on raw disks.
This change causes components on raw disks, as opposed to components inside
partitions or wedges, to be autoconfigured if the raid set is configured
for autoconfiguration.
Approved by oster@ and mrg@ for submission after the NetBSD-6 tag. I've
been running these changes in production at my day job for over a year
without a problem.
See http://mail-index.NetBSD.org/tech-kern/2010/11/09/msg009167.html
for the original discussion of this patch and for a version of this patch
that works with NetBSD-5.x systems.
 1.295.6.2.6.1  02-Dec-2014  snj Pull up following revision(s) (requested by oster in ticket #1194):
sys/dev/raidframe/raidframevar.h: revision 1.17
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.316
sys/dev/raidframe/rf_reconstruct.c: revision 1.121
Fix a long-standing bug related to rebooting while a
reconstruct-to-spare is underway but not yet complete.
The issue was that a component was being marked as a used_spare when
the rebuild started, not when the rebuild was actually finished.
Marking it as a used_spare meant that the component label on the spare
was being updated such that after a reboot the component would be
considered up-to-date, regardless of whether the rebuild actually
completed!
This fix includes:
1) Add an additional state "rf_ds_rebuilding_spare" which is used
to denote that a spare is currently being rebuilt from the live
components.
2) Update the comments on the disk states, which were out-of-sync
with reality.
3) When rebuilding to a spare component, that spare now enters the
state rf_ds_rebuilding_spare instead of the state rf_ds_used_spare.
4) When the rebuild is actually complete then the spare component
enters the rf_ds_used_spare state. rf_ds_used_spare is now used
exclusively for the case where the rebuilding to the spare has
completed successfully.
XXX: Someday we need to teach raidctl(8) about this new state, and
take out the backwards compatibility code in rf_netbsdkintf.c (see
RAIDFRAME_GET_INFO in raidioctl()). For today, this fix needs to be
generic enough that it can get backported without major grief.
XXX: Needs pullup to netbsd-5*, netbsd-6*, and netbsd-7
Fixes PR#49244.
 1.295.6.2.4.1  02-Dec-2014  snj Pull up following revision(s) (requested by oster in ticket #1194):
sys/dev/raidframe/raidframevar.h: revision 1.17
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.316
sys/dev/raidframe/rf_reconstruct.c: revision 1.121
Fix a long-standing bug related to rebooting while a
reconstruct-to-spare is underway but not yet complete.
The issue was that a component was being marked as a used_spare when
the rebuild started, not when the rebuild was actually finished.
Marking it as a used_spare meant that the component label on the spare
was being updated such that after a reboot the component would be
considered up-to-date, regardless of whether the rebuild actually
completed!
This fix includes:
1) Add an additional state "rf_ds_rebuilding_spare" which is used
to denote that a spare is currently being rebuilt from the live
components.
2) Update the comments on the disk states, which were out-of-sync
with reality.
3) When rebuilding to a spare component, that spare now enters the
state rf_ds_rebuilding_spare instead of the state rf_ds_used_spare.
4) When the rebuild is actually complete then the spare component
enters the rf_ds_used_spare state. rf_ds_used_spare is now used
exclusively for the case where the rebuilding to the spare has
completed successfully.
XXX: Someday we need to teach raidctl(8) about this new state, and
take out the backwards compatibility code in rf_netbsdkintf.c (see
RAIDFRAME_GET_INFO in raidioctl()). For today, this fix needs to be
generic enough that it can get backported without major grief.
XXX: Needs pullup to netbsd-5*, netbsd-6*, and netbsd-7
Fixes PR#49244.
 1.295.4.2  29-Apr-2012  mrg sync to latest -current.
 1.295.4.1  18-Feb-2012  mrg merge to -current.
 1.298.2.5  03-Dec-2017  jdolecek update from HEAD
 1.298.2.4  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.298.2.3  23-Jun-2013  tls resync from head
 1.298.2.2  25-Feb-2013  tls resync with head
 1.298.2.1  17-Oct-2012  tls Add a minphys routine for raidframe.

For now, we will address the problem of someone adding, at runtime with
a filesystem mounted, a drive to an existing RAID set, that drive being
on a different controller or bus such that it has a smaller maximum
transfer size than the smallest such size of any component previously
in the set, by clamping RAIDframe's reported maximum transfer size at
the old MAXPHYS value multiplied by the number of data disks in the
set.

In the future, we could either implement transfer-splitting to
the device specific maxphys in a generic way for all disks (Manuel's
proposal, and probably the best solution) or simply forbid adding
new components to RAID sets while running if those new components
have a smaller maxphys than that of any component already in the set
(my proposal; less flexible but a lot less code to write).

Anyway, now you should be able to see your 5 disk RAID5 set do
256k transfers through the filesystem -- 64k per component
instead of 64K total. A win!
 1.304.2.1  18-May-2014  rmind sync with head
 1.308.2.1  10-Aug-2014  tls Rebase.
 1.312.2.5  14-Jul-2017  martin Pull up following revision(s) (requested by christos in ticket #1457):
sbin/raidctl/raidctl.c: revision 1.64
sbin/raidctl/raidctl.8: revision 1.70
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.341
sys/dev/raidframe/raidframeio.h: revision 1.7
Add a SET_LAST_UNIT ioctl.
Access to the SET_LAST_UNIT ioctl.
 1.312.2.4  22-Dec-2014  msaitoh Pull up following revision(s) (requested by taca in ticket #348):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.317
Stop useless disklabel warning if there are wedges, using GPT partition.
Fix PR kern/47989.
XXX: Pullup 6 and 7 (maybe 5)
 1.312.2.3  18-Nov-2014  snj Pull up following revision(s) (requested by oster in ticket #243):
sys/dev/raidframe/raidframevar.h: revision 1.17
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.316
sys/dev/raidframe/rf_reconstruct.c: revision 1.121
Fix a long-standing bug related to rebooting while a
reconstruct-to-spare is underway but not yet complete.
The issue was that a component was being marked as a used_spare when
the rebuild started, not when the rebuild was actually finished.
Marking it as a used_spare meant that the component label on the spare
was being updated such that after a reboot the component would be
considered up-to-date, regardless of whether the rebuild actually
completed!
This fix includes:
1) Add an additional state "rf_ds_rebuilding_spare" which is used
to denote that a spare is currently being rebuilt from the live
components.
2) Update the comments on the disk states, which were out-of-sync
with reality.
3) When rebuilding to a spare component, that spare now enters the
state rf_ds_rebuilding_spare instead of the state rf_ds_used_spare.
4) When the rebuild is actually complete then the spare component
enters the rf_ds_used_spare state. rf_ds_used_spare is now used
exclusively for the case where the rebuilding to the spare has
completed successfully.
XXX: Someday we need to teach raidctl(8) about this new state, and
take out the backwards compatibility code in rf_netbsdkintf.c (see
RAIDFRAME_GET_INFO in raidioctl()). For today, this fix needs to be
generic enough that it can get backported without major grief.
XXX: Needs pullup to netbsd-5*, netbsd-6*, and netbsd-7
Fixes PR#49244.
 1.312.2.2  11-Nov-2014  martin Pull up following revision(s) (requested by mlelstv in ticket #202):
sys/dev/ccd.c: revision 1.153
sys/dev/ccd.c: revision 1.154
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.313
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.314
sys/dev/ld.c: revision 1.77
sys/dev/vnd.c: revision 1.233
sys/dev/dksubr.c: revision 1.52
sys/dev/dksubr.c: revision 1.53
clamp total number of sectors to UINT32_MAX instead of providing the
lower 32bit of the 64bit number.
No longer warn about differences bewteen disk size and total sector count
in disklabel when the latter is just clamped to the maximum.
 1.312.2.1  11-Nov-2014  martin Pull up following revision(s) (requested by mlelstv in ticket #201):
sbin/dkctl/dkctl.8: revision 1.24
sbin/dkctl/dkctl.8: revision 1.25
sys/dev/scsipi/sd.c: revision 1.310
sys/dev/ata/wd.c: revision 1.415
sbin/dkctl/dkctl.c: revision 1.21
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.315
sys/dev/ld.c: revision 1.78
sys/dev/vnd.c: revision 1.234
sys/dev/dksubr.c: revision 1.54
sys/sys/dkio.h: revision 1.20
sys/dev/dkwedge/dk.c: revision 1.74
Add ioctl to autodiscover wedges.
Implement DIOCMWEDGES ioctl that triggers wedge autodiscovery.
Also fix a reference counting bug and clean up some code.
support DIOCMWEDGES ioctl.
Add 'makewedges' option to autodiscover wedges from a changed label.
New sentence, new line. Bump date for previous.
 1.316.2.8  28-Aug-2017  skrll Sync with HEAD
 1.316.2.7  05-Oct-2016  skrll Sync with HEAD
 1.316.2.6  29-May-2016  skrll Sync with HEAD
 1.316.2.5  19-Mar-2016  skrll Sync with HEAD
 1.316.2.4  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.316.2.3  22-Sep-2015  skrll Sync with HEAD
 1.316.2.2  06-Jun-2015  skrll Sync with HEAD
 1.316.2.1  06-Apr-2015  skrll Sync with HEAD
 1.345.2.8  26-Apr-2017  pgoyette Sync with HEAD
 1.345.2.7  04-Nov-2016  pgoyette Sync with HEAD
 1.345.2.6  26-Jul-2016  pgoyette Rename LOCALCOUNT_INITIALIZER to DEVSW_MODULE_INIT. This better describes
what we're doing, and why.
 1.345.2.5  20-Jul-2016  pgoyette Adapt machine-independant code to the new {b,c}devsw reference-counting
(using localcount(9)). All callers of {b,c}devsw_lookup() now call
{b,c}devsw_lookup_acquire() which retains a reference on the 'struct
{b,c}devsw'. This reference must be released by the caller once it is
finished with the structure's content (or other data that would disappear
if the 'struct {b,c}devsw' were to disappear).
 1.345.2.4  19-Jul-2016  pgoyette Instead of repeatedly typing the conditional initialization of the
.d_localcount members in the various {b,c}devsw, define an initializer
macro and use it. This also removes the need for defining new symbols
for each 'struct localcount'.

As suggested by riastradh@
 1.345.2.3  18-Jul-2016  pgoyette We created two different 'stuct localcount' for a reason - devsw_attach()
requires them to be different!

So use them both in their respective {b,c}devsw initializations.
 1.345.2.2  17-Jul-2016  pgoyette Adapt some modular drivers to the localcount(9) world. We're still
not actually using the localcount stuff, but we need to differentiate
between built-in vs loaded drivers and allocate a "struct localcount"
only for loaded drivers.
 1.345.2.1  17-Jul-2016  pgoyette Don't call devsw_attach() and devsw_detach() for built-in modules.
 1.347.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.349.4.3  17-May-2017  pgoyette At suggestion of chuq@, modify config_attach_pseudo() to return with a
reference held on the device.

Adapt callers to expect the reference to exist, and to ensure that the
reference is released.
 1.349.4.2  29-Apr-2017  pgoyette Remove more unnecessary #include for sys/localcount.h
 1.349.4.1  27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.350.2.1  21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1835):

sys/dev/pci/if_iwi.c: revision 1.117
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.401
sys/dev/scsipi/ses.c: revision 1.52
sys/dev/isa/mcd.c: revision 1.121
(all via patch)

sys/dev: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.

I think the iwi(4), mcd(4), and ses(4) changes actually plug leaks;
the raidframe(4) change probably doesn't (but doesn't hurt).
 1.356.4.4  21-Apr-2020  martin Sync with HEAD
 1.356.4.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.356.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.356.4.1  10-Jun-2019  christos Sync with HEAD
 1.356.2.11  22-Jan-2019  pgoyette Convert the MODULE_{,VOID_}HOOK_CALL macros to do everything in-line
rather than defining an intermediate hook##call function. Almost
all of the hooks are called only once, and although we lose the
ability of doing things like

if (MODULE_HOOK_CALL(...) == 0) ...

we simplify things quite a bit. With this change, we no longer need
to have both declaration and definition macros, and the definition
no longer needs to have both prototype argument list and a "real"
argument list.

FWIW, the above if now needs to written as

int ret;

MODULE_HOOK_CALL(..., ret);
if (ret == 0) ...

with appropriate use of braces {}.
 1.356.2.10  18-Jan-2019  pgoyette Synch with HEAD
 1.356.2.9  18-Jan-2019  pgoyette Don't restrict hooks to having only int or void types. Pass the hook's
type to the various macros, as needed.

Allows us to reduce diffs to original in at least one or two places (we
no longer have to provide an additional parameter to the hook routine
for returning a non-int return value).
 1.356.2.8  14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.356.2.7  13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.356.2.6  29-Sep-2018  pgoyette In MODULE_HOOK_CALL_DECL we don't need to provide the actual argument
list for calling the hook function, nor do we need to provide the
default value (for when the hook has not been set).
 1.356.2.5  18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.356.2.4  18-Sep-2018  pgoyette Split the COMPAT_CALL_HOOK to separate the declaration from the
implementation. Some hooks are called from multiple source files,
and the old method resulted in duplicate implementations.

Implement MP-safe hooks for the usb_subr_30 code. Pass the helper
functions as arguments to the compat code so it does not have to
determine if the kernel contains usb code.
 1.356.2.3  17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.356.2.2  09-Sep-2018  pgoyette In the case of no compat modules (ENOSYS returned from the stubs), reset
the retcode to zero so we don't return the wrong value when there is
nothing to do for the particular command. This was causing spurious
failures for RAIDFRAME_SET_COMPONENT_LABEL which is wrapped in

#if 0
...
#endif
 1.356.2.1  24-Mar-2018  pgoyette Separate the compat_50 and compat_80 dispatching code from the main
body of raidframe, and place into the appropriate compat modules.

Enable building of the compat_80 module.
 1.376.4.6  18-Oct-2023  martin Pull up following revision(s) (requested by manu in ticket #1751):

sys/dev/raidframe/rf_netbsdkintf.c: revision 1.383
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.385
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.402
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.403
sys/arch/i386/stand/lib/biosdisk.c: revision 1.59
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.377
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.378
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.379
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.392
sys/rump/librump/rumpkern/emul.c: revision 1.200
sys/arch/i386/stand/lib/biosdisk.c: revision 1.60
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.416
(all via patch)

Get &rsc->sc_dksc only when we know 'rsc' is not NULL. This was actually
harmless because we didn't use the pointer then.

Gcc -Os on landisk is not smart enough to follow the conditional
initialization and warns, unconditionaly initialize dksc at declaration
with a XXX gcc comment.

Improve wording in comments in raid_dumpblock().

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.

Nix trailing whitespace.

if raidframe sets booted_device, log a debug message about it.
merge two debug lines in auto-root selection.
convert non-config-handled "DEBUG_ROOT" to aprint_debug().
now it's possible to get boot-time info about raidframe root
device selection with simple "boot -x".

Align the behavior of different boot methods in RAIDframe

We enforce the documented and paritally implemented behavior when
looking for the kernel in RAID 1 sets without a partition name given.

We search for:
- A GPT partition with bootme attribute set
- A FFS or LFS patititon
- The first partition

Fix root search in RAID 1 sets

We use the wedge information given by bootstrap, where the kernel was
found. This requires src/sys/arch/i386/stand/i386/lib/biosdisk.c 1.59
to work in all cases.

Fix build with -DNO_GPT
 1.376.4.5  18-Sep-2023  martin Pull up following revision(s) (requested by oster in ticket #1733):

sys/dev/raidframe/rf_netbsdkintf.c: revision 1.413

A component that is in state rf_ds_reconstructing has failed, and should
not be consulted for DIOCGCACHE.

Fixes an observed panic when rf_get_component_caches() does an IOCTL to
a failed device while reconstruction is in progress.
 1.376.4.4  29-Aug-2022  martin Pull up following revision(s) (requested by oster in ticket #1506):

sys/dev/raidframe/rf_netbsdkintf.c: revision 1.409

RAIDframe must be initialized for the RAIDFRAME_SET_LAST_UNIT
and RAIDFRAME_SHUTDOWN ioctls.
 1.376.4.3  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.376.4.2  03-Aug-2022  martin Pull up following revision(s) (requested by riastradh in ticket #1485):

sys/dev/pci/if_iwi.c: revision 1.117
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.401
sys/dev/scsipi/ses.c: revision 1.52
sys/dev/isa/mcd.c: revision 1.121

sys/dev: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.

I think the iwi(4), mcd(4), and ses(4) changes actually plug leaks;
the raidframe(4) change probably doesn't (but doesn't hurt).
 1.376.4.1  21-Mar-2020  martin Pull up following revision(s) (requested by riastradh in ticket #795):

sys/dev/dksubr.c: revision 1.112
sys/arch/xen/xen/xbd_xenbus.c: revision 1.95
sys/dev/scsipi/sd.c: revision 1.328
sys/dev/dkvar.h: revision 1.32
sys/dev/ld.c: revision 1.109
sys/dev/cgd.c: revision 1.120
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.380
sys/dev/ata/wd.c: revision 1.458

Add a flag to dk_dump for virtual disk devices.

If a disk is backed by a physical medium other than itself, such as
cgd(4), then it passes DK_DUMP_RECURSIVE to disable the recursion
detection for dk_dump.

If, however, a device represents a physical medium on its own, such
as wd(4), then it passes 0 instead.

With this, I can now dump to dk on cgd on dk on wd.
 1.381.2.1  20-Apr-2020  bouyer Sync with HEAD
 1.390.4.1  17-Apr-2021  thorpej Sync with HEAD.
 1.391.2.3  01-Aug-2021  thorpej Sync with HEAD.
 1.391.2.2  17-Jun-2021  thorpej Sync w/ HEAD.
 1.391.2.1  13-May-2021  thorpej Sync with HEAD.
 1.392.2.1  31-May-2021  cjep sync with head
 1.397.2.1  05-Aug-2021  thorpej Sync w/ HEAD.
 1.410.4.4  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.410.4.3  18-Oct-2023  martin Pull up following revision(s) (requested by manu in ticket #418):

sys/arch/i386/stand/lib/biosdisk.c: revision 1.59
sys/rump/librump/rumpkern/emul.c: revision 1.200
sys/arch/i386/stand/lib/biosdisk.c: revision 1.60
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.416

Align the behavior of different boot methods in RAIDframe

We enforce the documented and paritally implemented behavior when
looking for the kernel in RAID 1 sets without a partition name given.

We search for:
- A GPT partition with bootme attribute set
- A FFS or LFS patititon
- The first partition

Fix root search in RAID 1 sets

We use the wedge information given by bootstrap, where the kernel was
found. This requires src/sys/arch/i386/stand/i386/lib/biosdisk.c 1.59
to work in all cases.

Fix build with -DNO_GPT
 1.410.4.2  18-Sep-2023  martin Pull up following revision(s) (requested by oster in ticket #376):

sys/dev/raidframe/rf_netbsdkintf.c: revision 1.413

A component that is in state rf_ds_reconstructing has failed, and should
not be consulted for DIOCGCACHE.

Fixes an observed panic when rf_get_component_caches() does an IOCTL to
a failed device while reconstruction is in progress.
 1.410.4.1  21-Jun-2023  martin Pull up following revision(s) (requested by hannken in ticket #197):

sys/ufs/ffs/ffs_vfsops.c: revision 1.381
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.412

Undo unlock/relock for VOP_IOCTL().
PR kern/57450 (unplugging hung USB disk triggers panic via _vstate_assert)

RSS XML Feed