Home | History | Annotate | Download | only in dm
History log of /src/sys/dev/dm/dm.h
RevisionDateAuthorComments
 1.56  21-Aug-2021  andvar fix typos in sys/dev/dm code comments and documentation.
also remove some trailing space in documentation.
 1.55  21-Jan-2020  tkusumi dm: #if0 target's ->upcall() handler

This is part of NetBSD's dm design, but unimplemented
(all handlers return 0) and also unused.
 1.54  05-Jan-2020  tkusumi branches: 1.54.2;
dm: Add dm-delay target

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
 1.53  02-Jan-2020  tkusumi dm: Add dm-flakey target

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
 1.52  23-Dec-2019  tkusumi dm: Make target's ->table() optional

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
 1.51  21-Dec-2019  tkusumi dm: Fix dm-stripe's "status" output format

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
 1.50  21-Dec-2019  tkusumi dm: Remove target's ->deps() by implementing deps in dm core

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
 1.49  20-Dec-2019  tkusumi dm: Fix "table" output format of dm-linear and dm-stripe

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
 1.48  16-Dec-2019  tkusumi dm: Cleanup dm.h (remove unneeded comments, etc)
 1.47  16-Dec-2019  tkusumi dm: Enable dm-error and dm-zero target

Add these two targets to dm.kmod.
These are generally available in Linux and DragonFlyBSD,
so enable them in NetBSD as well.
 1.46  15-Dec-2019  tkusumi dm: Rename dm specific atoi() to atoi64()

This is uint64_t version, not sys/lib/libsa/atoi.c.
 1.45  15-Dec-2019  tkusumi dm: Make targets' ->sync() optional

Apparently some targets have nothing to sync, so make it optional.
 1.44  15-Dec-2019  tkusumi dm: Make targets' ->secsize() optional

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)".
 1.43  15-Dec-2019  tkusumi dm: "unsigned" -> "unsigned int" for consistency

Use either one, but not both.
 1.42  15-Dec-2019  tkusumi dm: Rename targets' ->status() to ->table() given ->info() exists

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
 1.41  14-Dec-2019  tkusumi dm: Don't try to implement "status" as subset of "table"

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
 1.40  14-Dec-2019  tkusumi dm: Move extern declaration of global variables to dm.h
 1.39  12-Dec-2019  tkusumi dm: Make target's ->init() take parsed argc and argv

This gets rid of the same parser code in each target using strsep(3).
taken-from: DragonFlyBSD
 1.38  08-Dec-2019  tkusumi dm: Add dummy target ->sync()/->secsize() to prevent panic on modload(8)

dm_target_insert() has assertions to ensure targets implement all handlers.
Adding dummy ones at least prevents panic on modload(8).
 1.37  08-Dec-2019  tkusumi dm: Move targets specific structs to .c files

These don't need to be defined and exposed in dm.h.
 1.36  08-Dec-2019  tkusumi dm: Unbreak compilation of kernel modules

The dm kernel modules (MK_DM_TARGETS enabled in sys/modules/dm/Makefile)
have been broken. Unbreak the build.
 1.35  08-Dec-2019  tkusumi dm: Refactor target's ->init() i/f

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
 1.34  07-Dec-2019  tkusumi dm: Fix strange pointer declarations

Should be "type *name" or "type* name", but not "type * name".
taken-from: DragonFlyBSD
 1.33  05-Dec-2019  tkusumi dm: Remove unneeded dm_get_version_ioctl()

"version" is implemented and handled in userspace,
hence dm ioctl doesn't need to support it.

taken-from: DragonFlyBSD
 1.32  04-Dec-2019  tkusumi dm: Comment out unused dm_dev fields documented in sys/dev/dm/doc
 1.31  03-Dec-2019  tkusumi dm: Remove unused macro MAX_TARGET_STRING_LEN

that was added but never used in both NetBSD and DragonFlyBSD.
taken-from: DragonFlyBSD
 1.30  03-Dec-2019  tkusumi dm: Include <sys/vnode.h> in dm.h

dm.h already depends on vnode, so have dm.h include <sys/vnode.h>
instead of other .c files.

taken-from: DragonFlyBSD
 1.29  03-Dec-2019  tkusumi dm: Doesn't need to expose struct cmd_function in a header
 1.28  01-Dec-2019  tkusumi dm: Remove unused dm_dev::dev_type

Given OOP-like architecture of dm target device structure,
dm_dev doesn't need to have self contained target type field,
and in fact this is unused.
 1.27  02-Oct-2014  justin branches: 1.27.20;
dm_target_t reference count is modified with atomic_{inc,dec}_32 so should
be uint_32_t not int
 1.26  14-Jun-2014  hannken Change dk_lookup() to return an anonymous vnode not associated with
any file system. Change all consumers of dk_lookup() to get the
device from "v_rdev" instead of VOP_GETATTR() as specfs does not
support VOP_GETATTR(). Devices obtained with dk_lookup() will no
longer disappear on forced unmounts.

Fix for PR kern/48849 (root mirror raid fails on shutdown)

Welcome to 6.99.44
 1.25  09-Dec-2013  wiz branches: 1.25.2;
Fix typo ("then" instead of "than")
 1.24  28-Jul-2012  matt branches: 1.24.2; 1.24.4;
Fix -fno-common found by building i386/conf/ALL
 1.23  27-Aug-2011  ahoka branches: 1.23.2;
- add a function to get the inactive table's size
- some whitespace fix from emacs...
 1.22  23-Dec-2010  christos Now that we have allowed operator to access the control node, make sure
that he cannot cause damage, by only allowing the superuser to do ioctls
that can cause damage.
 1.21  23-Dec-2010  mlelstv make dm aware of physical sector sizes.

For aggregates of multiple disks we use the largest sector size from
all disks. For standard power-of-2 sizes this is the same as the least
common multiple. We still require proper alignment of the targets in
the mapping table.

ok by haad@
 1.20  06-Dec-2010  haad Add comment about dm_dev minor, and change it to 32bit value we realy not
going to use so much device minor numbers.
 1.19  23-Oct-2010  haad Add old file describing locking schema used in dm driver.
 1.18  18-May-2010  haad Add multi device strip support written by Guillermo Amaral and reviewed by me.
 1.17  29-Dec-2009  haad branches: 1.17.2; 1.17.4;
Add private lock to dm_dev_t used for mutual exclusion for diks(9) api
routines. This change fixes PR kern/42532.
 1.16  06-Dec-2009  haad Make our driver version equal to linux driver.
 1.15  01-Dec-2009  haad Revert my commit which have added knowledge about dm targets to libdevmapper,
this breaks abstraction. Because only lvmtools/lvmlib and device-mapper can
have knowledge about target mapping and libdevmapper only passes requests
from lvmtools to kernel and back. Bump major library and driver version.

Requested by: yamt@
 1.14  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.13  05-Jun-2009  haad Parse dm param string in libdevmapper and not in a dm target init function.
Create proplib param dictionary entry in libdevmapper and pass it to dm in
dm_ioctl dict.
Param target is then passed to target init function, where is parse. I like
this aproach much better than passing char **argv and trusting to user input.

I have bumped minor lib/driver version.

XXX. Add more sanity checks in kernel.
 1.12  25-Mar-2009  dyoung branches: 1.12.2;
It is only by chance that this gets the prop_array_t definition that it
needs, so explicitly #include <prop/proplib.h>.
 1.11  06-Mar-2009  haad Fix lvm lvrename command. There was bug in dm_dev_lookup where
dm_dev_lookup_name was called with device uuid. Remove dm_dev_t:dk_label is
it not used anymore.
 1.10  01-Mar-2009  haad Add initial support for striping target, hardcode maximal number of stripes
to 2 for now. strategy routine must be written, for now only parsing and
support routines are available. This is work in progress code and should be
taken very carefully.
 1.9  19-Feb-2009  haad Add support for autoloading of device-mapper targets modules. Add
dm_target_autoload function which tries to load target module. Fix two
deadlocks in dm_table_load_ioctl error path(I forgot to call dm_dev_unbusy).
 1.8  16-Jan-2009  haad branches: 1.8.2; 1.8.4; 1.8.6;
Add struct disk to dm_dev so our LV will beshowed in iostat output.
 1.7  11-Jan-2009  haad Use 64bit long minor nuber in dm_dev structure.
 1.6  02-Jan-2009  haad Add stubs for mirror target, too. This target does nothing for now, but lvm
tools support mirror target and trying to create LV with mirrorred backend
caused panic in dm_table_load_ioctl.
 1.5  02-Jan-2009  haad Add stripe target functions stubs. Stripe target must be present in dm driver
because without it lvm2tools will not create LVsi and eventualy panic system.

Problem reported by agc@.
 1.4  21-Dec-2008  haad Add support for loading dm targets as separate modules. All targets except
linear can be loaded as module. Module is not loaded when there is target
with similar name already. Zero and error targets aresimple examples how
can be all future targets written to support dynamic loading. Target can't
be unloaded until there is at least one user.
 1.3  19-Dec-2008  haad Add infrastructure needed to load device-mapper targets as modules.
Targets wasn't converted yet and at least snapshot target will be converted
in a near future.
 1.2  19-Dec-2008  haad Merge the haad-dm branch to -current. This branch adds LVM functionality to
the base NetBSD system. It uses Linux LVM2 tools and our BSD licensed
device-mapper driver.

The device-mapper driver can be used to create virtual block devices which
maps virtual blocks to real with target mapping called target. Currently
these targets are available a linear, zero, error and a snapshot (this is
work in progress and doesn't work yet).

The lvm2tools adds lvm and dmsetup binary to based system, where the lvm
tool is used to manage and administer whole LVM and the dmestup is used to
communicate iwith device-mapper kernel driver. With these tools also
a libdevmapper library is instaled to the base system.

Building of tools and driver is currently disable and can be enabled with
MKLVM=yes in mk.conf. I will add sets lists and rc.d script soon.

Oked by agc@ and cube@.
 1.1  07-Jul-2008  haad branches: 1.1.2;
Add dmgetdefaultdisklabel to get virtual disklabel for Logical Volume device. Add snapshot targets (snapshot, snapshot-origin), add dm_type to dm_dev structure to identify type of device. e.g. we can have mirrored disk device with snapshot on them and spare disk on them. When driver want to work with snapshot devices, it looks to upcalls list and finds all DM_SNAPSHOT devices.
 1.1.2.20  05-Nov-2008  haad Fix copyright in TNF licenses.
 1.1.2.19  02-Nov-2008  haad Use typedef in all structures in dm driver and use them in source code.
No functional change expected.
 1.1.2.18  16-Oct-2008  haad Rewrite locking in dm driver for last time. Replace rwlock with mutex/cv.
Move table lists to separate structure called table_head and access them
through dm_table interface. Thx go@, rmind@ and Dusan Bernat for help and
suggestions.
 1.1.2.17  26-Sep-2008  haad Rework disklabel stuff once again, do not allocate nw disklabel struct
every time DIOCGPART is called. Recreate disklabel after resume so it
contains correct table. Do not leak device when I want to create device
with name which already exists.

XXX: dm_dev_resume_ioctl and dmgetdisklabel is broken I need to completly
rework locking here soon.
 1.1.2.16  11-Sep-2008  haad Add new dm_target_*_deps function which will get all dependiences from
selected target. It is used to get device dependencies during
dm_table_deps_ioctl. Remove dm_dev::pdevs list which was really hard to
manage and wasn't use for anything usefull.
 1.1.2.15  10-Sep-2008  haad Introduce new dm_dev_lookup and use it to lookup for device name, uuid and
minor number in device global list.
 1.1.2.14  08-Sep-2008  haad Add new version of snapshot code for nowonlyinitial configuration of
snapshots (parsing parameters strings and opening devices was added).

Fixonebug in dm_pdev where was one SLIST_ENTRY used to for global
pdev list and for per device pdev list. This bug was hidden for a
long time because I haven't used devices with more than one pdev.
 1.1.2.13  05-Sep-2008  haad Rework handling of disklabel stuff. Remove disklabel from dstruct dm_dev
and generate it dynamicaly for every call. Withthese changes using -F and
-s options when creating file-system with newfs is not needed anymore.
 1.1.2.12  03-Sep-2008  haad Simplify locking remove mutexes from pdev, target part of dm and only allow
one ioctl command to be in driver at time. Ioctl interface of dm device is
not performance critical so I don't need to paralelize dm driver so much.

Add new dev_type --> DM_DELETING_DEV which is set to device during
dm_device_remove_ioctl. To disable any incoming IO which will come in time
window between geting a rw_lock and removing device from global dev list.

XXX. I can't remove mutex from dm_dev.c also because dm_lookup_minor is
called from device-mapper and not from dm_ioctl.c
 1.1.2.11  28-Aug-2008  haad Add dm_pdev_lookup_name_list which is used to lookup pdev in device pdev list.

Add new reference counter to struct pdev which is used from device pdev list.
When pdev is inserted from target_init routine increment device pdev list ref_cnt
and remove pdev from list only when this ref. counter is 0.

Avoid problem when to tables with same device can remove pdev from this list.
 1.1.2.10  20-Aug-2008  haad Add initial portion of snapshot code. Divide snapshot code into 2 parts

snapshot-origin and snapshot

First target is used to inform all snapshots about writes to master device.
Snapshot targets implements exception store for changed blocks.

This is how linux does snapshots on lvm2 devices if we want to use lvm2tools,
for snapshots I have to keep this as much compatible as possible to linux.

Change atoi from static to public function now it can be used with other
targets, too.
 1.1.2.9  19-Aug-2008  haad Add dm_*_destroy functions and change type of argument in dm_pdev_decr.
 1.1.2.8  19-Aug-2008  haad Add $NetBSD$ tag to all dm driver sources.
 1.1.2.7  02-Aug-2008  haad Add status functions for zero, error targets these routines are not needed
here, but I want to be consistent (I already define dm_target_*_init).
 1.1.2.6  28-Jul-2008  haad Add basic synchronization between dmstrategy routine and ioctl functions.
Dmstrategy locks, per dev rwlock for reading and all struct dm_dev changing
routines in dm_ioctl(such as dm_table_resume_ioctl, dm_dev_remove_ioctl),
have to lock it for writing.
Modify comments and ad description to each function about locking which
I think should be used there. I want to use mutex for synchronization of
different ioctl calls on same device. e.g. we can't remove table from
inactive slot when there is dm_table_status_ioctl runnning.
 1.1.2.5  28-Jul-2008  haad Add status function to targets. This function is called from dm_table_status_ioctl,
when DM_STATUS_TABLE_FLAG is specified and it's purpose is construct params string.
Which can be sent back to libdevmapper.

Add adding removing of the DM_SUSPENDED_FLAG flag in dm_dev_suspend/resume ioctls.
 1.1.2.4  22-Jul-2008  haad Change parsing of parameter string. Remove knowledge about pramaer string
from dm_table_load_ioctl and move it to target_init routines. Parameter
string is targets specific and therefore only target routine know how to
parse it correctly. Remove unneeded parameter from dm_target_*_init(argc)
and change dm target routines accordingly.

Simplify dm_table_load_ioctl and move pdev inserting code to target init
funstions.
 1.1.2.3  19-Jul-2008  haad *** empty log message ***
 1.1.2.2  11-Jul-2008  haad KNFize my sources add space after comma in function parameters.
Wrap to 80 chars per line.
 1.1.2.1  07-Jul-2008  haad Import of device-mapper driver. This driver is BSD rewrite of linux dm driver.
For now only error, linear and zero targets are supported. This driver uses NetBSD
specific ioctl protocola based on proplib.

I was able to create logical volume (with lvm2tools lvcreate utility) with this
version of driver, newfs it and mount it.
 1.8.6.2  23-Jul-2009  jym Sync with HEAD.
 1.8.6.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.4.4  28-Apr-2009  skrll Sync with HEAD.
 1.8.4.3  03-Mar-2009  skrll Sync with HEAD.
 1.8.4.2  19-Jan-2009  skrll Sync with HEAD.
 1.8.4.1  16-Jan-2009  skrll file dm.h was added on branch nick-hppapmap on 2009-01-19 13:17:52 +0000
 1.8.2.2  17-Jan-2009  mjf Sync with HEAD.
 1.8.2.1  16-Jan-2009  mjf file dm.h was added on branch mjf-devfs2 on 2009-01-17 13:28:53 +0000
 1.12.2.5  11-Aug-2010  yamt sync with head.
 1.12.2.4  11-Mar-2010  yamt sync with head
 1.12.2.3  20-Jun-2009  yamt sync with head
 1.12.2.2  04-May-2009  yamt sync with head.
 1.12.2.1  25-Mar-2009  yamt file dm.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:36 +0000
 1.17.4.2  05-Mar-2011  rmind sync with head
 1.17.4.1  30-May-2010  rmind sync with head
 1.17.2.2  06-Nov-2010  uebayasi Sync with HEAD.
 1.17.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.23.2.2  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.23.2.1  30-Oct-2012  yamt sync with head
 1.24.4.1  18-May-2014  rmind sync with head
 1.24.2.2  03-Dec-2017  jdolecek update from HEAD
 1.24.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.2.1  10-Aug-2014  tls Rebase.
 1.27.20.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.54.2.1  25-Jan-2020  ad Sync with head.

RSS XML Feed