History log of /openbsd-current/sys/dev/softraid_raid0.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.53 25-Mar-2020 tobhe

Add missing %s in sr_error, otherwise 'sd->sd_name' is not printed.

ok kn@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.52 12-Apr-2016 krw

No need to rescan chunks in each discipline to find appropriate
volume sector size. Determine volume sector size in sr_meta_init().

Pointed out, tweaked and ok jsing@


# 1.51 04-Apr-2016 krw

Enable creation of softraid volumes using disks with non-512 byte
sectors. Volumes created will present a sector size equal to the
largest sector size of the constituent disks.

Softraid Metadata version cranks to 6 due to new field.

ok jsing@ with tweaks that will follow soon.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.50 21-Jul-2015 krw

A few more daddr_t fixes. Rename 'phys_off' variables to 'offset'
since they are now relative to chunks. Use 'blkno' as normal variable
name for daddr_t items rather than mix of 'blkno, blk, offset.
Change field name ssd_data_offset to ssd_data_blkno since it is a
block and not byte quantity.

No intentional functional change.


# 1.49 19-Jul-2015 krw

Remove unneeded #include <disklabel.h>.

ok jsing@


# 1.48 19-Jul-2015 krw

Stop adding and subtracting data offset. Just keep to chunk relative
block offsets until actual i/o is constructed and needs the physical
offset. Eliminate a number of <<DEV_BSIZE shifts as a bonus.

No intentional functional change.

Fixed and ok jsing@


Revision tags: OPENBSD_5_7_BASE
# 1.47 18-Nov-2014 tedu

move arc4random prototype to systm.h. more appropriate for most code
to include that than rdnvar.h. ok deraadt dlg


# 1.46 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.45 21-Nov-2013 krw

Don't cast int64_t variables to (long long) when using %lld.


# 1.44 21-Nov-2013 krw

Change a bunch of daddr_t variables that don't (obviously) contain
512-byte-block information to int64_t, the underlying type of
daddr_t at the moment. No change to .o files. Removal of now
unneeded (long long) casts is next.


# 1.43 05-Nov-2013 reyk

Fix RAID levels 0, 4, 5, and 6 with partitions larger than 2TB.

A 64bit bit operation with the 32bit strip size could overflow and
result in ridiculously small volumes when using large partitions (eg.
4x 3TB in RAID 5 resulted in a ~2TB volume). It is fixed by casting
the strip size to an unsigned 64bit value.

ok tedu@ millert@ deraadt@


# 1.42 01-Nov-2013 krw

Sprinkle (long long) casts where %lld is being used to print daddr_t
variables. Some random whitespace/knf repairs encountered on the way.

ok miod@ on inspection, feedback & more suggestions from millert@


Revision tags: OPENBSD_5_4_BASE
# 1.41 11-Jun-2013 deraadt

final removal of daddr64_t. daddr_t has been 64 bit for a long enough
test period; i think 3 years ago the last bugs fell out.
ok otto beck others


# 1.40 21-May-2013 jsing

Provide a function that handles the scheduling of work units. This
simplifies the discipline code, avoids code duplication and moves the
scheduling logic into a single location.

ok krw@


# 1.39 31-Mar-2013 jsing

Use consistent error handling when validating the number of chunks
provided.


# 1.38 31-Mar-2013 jsing

Provide default resource allocation and free functions. Convert all
disciplines except for AOE and CRYPTO, which require custom handlers.


# 1.37 31-Mar-2013 jsing

Pull the initialisation of runtime values out into a separate init
function, rather than having it spread across create/assemble/alloc.
Also handle strip size errors appropriately, rather than failing silently.

ok krw@


# 1.36 30-Mar-2013 jsing

Provide a default discipline interrupt handling function and migrate all of
the disciplines that now have the same interrupt code.

ok krw@


# 1.35 02-Mar-2013 jsing

sr_alloc_resources() and sr_free_resources() can never be called without
a valid struct sr_discipline. Remove redundant NULL pointer checks.


# 1.34 02-Mar-2013 jsing

Unbreak softraid compilation with debug enabled.

Prompted by Dmitry Bogdan.


