Home | History | Annotate | Download | only in dm
History log of /src/sys/dev/dm/dm_target.c
RevisionDateAuthorComments
 1.42  21-Aug-2021  andvar fix typos in sys/dev/dm code comments and documentation.
also remove some trailing space in documentation.
 1.41  08-Jul-2020  thorpej Adapt to proplib API chanages.
 1.40  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.39  05-Jan-2020  tkusumi branches: 1.39.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.38  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.37  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.36  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.35  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.34  19-Dec-2019  tkusumi dm: u_{int,long} -> unsigned {int,long}
 1.33  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.32  15-Dec-2019  tkusumi dm: Style cleanups (no functional changes)
 1.31  15-Dec-2019  tkusumi dm: Make targets' ->sync() optional

Apparently some targets have nothing to sync, so make it optional.
 1.30  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.29  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.28  14-Dec-2019  tkusumi dm: Remove void casts of function calls

Use of void casts in dm is not consistent, just get rid of them.
 1.27  13-Dec-2019  tkusumi dm: Don't KASSERT() target handlers

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

Should be "type *name" or "type* name", but not "type * name".
taken-from: DragonFlyBSD
 1.24  07-Dec-2019  tkusumi dm: Simplify list eviction code

taken-from: DragonFlyBSD
 1.23  06-Dec-2019  tkusumi dm: Don't ignore dm_target_alloc() argument

dm_target_alloc() is supposed to be copying the name argument to its ->name.
taken-from: DragonFlyBSD
 1.22  04-Dec-2019  tkusumi dm: style + whitespace + indentation fixes

No functional changes.
 1.21  03-Dec-2019  tkusumi dm: Make global dm locks static

These are all per-file locks which protect dev/pdev/target structure.
taken-from: DragonFlyBSD
 1.20  05-Jan-2018  christos branches: 1.20.4;
use some size_t, add whitespace between functions, rcsids.
 1.19  18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.18  28-Aug-2011  ahoka branches: 1.18.12;
readd assertions noew with the correct struct
im wondering why the module cflags didnt warn about this obvious typo
 1.17  27-Aug-2011  joerg Revert last, assertions on undefined variables don't make sense.
 1.16  27-Aug-2011  ahoka Add a sanity check for missing functions in dmt
 1.15  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.14  21-Aug-2010  pgoyette Update the rest of the kernel to conform to the module subsystem's new
locking protocol.
 1.13  18-May-2010  haad Add support for DIOCCACHESYNC ioctl for dm devices. Add new sync function
pointer to dm_target_t because that is the only part of dm which know real
block device. disk_ioctl_switch parses whole device table and for every
entry it calls particular sync routine which propagates DIOCCACHESYNC
to real disk.

While I was here implement some KNF fixes and remove unneeded symbols from
dm.h.

Problem reported on port-xen@ by Hugo Silva.
 1.12  04-Jan-2010  haad branches: 1.12.2; 1.12.4;
Indent files remove unnecessary blank lines, white spaces and KNFize code.
 1.11  09-Sep-2009  haad Fix bug in kmem_alloc/kmem_free of params string. Params string was
allocated with length DM_MAX_PARAMS_SIZE and released with strlen + 1 size.

Disable KM_NOSLEEP allocation because we do not need them here there is
nothing critical in ioctl part of dm driver.

Bug reported by jak@.
 1.10  16-Aug-2009  yamt fix a comment typo.
 1.9  20-Feb-2009  haad branches: 1.9.2;
Call dm_target_busy only on properly autoloaded module.
 1.8  19-Feb-2009  haad In NetBSD our target modules are called with prefix dm_target_. Add this
prefix to target module name when loading module, lvm2tools uses linux
target names e.g. zero not dm_target_zero.
 1.7  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.6  02-Jan-2009  haad branches: 1.6.2; 1.6.4; 1.6.6;
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.17  03-Dec-2008  haad Fix several memory leaks in proplib library handling. Rework dm_cmd_to_fun
function to use prop_string_t.
 1.1.2.16  05-Nov-2008  haad Fix copyright in TNF licenses.
 1.1.2.15  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.14  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.13  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.12  08-Sep-2008  haad Fix comment in dm_table and change target alloc function suggested by rmind@.
 1.1.2.11  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.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_target_destroy and dm_dev_destroy functions these functions
are used to free all devices and targets. So I will not leak any memory
after kmod unload.
 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 routines and fix small overflow dmt was allocated as "zero" and
was user for a "error".
 1.1.2.6  29-Jul-2008  haad Fix dm_target_rem. Remove unneeded goto and use return directly.
 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  19-Jul-2008  haad Fix previous commit. device-mapper driver should build fine now.
 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.6.6.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.4.3  03-Mar-2009  skrll Sync with HEAD.
 1.6.4.2  19-Jan-2009  skrll Sync with HEAD.
 1.6.4.1  02-Jan-2009  skrll file dm_target.c was added on branch nick-hppapmap on 2009-01-19 13:17:53 +0000
 1.6.2.2  17-Jan-2009  mjf Sync with HEAD.
 1.6.2.1  02-Jan-2009  mjf file dm_target.c was added on branch mjf-devfs2 on 2009-01-17 13:28:53 +0000
 1.9.2.7  09-Oct-2010  yamt sync with head
 1.9.2.6  11-Aug-2010  yamt sync with head.
 1.9.2.5  11-Mar-2010  yamt sync with head
 1.9.2.4  16-Sep-2009  yamt sync with head
 1.9.2.3  19-Aug-2009  yamt sync with head.
 1.9.2.2  04-May-2009  yamt sync with head.
 1.9.2.1  20-Feb-2009  yamt file dm_target.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:36 +0000
 1.12.4.2  05-Mar-2011  rmind sync with head
 1.12.4.1  30-May-2010  rmind sync with head
 1.12.2.2  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.12.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.18.12.1  03-Dec-2017  jdolecek update from HEAD
 1.20.4.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.39.2.1  25-Jan-2020  ad Sync with head.

RSS XML Feed