brintos

brintos / linux-shallow public Read only

0
0
Text · 2.9 KiB · 2065c3c Raw
89 lines · plain
1===============2Persistent data3===============4 5Introduction6============7 8The more-sophisticated device-mapper targets require complex metadata9that is managed in kernel.  In late 2010 we were seeing that various10different targets were rolling their own data structures, for example:11 12- Mikulas Patocka's multisnap implementation13- Heinz Mauelshagen's thin provisioning target14- Another btree-based caching target posted to dm-devel15- Another multi-snapshot target based on a design of Daniel Phillips16 17Maintaining these data structures takes a lot of work, so if possible18we'd like to reduce the number.19 20The persistent-data library is an attempt to provide a re-usable21framework for people who want to store metadata in device-mapper22targets.  It's currently used by the thin-provisioning target and an23upcoming hierarchical storage target.24 25Overview26========27 28The main documentation is in the header files which can all be found29under drivers/md/persistent-data.30 31The block manager32-----------------33 34dm-block-manager.[hc]35 36This provides access to the data on disk in fixed sized-blocks.  There37is a read/write locking interface to prevent concurrent accesses, and38keep data that is being used in the cache.39 40Clients of persistent-data are unlikely to use this directly.41 42The transaction manager43-----------------------44 45dm-transaction-manager.[hc]46 47This restricts access to blocks and enforces copy-on-write semantics.48The only way you can get hold of a writable block through the49transaction manager is by shadowing an existing block (ie. doing50copy-on-write) or allocating a fresh one.  Shadowing is elided within51the same transaction so performance is reasonable.  The commit method52ensures that all data is flushed before it writes the superblock.53On power failure your metadata will be as it was when last committed.54 55The Space Maps56--------------57 58dm-space-map.h59dm-space-map-metadata.[hc]60dm-space-map-disk.[hc]61 62On-disk data structures that keep track of reference counts of blocks.63Also acts as the allocator of new blocks.  Currently two64implementations: a simpler one for managing blocks on a different65device (eg. thinly-provisioned data blocks); and one for managing66the metadata space.  The latter is complicated by the need to store67its own data within the space it's managing.68 69The data structures70-------------------71 72dm-btree.[hc]73dm-btree-remove.c74dm-btree-spine.c75dm-btree-internal.h76 77Currently there is only one data structure, a hierarchical btree.78There are plans to add more.  For example, something with an79array-like interface would see a lot of use.80 81The btree is 'hierarchical' in that you can define it to be composed82of nested btrees, and take multiple keys.  For example, the83thin-provisioning target uses a btree with two levels of nesting.84The first maps a device id to a mapping tree, and that in turn maps a85virtual block to a physical block.86 87Values stored in the btrees can have arbitrary size.  Keys are always8864bits, although nesting allows you to use multiple keys.89