1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 11:55:55 +03:00
Commit Graph

1492 Commits

Author SHA1 Message Date
Jonathan Brassow
0912cf67aa cache: Ability to convert an existing LV into a cached LV
Users now have the ability to convert their existing logical volumes
into cached logical volumes.  A cache pool LV must be specified using
the '--cachepool' argument.  The cachepool is the small, fast LV used
to cache the large, slow LV that is being converted.
2014-02-12 09:55:35 -06:00
Jonathan Brassow
48aef76ec5 cache: lv_cache_create returns LV ptr, so return NULL not 0 on error 2014-02-11 13:47:26 -06:00
Zdenek Kabelac
9d69585b82 cleanup: remove unneeded header files 2014-02-11 19:00:06 +01:00
Zdenek Kabelac
bcd6b643be cleanup: update clearing message
Since some targets are using this routine to setup
other values then 0 and also may clear much more data then
just disk header - add better message.
2014-02-11 18:59:22 +01:00
Zdenek Kabelac
38e457c478 raid: drop invalid modication of active parameter
lv_active_change will enforce proper activation.
Modification of activation was wrong and lead to misuse of
autoactivation. Fix allows to use proper local exclusive activation,
while the removed code turned this into just exclusive
activation (losing required local property).
2014-02-11 18:48:38 +01:00
Peter Rajnoha
ed166a3b1d wiping: wipe DM_snapshot_cow signature without prompt in newly created LVs
The libblkid can detect DM_snapshot_cow signature and when creating
new LVs with blkid wiping used (allocation/use_blkid_wiping=1 lvm.conf
setting and --wipe y used at the same time - which it is by default).

Do not issue any prompts about this signature when new LV is created
and just wipe it right away without asking questions. Still keep the
log in verbose mode though.
2014-02-10 13:28:13 +01:00
Peter Rajnoha
5635816094 cleanup: missing parentheses in a condition
gcc reports:
  metadata/merge.c:229:58: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
  metadata/merge.c:232:58: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
2014-02-10 09:05:17 +01:00
Jonathan Brassow
36f9fadcb4 cache[pool]: Populate existing report fields with cache data
For the report fields that already exist that are relevent to cache
and cache pool LVs (like 'origin', 'metadata_lv', etc), populate
them.
2014-02-05 09:44:37 -06:00
Jonathan Brassow
96626f64fa cache: Code to allow the create/remove of cache LVs
This patch allows users to create cache LVs with 'lvcreate'.  An origin
or a cache pool LV must be created first.  Then, while supplying the
origin or cache pool to the lvcreate command, the cache can be created.

Ex1:
Here the cache pool is created first, followed by the origin which will
be cached.
~> lvcreate --type cache_pool -L 500M -n cachepool vg /dev/small_n_fast
~> lvcreate --type cache -L 1G -n lv vg/cachepool /dev/large_n_slow

Ex2:
Here the origin is created first, followed by the cache pool - allowing
a cache LV to be created covering the origin.
~> lvcreate -L 1G -n lv vg /dev/large_n_slow
~> lvcreate --type cache -L 500M -n cachepool vg/lv /dev/small_n_fast

The code determines which type of LV was supplied (cache pool or origin)
by checking its type.  It ensures the right argument was given by ensuring
that the origin is larger than the cache pool.

If the user wants to remove just the cache for an LV.  They specify
the LV's associated cache pool when removing:
~> lvremove vg/cachepool

If the user wishes to remove the origin, but leave the cachepool to be
used for another LV, they specify the cache LV.
~> lvremove vg/lv

In order to remove it all, specify both LVs.

This patch also includes tests to create and remove cache pools and
cache LVs.
2014-02-04 16:50:16 -06:00
Jonathan Brassow
97be8b3482 cache: Code changes to allow creation of cache pools
This patch allows the creation and removal of cache pools.  Users are not
yet able to create cache LVs.  They are only able to define the space used
for the cache and its characteristics (chunk_size and cache mode ATM) by
creating the cache pool.
2014-02-04 11:57:08 -06:00
Jonathan Brassow
013cf27bff cache pool: Add 'update_cache_pool_params'
Similar function to 'update_thin_pool_params', but for cache.  Performs
the adjustements for chunk_size, metdata device size, etc.
2014-02-04 11:50:27 -06:00
Jonathan Brassow
8ddc7f641c misc: disambiguate 'update_pool_params'
s/update_pool_params/update_thin_pool_params/ to disambiguate it from
a future 'update_cache_pool_params'.
2014-02-04 09:58:35 -06:00
Jonathan Brassow
afe2ba657b misc: rename variables [min|max]_chunk to [min|max]_chunk_size
better variable names.
2014-02-04 08:20:10 -06:00
Jonathan Brassow
b94a3ee9f6 cache: Add functions that create/remove cache LVs
A cache LV - from LVM's perpective - is a user accessible device that
links the cachepool LV and the origin LV.  The following functions
were added to facilitate the creation and removal of this top-level
LV:
1) 'lv_cache_create' - takes a cachepool and an origin device and links
   them into a new top-level LV of 'cache' segment type.  No allocation
   is necessary in this function, as the sub-LVs contain all of the
   necessary allocated space.  Only the top-level layer needs to be
   created.