Revision tags: OPENBSD_5_3_BASE
# 1.33 18-Jan-2013 jsing

Convert softraid RAID 0 to new workunit completion functions


# 1.32 18-Jan-2013 jsing

Clean up and rework workunit completion for RAID 0. Ensure that we remove
the workunit from the pending queue and restart deferred workunits, even
in error conditions.

ok krw@


# 1.31 17-Jan-2013 jsing

Convert softraid RAID 0 to the new ccb functions.

ok krw@


# 1.30 16-Jan-2013 jsing

Set resid to zero if the scsi transfer completed without error.

ok krw@


# 1.29 15-Jan-2013 jsing

Always initialise the discipline name, not just when we are doing a create.


# 1.28 15-Jan-2013 jsing

Keep a function pointer to the per-discipline I/O interrupt handler in the
discipline data structure. To be used with an upcoming diff.


# 1.27 08-Oct-2012 jsing

Provide a mechanism for the kernel to pass data through to the discipline
during volume assembly.


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.26 22-Jan-2012 jsing

Convert softraid(4) to new bio(4) status interface. This allows bioctl(8)
to provide useful feedback, rather than reporting an ioctl failure and
leaving the user to consult dmesg. For now we continue to print most things
to the console, even if the message is a result of an ioctl.


# 1.25 26-Dec-2011 jsing

Provide default set chunk state and set volume state functions which
cover the no redundancy/no rebuild case. Use these for the AOE, crypto and
RAID 0 disciplines.


# 1.24 25-Dec-2011 jsing

Initialise discipline function pointers with defaults and only override
those that are needed by a specific discipline.


Revision tags: OPENBSD_5_0_BASE
# 1.23 05-Apr-2011 krw

Iopoolification. Testing by marco@.

ok dlg@ marco@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 02-Jul-2010 jsing

Determine the data offset using a variable specified within the softraid
metadata. This allows us to implement seamless transitions from the
previous metadata version to the current version, avoiding the need to
recreate the softraid volume.

Joint work with marco@ during c2k10.

ok marco@


# 1.21 01-Jul-2010 thib

make sure that buf's on the stack set the b_bq to NULL.
one memset -> bzero.

ok marco@, jsing@


# 1.20 26-Mar-2010 jsing

Add storage for the boot block and boot loader to the softraid metadata.
Also add a new optional metadata type for boot data. This is the first
step (of many) towards being able to boot from softraid volumes.

WARNING: This version of the softraid metadata is not compatible with
previous versions. As a result, any softraid volumes created with older
kernels will not assemble. Data on existing softraid volumes should be
backed up before upgrading. The volume should then be recreated and the
data restored.

ok marco@


Revision tags: OPENBSD_4_7_BASE
# 1.19 09-Jan-2010 krw

Zap all setting of ITSDONE in drivers that don't look at it. Nobody
else cares so it's just noise. Drivers that actually look at ITSDONE
are unchanged.

ok marco@ (for his files) dlg@ beck@


# 1.18 15-Dec-2009 jsing

Factor out discipline specific create/assemble code.

"in, in, in!" marco@


# 1.17 07-Dec-2009 jsing

Define discipline capabilities using a set of flags.

"shiny!!" marco@


# 1.16 09-Aug-2009 marco

Switch softraid to vnodes to prevent bad things from happening when using
d_open/d_close.

tested by many, ok jsing, thib, krw


Revision tags: OPENBSD_4_6_BASE
# 1.15 02-Jun-2009 marco

Abuse bio layer a little less by marking fake buffers with B_PHYS.
From beck with lots of squealing and ear bleeds.
Issue originally reported by todd.

ok beck


# 1.14 02-Jun-2009 deraadt

marco needs to learn how to do his range checks better, found by Parfait
ok oga guenther


# 1.13 11-May-2009 jsing

Move the discipline initialisation code into discipline specific functions,
rather than initialising everything in softraid.c. This makes a discipline
more self-contained and reduces the number of function declarations needed
in softraidvar.h.

ok marco@


# 1.12 28-Apr-2009 marco

Part one of partial bringup volumes. Plenty of rope to kill your data
use with caution...


