Home | History | Annotate | Download | only in dm
History log of /src/sys/dev/dm/dm_target_linear.c
RevisionDateAuthorComments
 1.37  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.36  28-Dec-2019  tkusumi branches: 1.36.2;
dm: Fix typo in comment dklinear -> linear
 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  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.33  18-Dec-2019  tkusumi dm: Test # of args in target's ->init()

The # of args is part of target's spec.
Both Linux kernel and DragonFlyBSD test argc on ctr/init.
 1.32  15-Dec-2019  tkusumi dm: Rename dm specific atoi() to atoi64()

This is uint64_t version, not sys/lib/libsa/atoi.c.
 1.31  15-Dec-2019  tkusumi dm: Style cleanups (no functional changes)
 1.30  15-Dec-2019  tkusumi dm: "unsigned" -> "unsigned int" for consistency

Use either one, but not both.
 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 unconditional debug prints in targets' ->strategy()

Having debug prints in ->strategy() by default just to tell ->strategy()
is called is overkill.
taken-from: DragonFlyBSD
 1.27  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.26  09-Dec-2019  tkusumi dm: Silence aprint_normal() in dm_target_linear_status()

dm_target_linear_status() shouldn't print this debug message by default
on dmsetup "table" ioctl/command.
 1.25  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.24  07-Dec-2019  tkusumi dm: Fix strange pointer declarations

Should be "type *name" or "type* name", but not "type * name".
taken-from: DragonFlyBSD
 1.23  06-Dec-2019  tkusumi dm: Remove trailing whitespace
 1.22  05-Dec-2019  tkusumi dm: Make dm core set config to NULL after destroy

Just let dm core do this instead of having a comment expecting each
target to do the right thing.

taken-from: DragonFlyBSD
 1.21  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.20  02-Dec-2019  tkusumi dm: Remove misleading comment on linear target arg

The offset arg is mandatory.
Remove code and comment that makes it sounds like it's optional.

taken-from: DragonFlyBSD
 1.19  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.18  15-Oct-2019  chs convert more KM_NOSLEEP to KM_SLEEP and remove code to handle failures.
 1.17  05-Jan-2018  christos branches: 1.17.4;
PR/52900: Tomohiro Kusumi: Fix kernel panic when target's ->init() failed
Reliably unbusy the target in the *all* the destroy routines, so ioctl
does not need to do it.
 1.16  04-Jun-2017  mbalmer more dependiences -> dependencies
 1.15  01-Jun-2017  chs 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.14  14-Jun-2014  hannken branches: 1.14.4;
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.13  14-Oct-2011  hannken branches: 1.13.12; 1.13.26;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.12  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.11  15-Nov-2010  uebayasi curlwp needs sys/lwp.h.
 1.10  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.9  04-Jan-2010  haad branches: 1.9.2; 1.9.4;
Indent files remove unnecessary blank lines, white spaces and KNFize code.
 1.8  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.7  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.6  16-Aug-2009  yamt fix a comment typo.
 1.5  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.4  01-Mar-2009  haad branches: 1.4.2;
Linear target has only 2 arguments in a params string not 9.
 1.3  19-Dec-2008  haad branches: 1.3.2; 1.3.4; 1.3.6;
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  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.19  05-Nov-2008  haad Fix copyright in TNF licenses.
 1.1.2.18  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.17  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.16  22-Sep-2008  haad Fix bug where I tried to prop_object_release null object which caused weird
atuvm panic. Change init functions to failed when they receive params string
== NULL when they need some data.
 1.1.2.15  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.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  03-Sep-2008  haad Remove unneeded includes.
 1.1.2.12  28-Aug-2008  haad Fix pdev manipulation in init, destroy routines. In destroy routine remove
pdev from device list only if it is not referenced from other tables too.
 1.1.2.11  20-Aug-2008  haad For pdevs located in target_config areas, decrement reference counts during
dm_target_*_destroy call. Remove these pdevs from device 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 Remove unnecessary call of dm_pdev_rem in dm_table_load. Change dm_dev_remove
to call dm_pdev_decr for all devices in pdev list.

Because target config contains pdevs I have to decrement them in
dm_target_*_destroy.
 1.1.2.8  19-Aug-2008  haad Add $NetBSD$ tag to all dm driver sources.
 1.1.2.7  02-Aug-2008  haad After dm_target_*_destroy set table_en->target_config to NULL.
 1.1.2.6  29-Jul-2008  haad Change comment in dm_table_destroy and dm-target_linear_init.
These functions should be called with per device mutex held.
 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.3.6.2  23-Jul-2009  jym Sync with HEAD.
 1.3.6.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.4.4  28-Apr-2009  skrll Sync with HEAD.
 1.3.4.3  03-Mar-2009  skrll Sync with HEAD.
 1.3.4.2  19-Jan-2009  skrll Sync with HEAD.
 1.3.4.1  19-Dec-2008  skrll file dm_target_linear.c was added on branch nick-hppapmap on 2009-01-19 13:17:53 +0000
 1.3.2.2  17-Jan-2009  mjf Sync with HEAD.
 1.3.2.1  19-Dec-2008  mjf file dm_target_linear.c was added on branch mjf-devfs2 on 2009-01-17 13:28:53 +0000
 1.4.2.7  11-Aug-2010  yamt sync with head.
 1.4.2.6  11-Mar-2010  yamt sync with head
 1.4.2.5  16-Sep-2009  yamt sync with head
 1.4.2.4  19-Aug-2009  yamt sync with head.
 1.4.2.3  20-Jun-2009  yamt sync with head
 1.4.2.2  04-May-2009  yamt sync with head.
 1.4.2.1  01-Mar-2009  yamt file dm_target_linear.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:36 +0000
 1.9.4.2  05-Mar-2011  rmind sync with head
 1.9.4.1  30-May-2010  rmind sync with head
 1.9.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.13.26.1  10-Aug-2014  tls Rebase.
 1.13.12.2  03-Dec-2017  jdolecek update from HEAD
 1.13.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.4.1  28-Aug-2017  skrll Sync with HEAD
 1.17.4.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.36.2.1  25-Jan-2020  ad Sync with head.

RSS XML Feed