2) 'lv_cache_remove' - this function removes the top-level LV of a
   cache LV - promoting the cachepool and origin sub-LVs to top-level
   devices and leaving them exposed to the user.  That is, the
   cachepool is unlinked and free to be used with another origin to
   form a new cache LV; and the origin is no longer cached.
   (Currently, if the cache needs to be flushed, it is done in this
   function and the function waits for it to complete before proceeding.
   This will be taken out in a future patch in favor of polling.)
2014-02-04 07:59:58 -06:00
Zdenek Kabelac
ef6c5795a0 raid: add temporary activation for raid metadata clear
Use LV_TEMPORARY when activating devices for clearing
raid metadata.
2014-02-04 14:51:05 +01:00
Jonathan Brassow
3247819531 pool: Make another thin pool fn generic for cache usage also
Make '_recalculate_thin_pool_chunk_size_with_dev_hints' so it can
be used for cache and thin pools.
2014-02-04 07:03:52 -06:00
Alasdair G Kergon
4aa8a14fc2 compilation: Rename tags variables to tagsl. 2014-01-30 21:09:28 +00:00
Jonathan Brassow
e833d84e67 cache/pool: Make the fns in pool_manip.c work with cache pools
The functions in pool_manip.c are specific to thin pools.  It's
now time to make them more generic and able to handle cache pools
as well.
2014-01-28 12:25:07 -06:00
Jonathan Brassow
70fd2139e1 cache: Allocation code changes necessary to support cache_pool
Cache pools require a data and metadata area (like thin pools).  Unlike
thin pool, if 'cache_pool_metadata_require_separate_pvs' is not set to
'1', the metadata and data area will be allocated from the same device.
It is also done in a manner similar to RAID, where a single chunk of
space is allocated and then split to form the metadata and data device -
ensuring that they are together.
2014-01-28 12:25:02 -06:00
Jonathan Brassow
75b8ea195c cache: New functions for gathering info on cache devices
Building on the new DM function that parses DM cache status, we
introduce the following LVM level functions to aquire information
about cache devices:
- lv_cache_block_info: retrieves information on the cache's block/chunk usage
- lv_cache_policy_info: retrieves information on the cache's policy
2014-01-28 12:24:51 -06:00
Zdenek Kabelac
155405b0e1 thin: validate external origin size
Avoid use of external origin with size unaligned/incompatible with
thin pool chunk size, since the last chunk is not correctly provisioned
when it is overwritten.
2014-01-29 14:58:13 +01:00
Zdenek Kabelac
8074d8056a thin:drop stack trace when pool is above threshold
Since this path is expected, do not log_debug stacktrace.
2014-01-29 14:26:06 +01:00
Zdenek Kabelac
c0bd436dcb thin: disable extension of reduced thin with etx.origin
Since we are currently incapable of providing zeroes for
reextended thin volume area, let's disable extension of
such already reduce thin volumes.

(in-release change)
2014-01-28 10:40:08 +01:00
Jonathan Brassow
90bbed3255 cache: New 'cachepool' segment type
This patch adds the new cachepool segment type - the first of two
necessary to eventually create 'cache' logical volumes.  In addition
to the new segment type, updates to makefiles, configure files, the
lv_segment struct, and some necessary libdevmapper flags.

The cachepool is the LV and corresponding segment type that will hold
all information pertinent to the cache itself - it's size, cachemode,
cache policy, core arguments (like migration_threshold), etc.
2014-01-27 05:27:16 -06:00
Zdenek Kabelac
89d7732617 thin: fix missing ~ in previous commit 2014-01-24 13:13:37 +01:00
Zdenek Kabelac
731c298e12 thin: use LV_TEMPORARY for metadata initialization
This flag need to be specified when we create thin pool - to avoid
scanning device with watch rules.
2014-01-24 12:30:28 +01:00
Zdenek Kabelac
432ff4bd72 cleanup: indent 2014-01-24 12:30:28 +01:00
Jonathan Brassow
5e4647ec99 Typo: s/Unale/Unable/ 2014-01-22 23:04:27 -06:00
Zdenek Kabelac
902b343e0e thin: validate resize of thin LV with ext. origin
When thin volume is using external origin, current thin target
is not able to supply 'extended' size with empty pages.

lvm2 detects version and disables extension of LV past the external
origin size in this case.