Revision tags: OPENBSD_4_5_BASE
# 1.11 25-Nov-2008 marco

Add generic sr_scsi_done function that does the spl dance


# 1.10 04-Oct-2008 miod

Remove bogus code from the error path in sr_raid0_rw(); ok marco@


Revision tags: OPENBSD_4_4_BASE
# 1.9 19-Jul-2008 marco

Full rewrite of metadata handling. This fixes power failures and crashes
that caused illegal checksums. The new metadata code is more or less ready
to deal with other vendor's metadata formats.

While here clean up the name space.

Fix thib's pool mess by adding removing bad flags in interrupt context.

tested on macppc, amd64, i386, sparc64 & hppa

sparc64 has issues with crypto however those do not seem to be softraid
specific.

help from okan@ ckuethe@ Will Backman and others


Revision tags: OPENBSD_4_3_BASE
# 1.8 05-Feb-2008 marco

Shave off a few more bytes by moving IO collision detection into a generic
fucntion. Fix bug in the crypto code that could casuse data corruption as
a bonus, bad cut & past tedu!


# 1.7 05-Feb-2008 marco

Create a generic function to validate IO instead of copying and pasting
same code in all disciplines. This shaves of a few bytes.

crypto 3185 -> 2690
raid 0 2843 -> 2378
raid 1 3474 -> 2689


# 1.6 26-Jan-2008 marco

Fix some debug prints


# 1.5 24-Jan-2008 marco

Create chunk and state transition functions for RAID 0.
Move RAID 1 chunk and state transition functions into proper file.
Let Crypto use RAID 1 chunk and state transition functions for now but this
needs fixing.


# 1.4 24-Jan-2008 marco

Bring softraid into the world of 16 byte commands; this allows for > 2TB disks
Fix bioctl size output which was off by *512; diagnosed by otto


# 1.3 24-Jan-2008 marco

Oops, make fit in 80 cols.


# 1.2 24-Jan-2008 marco

Add IO path to RAID 0 discipline.


# 1.1 19-Jan-2008 marco

Add initial scaffold for RAID 0. No IO just yet.

Much prodding todd


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.52 12-Apr-2016 krw

No need to rescan chunks in each discipline to find appropriate
volume sector size. Determine volume sector size in sr_meta_init().

Pointed out, tweaked and ok jsing@


# 1.51 04-Apr-2016 krw

Enable creation of softraid volumes using disks with non-512 byte
sectors. Volumes created will present a sector size equal to the
largest sector size of the constituent disks.

Softraid Metadata version cranks to 6 due to new field.

ok jsing@ with tweaks that will follow soon.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.50 21-Jul-2015 krw

A few more daddr_t fixes. Rename 'phys_off' variables to 'offset'
since they are now relative to chunks. Use 'blkno' as normal variable
name for daddr_t items rather than mix of 'blkno, blk, offset.
Change field name ssd_data_offset to ssd_data_blkno since it is a
block and not byte quantity.

No intentional functional change.


# 1.49 19-Jul-2015 krw

Remove unneeded #include <disklabel.h>.

ok jsing@


# 1.48 19-Jul-2015 krw

Stop adding and subtracting data offset. Just keep to chunk relative
block offsets until actual i/o is constructed and needs the physical
offset. Eliminate a number of <<DEV_BSIZE shifts as a bonus.

No intentional functional change.

Fixed and ok jsing@


Revision tags: OPENBSD_5_7_BASE
# 1.47 18-Nov-2014 tedu

move arc4random prototype to systm.h. more appropriate for most code
to include that than rdnvar.h. ok deraadt dlg


# 1.46 14-Sep-2014 jsg

remove uneeded proc.h includes
ok mpi@ kspillner@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.45 21-Nov-2013 krw

Don't cast int64_t variables to (long long) when using %lld.


# 1.44 21-Nov-2013 krw

Change a bunch of daddr_t variables that don't (obviously) contain
512-byte-block information to int64_t, the underlying type of
daddr_t at the moment. No change to .o files. Removal of now
unneeded (long long) casts is next.


# 1.43 05-Nov-2013 reyk

