1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

6453 Commits

Author SHA1 Message Date
Zdenek Kabelac
ca70dc4540 vdo: add lvs fields to query vdo volume properties
Add lots of vdo fields:

    vdo_operating_mode       - For vdo pools, its current operating mode.
    vdo_compression_state    - For vdo pools, whether compression is running.
    vdo_index_state          - For vdo pools, state of index for deduplication.
    vdo_used_size            - For vdo pools, currently used space.
    vdo_saving_percent       - For vdo pools, percentage of saved space.
    vdo_compression          - Set for compressed LV (vdopool).
    vdo_deduplication        - Set for deduplicated LV (vdopool).
    vdo_use_metadata_hints   - Use REQ_SYNC for writes (vdopool).
    vdo_minimum_io_size      - Minimum acceptable IO size (vdopool).
    vdo_block_map_cache_size - Allocated caching size (vdopool).
    vdo_block_map_era_length - Speed of cache writes (vdopool).
    vdo_use_sparse_index     - Sparse indexing (vdopool).
    vdo_index_memory_size    - Allocated indexing memory (vdopool).
    vdo_slab_size            - Increment size for growing (vdopool).
    vdo_ack_threads          - Acknowledging threads (vdopool).
    vdo_bio_threads          - IO submitting threads (vdopool).
    vdo_bio_rotation         - IO enqueue (vdopool).
    vdo_cpu_threads          - CPU threads for compression and hashing (vdopool).
    vdo_hash_zone_threads    - Threads for subdivide parts (vdopool).
    vdo_logical_threads      - Logical threads for subdivide parts (vdopool).
    vdo_physical_threads     - Physical threads for subdivide parts (vdopool).
    vdo_max_discard          - Maximum discard size volume can recieve (vdopool).
    vdo_write_policy         - Specified write policy (vdopool).
    vdo_header_size          - Header size at front of vdopool.

Previously only 'lvdisplay -m' was exposing them.
2019-10-04 17:31:55 +02:00
Zdenek Kabelac
862aa06e5e vdo: remember configure VDO write policy in metadata
Store write_policy in vdopool metadata.
In case it's not present 'auto' is selected.
2019-10-04 17:31:55 +02:00
Zdenek Kabelac
7ca9be034f vdo: field update 2019-10-04 17:31:55 +02:00
Zdenek Kabelac
cf8aee096f vdo: introduce get_vdo_write_policy_name 2019-10-04 17:31:55 +02:00
Zdenek Kabelac
c756f76802 vdo: correct internal API for set_vdo_write_policy
This is 'setting' function.
2019-10-04 17:31:55 +02:00
Zdenek Kabelac
9d8a028e8c vdo: keep minimum_io_size in sectors 2019-10-04 17:31:55 +02:00
Zdenek Kabelac
aad91330fe vdo: raise VDO default bio threads to 4
Since 'vdo create' tends to use this setting,
update lvm2 to provide same default.
2019-10-04 17:31:55 +02:00
Zdenek Kabelac
98419e0667 display: try to show status for inactive vdopool
Since we now support activation of 'vdo' volume
without explicit activation of 'vdopool' it's now possible
to have active layer vdopool (-vpool) volume and
having vdopool itself inactive - yet still in this
case we can show available stats for this volume.
But we need to show correct activation status and other
standard info.
2019-10-04 17:31:55 +02:00
Zdenek Kabelac
6a9a4b4534 resize: continue change for getting vdo status before resize
Continue commit a98b77c164.
There needs to be error reported when status can't be obtained.
2019-10-04 17:31:55 +02:00
Zdenek Kabelac
cb5f0bdba9 cache: report for succesful status 2019-10-04 17:31:55 +02:00
David Teigland
a68258339d lvmlockd: set failure flag for test mode
Set a failure flag when vg_read returns an error
for test mode.  The caller can segfault if there's
an error with no flag set.
2019-10-04 10:09:49 -05:00
David Teigland
f836fe3836 scan: use PV device name hint for choosing duplicate PV
Prefer a device if its name matches the PV device name hint.
2019-09-30 11:38:10 -05:00
David Teigland
4910a31f6d scan: use PV size for choosing duplicate PV
Prefer a device if it matches the size of the PV.
2019-09-30 11:38:10 -05:00
David Teigland
f3084ee2e5 scan: add PV summary info to lvmcache
Expand the lvmcache info that is saved by the scan to
include PV info from the metadata.
2019-09-30 11:38:10 -05:00
David Teigland
3a8e41a67b metadata: import device name hint from metadata
Start by using it in a comment for a missing PV.
2019-09-30 11:38:10 -05:00
David Teigland
fcfabb26a5 metadata: add args to metadata import functions
instead of getting them through fid arg
no functional change
2019-09-30 11:38:10 -05:00
Zdenek Kabelac
5c0264d689 vdo: restore monitoring of vdo pool
Switch to -vpool layered name needs to monitor proper device.
2019-09-30 13:34:34 +02:00
Zdenek Kabelac
a98b77c164 vdo: properly check percentage for resize
Avoid checking 'lv_is_active()' since special LV types does this
validation anyway what calling  _percent() function  and call it
ONLY when none of special types is queried.

