Ported from DragonFlyBSD, but this target had originally existed in
Linux kernel. See below for details.
https://www.kernel.org/doc/Documentation/device-mapper/delay.txt
Due to "tick" in hz(9) not working (which results in dmdlthread spinning
forever in _submit_queue() without dp extracted from delayed list
and queued into submit list), this hasn't been hooked to dm.kmod yet.
taken-from: DragonFlyBSD
Ported from DragonFlyBSD, but this target had originally existed in
Linux kernel. See below for details.
https://www.kernel.org/doc/Documentation/device-mapper/dm-flakey.txt
Due to two technical issues, this hasn't been hooked to dm.kmod yet.
1) "tick" in hz(9) not working.
2) Unable to use ->b_private in nestiobuf callback when it's already
used for mbp (see HAS_BUF_PRIV2).
taken-from: DragonFlyBSD
Since ->info() (counter part of ->table() in the original dm design
in Linux kernel in .status where both INFO and TABLE are optional)
is an optional handler, make ->table() optional as well. Some
targets don't have anything to do in ->table() just as in ->info().
taken-from: DragonFlyBSD
As mentioned in "dm: Don't try to implement "status" as subset of "table"",
dm-stripe in NetBSD doesn't have correct "status" output format.
Implement ->info() to sync with Linux kernel.
Note that num_error for stripe device isn't implemented yet.
taken-from: DragonFlyBSD
Retrieving device dependencies doesn't need to be target specific.
The reason it currently needs ->deps() is because dm core doesn't
have data structure that allows table to walk through target's
underlying devices. Add struct dm_mapping to be able to do this,
and remove ->deps()'s from targets which basically do the same thing.
=====(A) before this commit
table
| [dm core]
-------------------------------------------------------
| pdev pdev pdev [dm targets]
v ^ ^ ^
target----/---------/---------/
(void*)
=====(B) this commit
table---->mapping-->mapping-->mapping-->...
| | | |
| v v v [dm core]
-------------------------------------------------------
| pdev pdev pdev [dm targets]
v ^ ^ ^
target----/---------/---------/
(void*)
taken-from: DragonFlyBSD
The existing "table" output showing device file path of pdev is
not compatible with dm in Linux kernel (and also DragonFlyBSD).
It should be showing "major:minor" instead.
taken-from: DragonFlyBSD
and make a caller assume secsize 0 if ->secsize not present.
This allows a dummy function to be removed which was added in
"dm: Add dummy target ->sync()/->secsize() to prevent panic on modload(8)".
Since now that dm targets in NetBSD have ->info() for "status",
->status() should be renamed to ->table() for "table",
given how dm target status was originally designed in Linux kernel.
taken-from: DragonFlyBSD
The way dm_table_status_ioctl() implements "status" and "table" is
not compatible with Linux kernel. Some targets have different outputs
that "status" can't be implemented as subset of "table".
Add ->info() handler to sync with "status" behavior in Linux kernel.
Some targets which currently exist in NetBSD (I think striped)
as well as some minor targets that I plan to port to NetBSD
can/should implement ->info(), but will do that in a different commit.
taken-from: DragonFlyBSD
Having assertions here causes panic if target is missing anything
as shown in "dm: Add dummy target ->sync()/->secsize() to prevent panic on modload(8)".
Instead just return EINVAL if a handler(s) isn't implemented.
taken-from: DragonFlyBSD
Take dm_table_entry_t* instead of void**.
Remove dm_dev_t* unneeded by target code.
No functional change, but for future changes.
taken-from: DragonFlyBSD