Thin LV could be however still reduced and extended freely bellow
this size.
2014-01-23 14:20:34 +01:00
Zdenek Kabelac
2dae78b722 thin: rename function
Rename pool_can_resize_metadata() to more reusable
thin_pool_feature_supported() which could be queried
for mutiple different features.
2014-01-23 14:19:17 +01:00
Zdenek Kabelac
1d7b2715e5 missed pool_manip.c
Seems like this file is missing from the thin_manip move.
Make the tree compilable again.
2014-01-23 09:57:22 +01:00
Jonathan Brassow
998af1a4fb Misc: Change name of lvcreate_params field - s/create_thin_pool/create_pool/
In preparation for other segment types that create and use "pools", we
s/create_thin_pool/create_pool/.  This way it is not awkward when creating
a cachepool, for example, to use "create_thin_pool".
2014-01-22 10:30:55 -06:00
Jonathan Brassow
5590448c32 Misc: Move some thin pool functions to a new file
Functions that handle set-up, tear-down and creation of thin pool
volumes will be more generally applicable when more targets exist
that make use of device-mapper's persistent data format.  One of
these targets is the dm-cache target.  I've selected some functions
that will be useful for the cache segment type to be moved, since
they will no longer be thin pool specific but are more broadly
useful to any segment type that makes use of a 'pool' LV.
2014-01-22 10:11:29 -06:00
Alasdair G Kergon
aa21e79991 pre-release 2014-01-20 19:22:56 +00:00
Peter Rajnoha
91b26b63b4 thin: fix thin LV flagging for udev to skip scanning
Only flag thin LV for no scanning in udev if this LV is about
to be wiped. This happens only in case the thin LV's pool was not
created with zeroing of the new blocks enabled.
2014-01-20 12:38:21 +01:00
Alasdair G Kergon
5a450eab6a pvs: fix segfaults with orphans
Several fields used to display 0 if undefined.  Recent changes
to the way the fields are reported threw away some tests for
valid pointers, leading to segfaults with 'pvs -o all'.

Reinstate the original behaviour.
2014-01-14 03:17:27 +00:00
Zdenek Kabelac
95b1af7280 thin: accept const struct 2014-01-08 11:57:43 +01:00
Alasdair G Kergon
0a13815e68 pvscan: use format feature flags in lvmetad code
Introduce FMT_OBSOLETE to identify pool metadata and use it and FMT_MDAS
instead of hard-coded format names.
Explain device accesses on pvscan --cache man page.
2014-01-08 02:13:13 +00:00
Zdenek Kabelac
94137b72ed lv_dependency: scan also snapshots and extorigins
When LV is scanned for its dependencies - scan also origin's snapshots,
and thin external origins.

So if any PV from snapshot or external origin device is missing - lvm2 will
avoid trying to activate such device.
2013-12-17 14:08:54 +01:00
Peter Rajnoha
32080c4ff7 device: add physical block size info and make sure VG extent size >= PV's phys. block size 2013-12-12 15:02:36 +01:00
Zdenek Kabelac
30a81e5989 cleanup: self compilable headers 2013-12-12 13:28:19 +01:00
Zdenek Kabelac
99d5b4b807 cleanup: share segtype macros
Write query macro just once.
2013-12-10 11:16:53 +01:00
Zdenek Kabelac
6f0300de96 lv_remove_single: update parameter name
Since we have already a meaning for 'silent'
replace its name with more explanator suppress_remove_message
(updates recent commit).
2013-12-05 12:40:47 +01:00
Zdenek Kabelac
ff112eee18 thin: merge display 2013-12-04 14:30:26 +01:00
Zdenek Kabelac
5fc3352a15 thin: merge removal
When thin is merged - properly handly device removal.
2013-12-04 14:30:26 +01:00
Zdenek Kabelac
e286904da6 thin: snapshot merge support 2013-12-04 14:30:25 +01:00
Zdenek Kabelac
993831bdb1 cleanup: size is already 64bit value
Cast is not needed.
2013-12-04 14:30:25 +01:00
Zdenek Kabelac
5a6794a2ce lv_remove_single: add silent arg
Support silence for removal message.
2013-12-04 14:30:25 +01:00
Alasdair G Kergon
2e82a070f3 pvcreate: Avoid spurious 'not found' messages.
Replacement of pv_read by find_pv_by_name in commit
651d5093ed caused spurious
error messages when running pvcreate or vgextend against an
unformatted device.

Physical volume /dev/loop4 not found
Physical volume "/dev/loop4" successfully created

Physical volume /dev/loop4 not found
Physical volume /dev/loop4 not found
Physical volume "/dev/loop4" successfully created
Volume group "vg1" successfully extended
2013-11-29 21:45:37 +00:00
Peter Rajnoha
6a1957badc pvcreate: do not issue warning about any existing PV
If we're calling pvcreate on a device that already has a PV label,
the blkid detects the existing PV and then we consider it for wiping
before we continue creating the new PV label and we issue a warning
with a prompt whether such old PV label should be removed. We don't
do this with native signature detection code. Let's make it consistent
with old behaviour.

But still keep this "PV" (identified as "LVM1_member" or "LVM2_member"
by blkid) detection when creating new LVs to avoid unexpected PV label
appeareance inside LV.
2013-11-28 13:14:46 +01:00