This restores support for VDO resize (as with support for
separate VDO pool activation, plain query for lv_is_active()
is not working in this case).
2019-09-30 13:34:34 +02:00
Zdenek Kabelac
c813db8fc2 vdo: deactivate forgotten vdo pool
If the linear mapping is lost (for whatever reason, i.e.
test suite forcible  'dmsetup remove' linear LV,
lvm2 had hard times figuring out how to deactivate such DM table.

So add function which is in case inactive VDO pool LV checks if
the pool is actually still active (-vpool device present) and
it has open count == 0.  In this case deactivation is allowed
to continue and cleanup DM table.
2019-09-30 13:34:34 +02:00
David Teigland
26596ce7fa writecache: allow removing LV with attached writecache 2019-09-24 15:51:05 -05:00
David Teigland
76dd9b2b51 writecache: move code into new file
put writecache specific code in writecache_manip.c

should be no functional change
2019-09-24 15:51:05 -05:00
David Teigland
56aadd7fe2 lvremove: remove attached cachevol with removed LV
When an LV is removed that has an attached cachevol,
also remove the cachevol LV.
2019-09-24 15:51:05 -05:00
David Teigland
5191057d9d drop cvol dm uuid suffix for cachevol LVs
The "-cvol" suffix on the uuid is interfering with
activation code, so drop the suffix for now.
2019-09-23 14:13:31 -05:00
David Teigland
27c3c1d7c8 writecache: display layout and role fields 2019-09-20 14:55:11 -05:00
David Teigland
6f7d7089b4 writecache: use dm suffixes and lv attributes
- use internal CACHE_VOL flag on cachevol LV
- add suffixes to dm uuids for internal LVs
- display appropriate letters in the LV attr field
- display writecache's cachevol in lvs output
2019-09-20 14:08:51 -05:00
David Teigland
5d3bced5ea lvconvert: detaching cachevol with missing PVs
. For dm-cache in writethrough, always allow splitcache,
  whether the cache is missing PVs or not.

. For dm-cache in writeback, if the cache is missing PVs,
  allow splitcache with force and yes.

. For dm-writecache, if the cache is missing PVs,
  allow splitcache with force and yes.
2019-09-20 09:59:37 -05:00
David Teigland
515e37b6dd cachevol: add dm uuid suffixes to hidden lvs
to indicate they are private lvm devs
2019-09-20 09:59:37 -05:00
David Teigland
d2c065789c lvconvert: cachevol LV can have multiple segments 2019-09-20 09:59:37 -05:00
Zdenek Kabelac
6612d8dd5e vdo: enhance activation with layer -vpool
Enhance 'activation' experience for VDO pool to more closely match
what happens for thin-pools where we do use a 'fake' LV to keep pool
running even when no thinLVs are active. This gives user a choice
whether he want to keep thin-pool running (wihout possibly lenghty
activation/deactivation process)

As we do plan to support multple VDO LVs to be mapped into a single VDO,
we want to give user same experience and 'use-patter' as with thin-pools.

This patch gives option to activate VDO pool only without activating
VDO LV.

Also due to 'fake' layering LV we can protect usage of VDO pool from
command like 'mkfs' which do require exlusive access to the volume,
which is no longer possible.

Note: VDO pool contains 1024 initial sectors as 'empty' header - such
header is also exposed in layered LV (as read-only LV).
For blkid we are indentified as LV with UUID suffix - thus private DM
device of lvm2 - so we do not need to store any extra info in this
header space (aka zero is good enough).
2019-09-17 13:17:19 +02:00
Zdenek Kabelac
66f69e766e thin: activate layer pool aas read-only LV
When lvm2 is activating layered pool LV (to basically keep pool opened,
the other function used to be 'locking' be in sync with DM table)
use this LV in read-only mode - this prevents 'write' access into
data volume content of thin-pool.

Note: since EMPTY/unused thin-pool is created as 'public LV' for generic
use by any user who i.e. wish to maintain thin-pool and thins himself.
At this moment, thin-pool appears as writable LV.  As soon as the 1st.
thinLV is created, layer volume will appear is 'read-only' LV from this moment.
2019-09-17 13:16:50 +02:00
Zdenek Kabelac
693215716b devices: crypto skip
Devices with UUID signature CRYPT-SUBDEV are internal crypto devices.
2019-09-17 13:15:22 +02:00
David Teigland
fcbffbdbc0 bcache: change log level for prefetch message
The "new new blocks" message was printed as an error
but it's not an error condition.
2019-09-03 12:02:09 -05:00
David Teigland
25b58310e3 pvscan: avoid full scan for activation
When an online PV completed a VG, the standard
activation functions were used to activate the VG.
These functions use a full scan of all devs.
When many pvscans are run during startup and need
to activate many VGs, scanning all devs from all
the pvscans can take a long time.

Optimize VG activation in pvscan to scan only the
devs in the VG being activated.  This makes use of
the online file info that was used to determine
the VG was complete.

The downside of this approach is that pvscan activation
will not detect duplicate PVs and block activation,
where a normal activation command (which scans all
devices) would.
2019-09-03 10:11:16 -05:00
David Teigland
98d420200e vgextend: check missing device during block size check
Checking the block size when a device is missing could
trigger a segfault.
2019-09-03 10:07:56 -05:00
David Teigland
7cfbf3a394 fix segfault for invalid characters in vg name
Fixes a regression from commit ba7ff96faf
"improve reading and repairing vg metadata"

where the error path for a vg name with invalid
charaters was missing an error flag, which led
to the caller not recognizing an error occured.
Previously, an error flag was hidden in the old
_vg_make_handle function.
2019-08-29 11:35:46 -05:00
David Teigland
5b3fbccab9 hints: check for malloc failure 2019-08-28 12:41:57 -05:00
David Teigland
12707adac8 hints: fix copy of filter
Only the first entry of the filter array was being
included in the copy of the filter, rather than the
entire thing.  The result is that hints would not be
refreshed if the filter was changed but the first
entry was unchanged.
2019-08-28 12:33:04 -05:00
David Teigland
dcbed38b33 fix duplicate pv size check
Fixes a segfault in the recent commit e01fddc57:
"improve duplicate pv handling for md components"

While choosing between duplicates, the info struct is
not always valid; it may have been dropped already.

Remove the code that was still using the info struct for
size comparisons.  The size comparisons were a bogus check
anyway because it was just preferring the dev that had
already been chosen, it wasn't actually comparing the
dev size to the PV size.  It would be good to use a
dev/PV size comparison in the duplicate handling code, but
the PV size is not available until after vg_read, not
from the scan.
2019-08-27 15:40:24 -05:00
Zdenek Kabelac
b2885b7103 activation: use cmd pending mem for pending_delete
Since we need to preserve allocated strings across 2 separate
activation calls of '_tree_action()' we need to use other mem
pool them dm->mem - but since cmd->mem is released between
individual lvm2 locking calls, we rather introduce a new separate
mem pool just for pending deletes with easy to see life-span.
(not using 'libmem' as it would basicaly keep allocations over
the whole lifetime of clvmd)

This patch is fixing previous commmit where the memory was
improperly used after pool release.
2019-08-27 15:54:42 +02:00
Zdenek Kabelac
55f1d8a269 configure: check for prlimit
Update configure and make code compilable if prlimit() is not present.
Since the code is suspicious do not cope yet with it's replacement
with  set/getrlimit().
2019-08-26 17:24:37 +02:00
Zdenek Kabelac
4b1dcc2eeb lv_manip: add synchronizations
New udev in rawhide seems to be 'dropping' udev rule operations for devices
that are no longer existing - while this is 'probably' a bug - it's
revealing moments in lvm2 that likely should not run in a single
transaction and we should wait for a cookie before submitting more work.

TODO: it seem more 'error' paths should always include synchronization
before starting deactivating 'just activated' devices.
We should probably figure out some 'automatic' solution for this instead
of placing sync_local_dev_name() all over the place...
2019-08-26 15:32:19 +02:00
Zdenek Kabelac
c98e34e4d0 cache: improve vgremove loop
Support internal removal of 'cache origin' volume - which we
do not normally expose to a user - however internal processing
loops may hit this condition (depending on order of list LVs).

So when this operation is internally requested - we automatically
try to remove it's 'holding' LV (cache LV) - which will also
remove the origin.
2019-08-26 15:32:12 +02:00
Zdenek Kabelac
af0b84ccc8 snapshot: always activate
Drop the 'cluster-only' optimization so we do resume ALL device
before we try to wait on cookie before 'removal' operation.

It's more correct order of operation - alhtough possibly slightly
less efficient - but until we have correct list of operations
'in-progress' we can't do anything better.
2019-08-26 15:23:44 +02:00
Zdenek Kabelac
7833c45fbe activation: extend handling of pending_delete
With previous patch 30a98e4d67 we
started to put devices one pending_delete list instead
of directly scheduling their removal.

However we have operations like 'snapshot merge' where we are
resuming device tree in 2 subsequent activation calls - so
1st such call will still have suspened devices and no chance
to push 'remove' ioctl.

Since we curently cannot easily solve this by doing just single
activation call (which would be preferred solution) - we introduce
a preservation of pending_delete via command structure and
then restore it on next activation call.

This way we keep to remove devices later - although it might be
not the best moment - this may need futher tunning.

Also we don't keep the list of operation in 1 trasaction
(unless we do verify udev symlinks) - this could probably
also make it more correct in terms of which 'remove' can
be combined we already running 'resume'.
2019-08-26 15:16:38 +02:00
Zdenek Kabelac
30a98e4d67 activation: add synchronization point
Resuming of 'error' table entry followed with it's dirrect removal
is now troublesame with latest udev as it may skip processing of
udev rules for already 'dropped' device nodes.

As we cannot 'synchronize' with udev while we know we have devices
in suspended state - rework 'cleanup' so it collects nodes
for removal into pending_delete list and process the list with
synchronization once we are without any suspended nodes.
2019-08-20 12:46:11 +02:00
Zdenek Kabelac
0451225c19 pvmove: correcting read_ahead setting
When pvmove is finished, we do a tricky operation since we try to
resume multiple different device that were all joined into 1 big tree.

Currently we use the infromation from existing live DM table,
where we can get list of all holders of pvmove device.
We look for these nodes (by uuid) in new metadata, and we do now a full
regular device add into dm tree structure.  All devices should be
already PRELOAD with correct table before entering suspend state,
however for correctly working readahead we need to put correct info
also into RESUME tree.  Since table are preloaded, the same table
is skip and resume, but correct read ahead is now set.
2019-08-20 12:37:32 +02:00
David Teigland
0534cd9cd4 pvscan: disable sleeping and retrying for udev
When systemd is running pvscans, udev may not be
entirely initialized, so the pvscan should not
sleep and retry waiting for udev info.
2019-08-16 14:41:26 -05:00
David Teigland
61fce72a11 bcache: increase max allowed bcache size
from 128MB to 512MB (the default remains 8MB)
2019-08-16 13:35:09 -05:00
David Teigland
e01fddc578 improve duplicate pv handling for md components
Eliminate md components at the start so they don't
interfere with actual duplicates, and don't need
to be removed later.  This also allows for choosing
no copy of a PVID if they all happen to be md
components.
2019-08-16 13:26:12 -05:00
David Teigland
ee4a32e992 lvmcache: use devl list helper 2019-08-16 13:26:12 -05:00