Fix RAID levels 0, 4, 5, and 6 with partitions larger than 2TB.

A 64bit bit operation with the 32bit strip size could overflow and
result in ridiculously small volumes when using large partitions (eg.
4x 3TB in RAID 5 resulted in a ~2TB volume). It is fixed by casting
the strip size to an unsigned 64bit value.

ok tedu@ millert@ deraadt@


# 1.42 01-Nov-2013 krw

Sprinkle (long long) casts where %lld is being used to print daddr_t
variables. Some random whitespace/knf repairs encountered on the way.

ok miod@ on inspection, feedback & more suggestions from millert@


Revision tags: OPENBSD_5_4_BASE
# 1.41 11-Jun-2013 deraadt

final removal of daddr64_t. daddr_t has been 64 bit for a long enough
test period; i think 3 years ago the last bugs fell out.
ok otto beck others


# 1.40 21-May-2013 jsing

Provide a function that handles the scheduling of work units. This
simplifies the discipline code, avoids code duplication and moves the
scheduling logic into a single location.

ok krw@


# 1.39 31-Mar-2013 jsing

Use consistent error handling when validating the number of chunks
provided.


# 1.38 31-Mar-2013 jsing

Provide default resource allocation and free functions. Convert all
disciplines except for AOE and CRYPTO, which require custom handlers.


# 1.37 31-Mar-2013 jsing

Pull the initialisation of runtime values out into a separate init
function, rather than having it spread across create/assemble/alloc.
Also handle strip size errors appropriately, rather than failing silently.

ok krw@


# 1.36 30-Mar-2013 jsing

Provide a default discipline interrupt handling function and migrate all of
the disciplines that now have the same interrupt code.

ok krw@


# 1.35 02-Mar-2013 jsing

sr_alloc_resources() and sr_free_resources() can never be called without
a valid struct sr_discipline. Remove redundant NULL pointer checks.


# 1.34 02-Mar-2013 jsing

Unbreak softraid compilation with debug enabled.

Prompted by Dmitry Bogdan.


Revision tags: OPENBSD_5_3_BASE
# 1.33 18-Jan-2013 jsing

Convert softraid RAID 0 to new workunit completion functions


# 1.32 18-Jan-2013 jsing

Clean up and rework workunit completion for RAID 0. Ensure that we remove
the workunit from the pending queue and restart deferred workunits, even
in error conditions.

ok krw@


# 1.31 17-Jan-2013 jsing

Convert softraid RAID 0 to the new ccb functions.

ok krw@


# 1.30 16-Jan-2013 jsing

Set resid to zero if the scsi transfer completed without error.

ok krw@


# 1.29 15-Jan-2013 jsing

Always initialise the discipline name, not just when we are doing a create.


# 1.28 15-Jan-2013 jsing

Keep a function pointer to the per-discipline I/O interrupt handler in the
discipline data structure. To be used with an upcoming diff.


# 1.27 08-Oct-2012 jsing

Provide a mechanism for the kernel to pass data through to the discipline
during volume assembly.


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.26 22-Jan-2012 jsing

Convert softraid(4) to new bio(4) status interface. This allows bioctl(8)
to provide useful feedback, rather than reporting an ioctl failure and
leaving the user to consult dmesg. For now we continue to print most things
to the console, even if the message is a result of an ioctl.


# 1.25 26-Dec-2011 jsing

Provide default set chunk state and set volume state functions which
cover the no redundancy/no rebuild case. Use these for the AOE, crypto and
RAID 0 disciplines.


# 1.24 25-Dec-2011 jsing

Initialise discipline function pointers with defaults and only override
those that are needed by a specific discipline.


Revision tags: OPENBSD_5_0_BASE
# 1.23 05-Apr-2011 krw

Iopoolification. Testing by marco@.

ok dlg@ marco@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 02-Jul-2010 jsing

Determine the data offset using a variable specified within the softraid
metadata. This allows us to implement seamless transitions from the
previous metadata version to the current version, avoiding the need to
recreate the softraid volume.

Joint work with marco@ during c2k10.

ok marco@


# 1.21 01-Jul-2010 thib

make sure that buf's on the stack set the b_bq to NULL.
one memset -> bzero.

ok marco@, jsing@


# 1.20 26-Mar-2010 jsing

Add storage for the boot block and boot loader to the softraid metadata.
Also add a new optional metadata type for boot data. This is the first
step (of many) towards being able to boot from softraid volumes.

WARNING: This version of the softraid metadata is not compatible with
previous versions. As a result, any softraid volumes created with older
kernels will not assemble. Data on existing softraid volumes should be
backed up before upgrading. The volume should then be recreated and the
data restored.

ok marco@


Revision tags: OPENBSD_4_7_BASE
# 1.19 09-Jan-2010 krw

Zap all setting of ITSDONE in drivers that don't look at it. Nobody
else cares so it's just noise. Drivers that actually look at ITSDONE
are unchanged.

ok marco@ (for his files) dlg@ beck@


# 1.18 15-Dec-2009 jsing

Factor out discipline specific create/assemble code.

"in, in, in!" marco@


# 1.17 07-Dec-2009 jsing

Define discipline capabilities using a set of flags.

"shiny!!" marco@


# 1.16 09-Aug-2009 marco

Switch softraid to vnodes to prevent bad things from happening when using
d_open/d_close.

tested by many, ok jsing, thib, krw


Revision tags: OPENBSD_4_6_BASE
# 1.15 02-Jun-2009 marco

Abuse bio layer a little less by marking fake buffers with B_PHYS.
From beck with lots of squealing and ear bleeds.
Issue originally reported by todd.

ok beck


# 1.14 02-Jun-2009 deraadt

marco needs to learn how to do his range checks better, found by Parfait
ok oga guenther


# 1.13 11-May-2009 jsing

Move the discipline initialisation code into discipline specific functions,
rather than initialising everything in softraid.c. This makes a discipline
more self-contained and reduces the number of function declarations needed
in softraidvar.h.

ok marco@


# 1.12 28-Apr-2009 marco

Part one of partial bringup volumes. Plenty of rope to kill your data
use with caution...


Revision tags: OPENBSD_4_5_BASE
# 1.11 25-Nov-2008 marco

Add generic sr_scsi_done function that does the spl dance


# 1.10 04-Oct-2008 miod

Remove bogus code from the error path in sr_raid0_rw(); ok marco@


Revision tags: OPENBSD_4_4_BASE
# 1.9 19-Jul-2008 marco

Full rewrite of metadata handling. This fixes power failures and crashes
that caused illegal checksums. The new metadata code is more or less ready
to deal with other vendor's metadata formats.

While here clean up the name space.

Fix thib's pool mess by adding removing bad flags in interrupt context.

tested on macppc, amd64, i386, sparc64 & hppa

sparc64 has issues with crypto however those do not seem to be softraid
specific.

help from okan@ ckuethe@ Will Backman and others


Revision tags: OPENBSD_4_3_BASE
# 1.8 05-Feb-2008 marco

Shave off a few more bytes by moving IO collision detection into a generic
fucntion. Fix bug in the crypto code that could casuse data corruption as
a bonus, bad cut & past tedu!


# 1.7 05-Feb-2008 marco

Create a generic function to validate IO instead of copying and pasting
same code in all disciplines. This shaves of a few bytes.

crypto 3185 -> 2690
raid 0 2843 -> 2378
raid 1 3474 -> 2689


# 1.6 26-Jan-2008 marco

Fix some debug prints


# 1.5 24-Jan-2008 marco

Create chunk and state transition functions for RAID 0.
Move RAID 1 chunk and state transition functions into proper file.
Let Crypto use RAID 1 chunk and state transition functions for now but this
needs fixing.


# 1.4 24-Jan-2008 marco

Bring softraid into the world of 16 byte commands; this allows for > 2TB disks
Fix bioctl size output which was off by *512; diagnosed by otto


# 1.3 24-Jan-2008 marco

Oops, make fit in 80 cols.


# 1.2 24-Jan-2008 marco

Add IO path to RAID 0 discipline.


# 1.1 19-Jan-2008 marco

Add initial scaffold for RAID 0. No IO just yet.

Much prodding todd