dm-thinp: new device mapper target to thin provision storage
Subsystems (3)
PATCH 1/1 dm-thinp: new device mapper target to thin provision storage
These are 2 new device mapper targets "thinp" and "thinp-dev" implemented in one module, which allow for thin provisioning of storage on a single host from a storage pool to an arbitrary amount of devices.
Storage is being late committed on writes in units of extents which can be sized at pool creation time (typically relatively large like 1/2 GB to minimize allocation overhead). The pool can be resized to adjust to varying needs. Any allocated extents are being freed when a device shrinks, thus being subject to allocation by other thin provisioned devices allocating from the same pool.
The status interface provides information about pool and device allocation. Device-mapper table events are being thrown when pool is running full or on io errors.
Please read Documentation/device-mapper/thinp.txt for how to use it.
Documentation/device-mapper/thinp.txt | 86 + drivers/md/Kconfig | 7 + drivers/md/Makefile | 1 + drivers/md/dm-thinp.c | 3424 +++++++++++++++++++++++++++++++++ 4 files changed, 3518 insertions(+), 0 deletions(-)
Documentation/device-mapper/thinp.txt new file +86 -0
@@ -0,0 +1,86 @@ +Device-mapper thin provisioning support +======================================= + +Allows you to: + +- create a pool of extents to allocate to an arbitray + amount of devices on write requests. +- create devices and bind them to a thin provisioning pool + for late allocation.on writes +- grow (and shrink) the pool on the fly in case it runs + full or is too large. + + +There are two dm targets available: "thinp" and "thinp-dev". + +thinp <pool_dev_path> <pool_dev_start> <#varible_params> [<params>...] + +which will normally have one or more thinp provisioned devices based on it. +Any writes to any of the thin provisioned devices trigger the allocation +of extents from the pool and mapping them to the address space the write +occured to. + +"thinp" parameter syntax as follows: + * + * #variable_params = 0-2 + * + * params = {auto/create/open} [#pool_extent_size [policy]] + * + * 'auto' causes open of a pool with a valid header or + * creation of a new pool if there's no vaild one sized to ti->len. + * + * 'create' enforces creation of a new pool with length ti->len + * WARNING: this overwrites an existing pool!!! + * + * 'open' requires a valid pool to exist. No new one will be + * created ever. + * + * #variable_params: + * 0: the pool device must exist and will be opened or the constructor fails + * 1 + 'open': equal to '0' + * 1 + 'auto': open existing pool or create new one with length ti->len; + * implies resizing of an existing pool if ti->len differs + * from pool size in header + * 1 + 'create': the pool device will get initialized and sized to ti->len + * 2 + 'auto': the pool device will either be opened and tried to resize + * or get initialized and sized to ti->lem setting the extent + * size to pool_extent_size + * 3: on create (either implicit or via 'auto'), + * this pool_extent_size will be used. + * 4: policy = "error|postpone" defaults to postpone: + * if pool runs full, bios will be errored or postponed + * (ie. application writes will stall + +thinp-dev <pool_device> <device_nr> + +Creates a thin provisioned device and binds it to the pool internal <device_nr>. + +When tearing down a thin provisioned device, it is impossible to tell if +it's meant transient (eg. on LVM VG deactivation in order to recreate the +mapping on VG activation again) or persistent (ie. remove the device +permanently and free any allocated extents). Thus a message is supported +for the later case of permanently removing the thin provisioned device. + +Message format: + +remove_device <device_nr> + + +Examples: + +Create an 8GB large thinp provisioning pool with extent size 1MB: +echo "0 16777216 thinp 0 2 auto 2048" | dmsetup create thinp_pool + +Create an 1TB large thinp provisioned device with internal #1: +echo "0 2147483648 thinp-dev thinp_pool 1" | dmsetup create thinp1 + +Create an ext4 filesystem on the thin provisioned device: +mkfs -t ext4 /dev/mapper/thinp1 + +Retrieve status of pool and thin provisioned device: +dmsetup status thinp_pool +dmsetup status thinp1 + +Drop device #1: +dmsetup remove thinp1 +dmsetup message thinp_pool remove_device 1
drivers/md/Kconfig +7 -0
@@ -297,6 +297,13 @@ config DM_DELAY If unsure, say N. +config DM_THINP + tristate "Thin provisioning target (EXPERIMENTAL)" + depends on BLK_DEV_DM && EXPERIMENTAL + ---help--- + A target that supports thin provisioning storage capacity + from a large storage pool to multiple devices. + config DM_UEVENT bool "DM uevents (EXPERIMENTAL)" depends on BLK_DEV_DM && EXPERIMENTAL
drivers/md/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o obj-$(CONFIG_DM_MIRROR) += dm-mirror.o dm-log.o dm-region-hash.o obj-$(CONFIG_DM_LOG_USERSPACE) += dm-log-userspace.o obj-$(CONFIG_DM_ZERO) += dm-zero.o +obj-$(CONFIG_DM_THINP) += dm-thinp.o ifeq ($(CONFIG_DM_UEVENT),y) dm-mod-objs += dm-uevent.o
drivers/md/dm-thinp.c new file +3424 -0
2,894 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 4 lines · Heinz Mauelshagen
These are 2 new device mapper targets "thinp" and "thinp-dev" implemented in one module, which allow for thin provisioning of storage on a single host from a storage pool to an arbitrary amount of devices.
How is this different than snapshotting a zero target?
Documentation/device-mapper/thinp.txt line 78
Quoted 2 lines
Documentation/device-mapper/thinp.txt new file +2
-0+Create an ext4 filesystem on the thin provisioned device: +mkfs -t ext4 /dev/mapper/thinp1
FYI, that tends to spend a lot of time writing hundreds of mb of zeros to the inode tables, allocating chunks from the backing store. You might want to add -E lazy_itable_init to stop that.
Quoted 7 lines · Phillip Susi
Quoted 3 lines · Heinz Mauelshagen
These are 2 new device mapper targets "thinp" and "thinp-dev" implemented in one module, which allow for thin provisioning of storage on a single host from a storage pool to an arbitrary amount of devices.
How is this different than snapshotting a zero target?
Main difference is that you actually can free up space. You can't with snapshotting as then a rollback becomes impossible.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg)
Quoted 7 lines · Phillip Susi
Quoted 4 lines · Heinz Mauelshagen
These are 2 new device mapper targets "thinp" and "thinp-dev" implemented in one module, which allow for thin provisioning of storage on a single host from a storage pool to an arbitrary amount of devices.
How is this different than snapshotting a zero target?
Like Hanness mentioned: you can free space.
Quoted 7 lines
Documentation/device-mapper/thinp.txt line 78
Quoted 3 lines
Documentation/device-mapper/thinp.txt new file +2
-0+Create an ext4 filesystem on the thin provisioned device: +mkfs -t ext4 /dev/mapper/thinp1FYI, that tends to spend a lot of time writing hundreds of mb of zeros to the inode tables, allocating chunks from the backing store. You might want to add -E
lazy_itable_initto stop that.
Thanks for the hint, I waned to have load on the thin provisioned devices so far for testing but will have a look at the reduced allocations with this option.
Quoted 5 lines
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 6 lines · Hannes Reinecke
Quoted 5 lines · Phillip Susi
Quoted 3 lines · Heinz Mauelshagen
These are 2 new device mapper targets "thinp" and "thinp-dev" implemented in one module, which allow for thin provisioning of storage on a single host from a storage pool to an arbitrary amount of devices.
Quoted 6 lines
Quoted 2 lines
How is this different than snapshotting a zero target?
Main difference is that you actually can free up space. You can't with snapshotting as then a rollback becomes impossible.
Yes, that's right.
Heinz
Quoted 3 lines
Cheers,
Hannes
Quoted 4 lines · Heinz Mauelshagen
Quoted 1 line · Phillip Susi
How is this different than snapshotting a zero target?
Like Hanness mentioned: you can free space.
Could you clarify that a bit? Is space only freed if you reduce the length of a device? You can't do the same with a snapshot?
Quoted 8 lines · Phillip Susi
Quoted 4 lines · Heinz Mauelshagen
Quoted 1 line · Phillip Susi
How is this different than snapshotting a zero target?
Like Hanness mentioned: you can free space.
Could you clarify that a bit? Is space only freed if you reduce the length of a device? You can't do the same with a snapshot?
Not just when you shrink a device, you can release all allocations to an inactive thin provisioned device as well.
With snapshots the exception store is dropped when you delete the snapshot as well.
But you can't drop allocated space of a partial exception store because the exception size is much smaller than the allocation units lvm2 goes by (ie. extents sized 128MB). Thus dropping exceptions related to a now past EOD segment within the origin just gives you stale exceptions in the table w/o the option to reduce allocated space.
Quoted 5 lines
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel