summaryrefslogtreecommitdiff
path: root/lib/cache_segtype
Commit message (Collapse)AuthorAgeFilesLines
* gcc: remove invalid attributeZdenek Kabelac2021-09-131-1/+1
| | | | In this function parameter 'attribute' is used.
* cache: filter out unsupported policy settingsZdenek Kabelac2021-09-131-1/+59
| | | | | | | | | | | | | Loading invalid MQ/SMQ policy settings table line cause immediate rejection - to prevent such failure, automatically filter valid settins before it is being uploaded by lvm2. For invalid setting issue a warnning informing user how to remove them. This solution is used to keep running cached LVs that might had been created in the past with invalid settings that have been actually unused due to another code bug.
* cachevol: move flag setting after taking archiveZdenek Kabelac2019-10-171-3/+4
| | | | | | | | Before 'archive()' is called, lvm2 must not touch/modify metadata. So move setting CACHE_VOL related flags past this point. Also make sure reading of cache segtype always restores this flag properly (even if compatible flag would be lost).
* cachevol: use CVOL UUID for cdata and cmeta layered devicesZdenek Kabelac2019-10-171-18/+30
| | | | | | | | | | | | | | | | Since code is using -cdata and -cmeta UUID suffixes, it does not need any new 'extra' ID to be generated and stored in metadata. Since introduce of new 'segtype' cache+CACHE_USES_CACHEVOL we can safely assume 'new' cache with cachevol will now be created without extra metadata_id and data_id in metadata. For backward compatibility, code still reads them in case older version of metadata have them - so it still should be able to activate such volumes. Bonus is lowered size of lv structure used to store info about LV (noticable with big volume groups).
* cachevol: add dm uuid suffixes to hidden lvsDavid Teigland2019-09-201-2/+2
| | | | to indicate they are private lvm devs
* Use "cachevol" to refer to cache on a single LVDavid Teigland2019-02-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | and "cachepool" to refer to a cache on a cache pool object. The problem was that the --cachepool option was being used to refer to both a cache pool object, and to a standard LV used for caching. This could be somewhat confusing, and it made it less clear when each kind would be used. By separating them, it's clear when a cachepool or a cachevol should be used. Previously: - lvm would use the cache pool approach when the user passed a cache-pool LV to the --cachepool option. - lvm would use the cache vol approach when the user passed a standard LV in the --cachepool option. Now: - lvm will always use the cache pool approach when the user uses the --cachepool option. - lvm will always use the cache vol approach when the user uses the --cachevol option.
* Allow dm-cache cache device to be standard LVDavid Teigland2018-11-061-12/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a single, standard LV is specified as the cache, use it directly instead of converting it into a cache-pool object with two separate LVs (for data and metadata). With a single LV as the cache, lvm will use blocks at the beginning for metadata, and the rest for data. Separate dm linear devices are set up to point at the metadata and data areas of the LV. These dm devs are given to the dm-cache target to use. The single LV cache cannot be resized without recreating it. If the --poolmetadata option is used to specify an LV for metadata, then a cache pool will be created (with separate LVs for data and metadata.) Usage: $ lvcreate -n main -L 128M vg /dev/loop0 $ lvcreate -n fast -L 64M vg /dev/loop1 $ lvs -a vg LV VG Attr LSize Type Devices main vg -wi-a----- 128.00m linear /dev/loop0(0) fast vg -wi-a----- 64.00m linear /dev/loop1(0) $ lvconvert --type cache --cachepool fast vg/main $ lvs -a vg LV VG Attr LSize Origin Pool Type Devices [fast] vg Cwi---C--- 64.00m linear /dev/loop1(0) main vg Cwi---C--- 128.00m [main_corig] [fast] cache main_corig(0) [main_corig] vg owi---C--- 128.00m linear /dev/loop0(0) $ lvchange -ay vg/main $ dmsetup ls vg-fast_cdata (253:4) vg-fast_cmeta (253:5) vg-main_corig (253:6) vg-main (253:24) vg-fast (253:3) $ dmsetup table vg-fast_cdata: 0 98304 linear 253:3 32768 vg-fast_cmeta: 0 32768 linear 253:3 0 vg-main_corig: 0 262144 linear 7:0 2048 vg-main: 0 262144 cache 253:5 253:4 253:6 128 2 metadata2 writethrough mq 0 vg-fast: 0 131072 linear 7:1 2048 $ lvchange -an vg/min $ lvconvert --splitcache vg/main $ lvs -a vg LV VG Attr LSize Type Devices fast vg -wi------- 64.00m linear /dev/loop1(0) main vg -wi------- 128.00m linear /dev/loop0(0)
* cache: rename variable in _cache_add_target_lineDavid Teigland2018-11-061-5/+11
| | | | so it is not specific to lv/seg type
* cache: rename variable in _cache_displayDavid Teigland2018-11-061-11/+18
| | | | so it is not specific to lv/seg type
* cache: factor settings text import exportDavid Teigland2018-11-061-53/+77
| | | | | Pull out the export/import of settings text so it can be used later from elsewhere.
* Merge branch '2018-06-04-data-structs'Joe Thornber2018-06-081-3/+4
|\
| * device_mapper: remove dbg_malloc.Joe Thornber2018-06-081-3/+4
| | | | | | | | | | I wrote dbg_malloc before we had valgrind. These days there's just no need.
* | build: drop exported symbolsZdenek Kabelac2018-06-081-1/+0
|/ | | | | This libs are no longer possible to create, drop maintanence of exported symbols.
* build: Don't generate symlinks in include/ dirJoe Thornber2018-05-141-12/+12
| | | | | | | As we start refactoring the code to break dependencies (see doc/refactoring.txt), I want us to use full paths in the includes (eg, #include "base/data-struct/list.h"). This makes it more obvious when we're breaking abstraction boundaries, eg, including a file in metadata/ from base/
* build: remove --with-{snapshots,mirrors,raid,thin,cache} options from ↵Joe Thornber2018-04-301-24/+0
| | | | | | ./configure It now behaves as if the were all set as 'internal'
* cache: fix lvdisplay outputZdenek Kabelac2017-06-221-3/+9
| | | | | Unused cache pool may have lots of fields actually undefined, so avoid printing them, if they are not specified in metadata.
* cache: fix lvdisplay --mapsZdenek Kabelac2017-06-221-1/+2
| | | | | | | | | 'lvdisplay -m' tried to go through NULL policy settings, when such policy was not defined for CachedLV. Patch is fixing display of cache-pool without defined settings, as this is now a valid pool and we mostly want users to define these settings when actually really caching a LV.
* cache: scan kallsyms for kernel symbolsZdenek Kabelac2017-03-311-5/+40
| | | | | | | | | | | | With monolithic kernels we can't actually modprobe for cache modules as they are already compiled-in and policy modules do not export version symbol. Reported issue on list: https://www.redhat.com/archives/dm-devel/2017-March/msg00061.html Fix will try to look for explicit kernel symbols first before calling modprobe.
* cache: enhance lvdisplay for cache volumesZdenek Kabelac2017-03-101-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Better support for lvdisplay. By default info about running (in kernel) cache status is printed. To get 'segtype' info, user runs: 'lvdisplay -m', example: --- Logical volume --- LV Path /dev/vg/lvol0 LV Name lvol0 VG Name vg LV UUID Y4uWuN-TBGk-duer-aPWl-yBWn-iFFR-RU1gg1 LV Write Access read/write LV Creation host, time linux, 2017-03-01 20:52:39 +0100 LV Cache pool name lvol2 LV Cache origin name lvol0_corig LV Status available # open 0 LV Size 12,00 MiB Cache used blocks 10,42% Cache metadata blocks 0,49% Cache dirty blocks 0,00% Cache read hits/misses 112 / 34 Cache wrt hits/misses 133 / 0 Cache demotions 0 Cache promotions 20 Current LE 3 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Segments --- Logical extents 0 to 2: Type cache Chunk size 64,00 KiB Metadata format 1 Mode writethrough Policy smq Setting migration_threshold=100000
* cache: use DM_CACHE_FEATURE_METADATA2 with libdmZdenek Kabelac2017-03-101-0/+21
| | | | | Call libdm with new feature flag when metadata format 2 is selected and available in kernel cache target.
* cache: LV supports cache segs with metadata formatZdenek Kabelac2017-03-101-0/+35
| | | | | | | | | | | | | | | Cache pool read/writes metadata_format within its segment type.. For CachePoolLV unselected metadata format is NOT stored in metadata. For CacheLV when metadata format is not present/selected in lvm2 metadata, it's automatically assumed to be the version 1 (backward compatible). To ensure older lvm2 will not 'miss-read' metadata with new version 2, such LV is marked with METADATA_FORMAT status flag (segment is specifying metadata format). So when cache uses metadata format 2, it will become inaccesible on older system without such support. (kernel dm cache < 1.10, lvm2 < 2.02.169).
* cache: introduce allocation/cache_metadata_formatZdenek Kabelac2017-03-101-0/+11
| | | | | | | | | | | | | Add new profilable configation setting to let user select which metadata format of a created cache pool he wish to use. By default the 'best' available format is autodetected at runtime, but user may enforce format 1 or 2 ATM. Code also detects availability for metadata2 supporting cache target. In case of troubles user may easily Disable usage of this feature by placing 'metadata2' into global/cache_disabled_features list.
* cache: use UNSELECTED enumZdenek Kabelac2017-03-101-2/+2
| | | | | Switch from _UNDEFINED to _UNSELECTED which is more describing its value 0, while value -1 is better match for UNDEFINED.
* lvchange: allow change of cache modeZdenek Kabelac2016-05-191-21/+40
| | | | | | | | Add support for active cache LV. Handle --cachemode args validation during command line processing. Rework some lvm2 internal to use lvm2 defined CACHE_MODE enums indepently on libdm defines and use enum around the code instead of passing and comparing strings.
* cleanup: drop tracingZdenek Kabelac2016-05-061-1/+1
| | | | When activation is disabled, avoid tracing it in cache target.
* debug: enhance debug msg for cacheZdenek Kabelac2016-05-051-8/+12
|
* cache: use target_present_versionZdenek Kabelac2016-05-051-5/+3
| | | | | Using new function. Also add trace for error path.
* cache: better support for alias checkZdenek Kabelac2016-04-271-4/+6
| | | | | | To still support disabling of policies for test we need better logic for alias detection introduced in 588455d03ea40ffa37f466023691b0ec2bdf5e82.
* cache: with cache target 1.9 mq is alias to smqZdenek Kabelac2016-04-261-2/+5
| | | | | Avoid useless check for mq policy, it's loaded as smq and aliased.
* activate: Use macros for target and module names.Alasdair G Kergon2016-03-221-3/+3
|
* metadata: add support for interconnection of thin pool LV segment with ↵Peter Rajnoha2016-03-031-1/+1
| | | | | | | | indirect origin Add support for making an interconnection between thin LV segment and its indirect origin (which may be historical or live LV) - add a new "indirect_origin" argument to attach_pool_lv function.
* doc: change fsf addressZdenek Kabelac2016-01-212-2/+2
| | | | | Hmm rpmlint suggest fsf is using a different address these days, so lets keep it up-to-date
* segtype: check for activationZdenek Kabelac2016-01-141-6/+8
| | | | | Before setting static variable with check passed state, detect if we are allowed to talk to driver.
* cache: handle older metadata formatZdenek Kabelac2015-11-161-0/+34
| | | | | | | | | | | | When reading older lvm2 metadata for cache-pool - we now handle more extended syntax - basically we want to enter most setting when actually creating cached LV. For this new validation code has been added. However older metadata without new settings set is now found as invalid. Fix it by adding default settings for cache policy mq and cache mode writethrough.
* segtypes: Use SEG_TYPE_NAME_ string constants.Alasdair G Kergon2015-09-221-2/+2
|
* cleanup: indentZdenek Kabelac2015-08-121-2/+2
|
* cache: add more validationZdenek Kabelac2015-08-121-0/+3
|
* cache: api updateZdenek Kabelac2015-08-121-27/+24
| | | | | | | | | | | | | | Change logic and naming of some internal API functions. cache_set_mode() and cache_set_policy() both take segment. cache mode is now correctly 'masked-in'. If the passed segment is 'cache' segment - it will automatically try to find 'defaults' according to profiles if the are NOT specified on command line or they are NOT already set for cache-pool. These defaults are never set for cache-pool.
* cache: undefined policy is mqZdenek Kabelac2015-08-121-1/+3
| | | | | If the policy_name is unspecified in metadata, it's automatically 'mq'.
* cache: detect smq policy presenceZdenek Kabelac2015-08-121-3/+70
| | | | | | | Add code to detect available cache features. Support policy_mq & policy_smq features which might be disabled. Introduce global_cache_disabled_features_CFG.
* cache: add cache_policy cache_settingsZdenek Kabelac2015-08-121-1/+1
| | | | | | | | | | | | | | Add new profilable configurables: allocation/cache_policy allocation/cache_settings and mark allocation/cache_pool_chunk_size as profilable as well. Obsolete allocation/cache_pool_cachemode and introduce new allocation/cache_mode instead. Rename DEFAULT_CACHE_POOL_POLICY to DEFAULT_CACHE_POLICY.
* cache: capture missing policy nameZdenek Kabelac2015-07-151-4/+12
| | | | | | | | Policy name has to be always defined. Capture it as an internal error before write. When reading metadata without defined policy name, use default defined policy. TODO: Unsure, but it might have to be actually always 'mq' in this case.
* debug: extra validation of passed segmentZdenek Kabelac2015-05-081-1/+8
| | | | | Always check if passed segment really is correct cache segment. (Avoids derefernce of possibly NULL seg->pool_lv).
* cache: use writethrough cache_mode for older metadataZdenek Kabelac2015-01-291-1/+3
| | | | | | | | | | When cache_mode is undefined, the read of metadata will miss to set a bit with mode and fails to process metadata on internal error: Internal error: LV vg/lvol1 has uknown feature flags 0. Fix it by setting it to writethrough mode.
* cleanup: remove unused headersZdenek Kabelac2014-11-131-1/+0
|
* pre-releasev2_02_112Alasdair G Kergon2014-11-111-1/+1
|
* libdm: still better APIZdenek Kabelac2014-11-111-14/+29
| | | | | | | | | | | | | | | | | Do not use 'any' policy name as a value in config tree - so we stick with 'policy_settings' and extra 'policy_name' for libdm params. Update lvm2 API as well. Example of supported metadata: policy = "mq" policy_settings { migration_threshold = 2048 sequential_threshold = 512 random_threshold = 4 read_promote_adjustment = 10 }
* cleanup: indents comments backtracesZdenek Kabelac2014-11-101-6/+5
|
* cleanup: use chunk_size directlyZdenek Kabelac2014-11-101-3/+1
|
* cache: use LV_PENDING_DELETEZdenek Kabelac2014-11-101-0/+2
|