summaryrefslogtreecommitdiffstats
path: root/lib/metadata/snapshot_manip.c
Commit message (Collapse)AuthorAgeFilesLines
* Reinstate support for format1 snapshots, but issue deprecated warning.Alasdair Kergon2011-12-201-0/+4
| | | | | I anticipate removing support for snapshots with lvm1-formatted metadata in a future release.
* Fix potential null ptr deref in 'origin_from_cow'Jonathan Earl Brassow2011-07-191-1/+3
| | | | return NULL rather than segfaulting if lv->snapshot is not set
* Move snapshot deactivation logic into lib/activate, fixing theAlasdair Kergon2011-07-081-16/+18
| | | | | | teardown sequence. (Previously the snapshot was deactivated while its origin was active and before its removal was committed to disk, so restarting after a crash at the point would leave corruption.)
* When removing a snapshot avoid preloading the origin if theMike Snitzer2010-04-231-6/+15
| | | | snapshot-merge target is not active.
* Refactor snapshot-merge deptree and device removal to support info-by-uuidMike Snitzer2010-02-171-5/+32
| | | | | | | | | | | | | | | | | | | | | Add a merging snapshot to the deptree, using the "error" target, rather than avoid adding it entirely. This allows proper cleanup of the -cow device without having to rename the -cow to use the origin's name as a prefix. Move the preloading of the origin LV, after a merge, from lv_remove_single() to vg_remove_snapshot(). Having vg_remove_snapshot() preload the origin allows the -cow device to be released so that it can be removed via deactivate_lv(). lv_remove_single()'s deactivate_lv() reliably removes the -cow device because the associated snapshot LV, that is to be removed when a snapshot-merge completes, is always added to the deptree (and kernel -- via "error" target). Now when the snapshot LV is removed both the -cow and -real devices get removed using uuid rather than device name. This paves the way for us to switch over to info-by-uuid queries. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* Rename segment and lv status flag from SNAPSHOT_MERGE to MERGING.Mike Snitzer2010-01-131-9/+14
| | | | | | Eliminate 'merging_snapshot' from 'struct logical_volume' and just use 'snapshot' for origin lv's reference to the merging snapshot; also set MERGING in the origin lv's status.
* Add snapshot merge wrappers to abstract the associations and flags usedMike Snitzer2010-01-131-4/+28
| | | | to represent merging origin and snapshot volumes.
* Add 'SNAPSHOT_MERGE' lv_segment 'status' flag.Mike Snitzer2010-01-131-2/+27
| | | | | | | | | | | | | Make 'merging_snapshot' pointer that points from the origin to the segment that represents the merging snapshot. Import/export 'merging_store' metadata. Do not allow creating snapshots while another snapshot is merging. Snapshot created in this state would certainly contain invalid data. NOTE: patches at the end of this series will remove 'merging_snapshot' and will introduce helpful wrappers and cleanups.
* Use log_error macro consistently throughout in place of log_err.Alasdair Kergon2009-07-151-1/+1
|
* Pre-release cleanups.Alasdair Kergon2009-05-211-1/+1
|
* Remove unneeded import parameter from lv_create_empty.Milan Broz2009-05-131-1/+1
|
* Merge lv_is_displayable and lv_is_visible.Milan Broz2009-05-131-8/+0
| | | | | | | Displayable and visible is the same thing. volumes_count(vg) is now vg_visible_lvs() and always returns number of LVs from user perspective.
* Introduce lv_set_visible & lv_set_invisible and use lv_is_visible always.Milan Broz2009-05-131-2/+3
| | | | | | | | The vg->lv_count parameter now includes always number of visible logical volumes. Note that virtual snapshot volume (snapshotX) is never visible, but it is stored in metadata with visible flag.
* Fix lv_is_visible to handle virtual origin.Milan Broz2009-05-131-2/+9
| | | | | Snapshot is visible if its origin is marked visible, or if the origin is virtual.
* Remove vg->lv_count and use counter function.Milan Broz2009-05-131-6/+0
| | | | | | | This should not cause problems but simplifies code a lot. (the volumes_count is merged and renamed with lvs_visible function by following patch.)
* Fix snapshot segment import to not use duplicate segments & replace.Milan Broz2009-05-131-26/+29
| | | | | | | | | | | | | | | | | The snapshot segment (snapshotX) is created twice during the text metadata segment processing. This can cause temporary violation of max_lv count. Simplify the code, snapshot segment is properly initialized in init_snapshot_seg function now and do not need to be replaced by vg_add_snapshot call. The vg_add_snapshot() is now usefull only for adding new snapshot and it shares the same initialization function. The snapshot name is always generated, name paramater can be removed from function call.
* Remove snapshot_count from VG and use function instead.Milan Broz2009-05-121-2/+0
|
* Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin).Alasdair Kergon2009-04-251-0/+10
| | | | | | | | Add lvs origin_size field. Fix linux configure --enable-debug to exclude -O2. Still a few rough edges, but hopefully usable now: lvcreate -s vg1 -L 100M --virtualoriginsize 1T
* Fix lv_count when manipulating with snapshots and max_lv is set.Milan Broz2009-03-161-2/+9
| | | | | | | | | | | | | | | | | | | | Patch fixes these problems: - during the snapshot creation process, it needs create 2 LVs, one is cow, second becomes snapshot. If the code fails in vg_add_snapshot, code lvcreate will not remove LV cow volume. - if max_lv is set and VG contains snapshot, it can happen that during the activation lv_count is temporarily increased over the limit and VG metadata are not properly processed see https://bugzilla.redhat.com/show_bug.cgi?id=490298 - vgcfgrestore alows restore with max_lv set to lower valuer that actual LV count. This later leads to situation that max_lv is completely ignored. - vgck doesn't call vg_validate(). It should at least try:-) Signed-off-by: Milan Broz <mbroz@redhat.com>
* Added displayable_lvs_in_vg and lv_is_displayable functions to deal withPeter Rajnoha2008-12-041-0/+8
| | | | | the counts of visible LVs from user's perspective consistently throughout the code.
* Right, a simple build (without options) is working again.Alasdair Kergon2008-11-031-2/+2
|
* Some whitespace tidy-ups.Alasdair Kergon2008-01-301-1/+1
|
* Use stack return macros throughout.Alasdair Kergon2008-01-301-8/+4
|
* Prevent lvconvert -s from using same LV as origin and snapshot.Alasdair Kergon2007-11-071-0/+5
|
* Fix orphan-related locking in pvdisplay and pvs.Alasdair Kergon2007-11-021-2/+1
| | | | | | | | Fix missing VG unlocks in some pvchange error paths. Add some missing validation of VG names. Rename validate_vg_name() to validate_new_vg_name(). Change orphan lock to VG_ORPHANS. Change format1 to use ORPHAN as orphan VG name.
* Non-functional change - refactor lv_create_empty().Dave Wysochanski2007-10-111-2/+1
| | | | | Remove struct format_instance param - we can safely obtain this from vg->fid inside the function.
* Non-functional change - refactor vg_add_snapshot fid parameter.Dave Wysochanski2007-10-111-1/+2
|
* Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1.Alasdair Kergon2007-08-201-3/+3
|
* lv_is_visible()Alasdair Kergon2006-04-071-0/+8
|
* Introduce origin_from_cow()Alasdair Kergon2006-04-061-0/+6
|
* Always insert an intermediate layer for mirrors.Alasdair Kergon2005-06-031-1/+1
| | | | | | Suppress hidden LVs from reports unless --all is given. Use square brackets for hidden LVs in reports. Centralise restrictions on LV names.
* Basic support for mirrors.Alasdair Kergon2005-06-011-1/+1
|
* lv_reduce tidying.Alasdair Kergon2005-05-091-4/+4
| | | | | Remove some unnecessary parameters. Introduce seg_is macros.
* Internal snapshot code restructuring.Alasdair Kergon2005-04-071-113/+42
|
* Remove unused internal non-persistent snapshot option.Alasdair Kergon2005-04-071-2/+1
|
* store snapshot id as lvid internallyAlasdair Kergon2005-04-071-4/+4
|
* Always fail if random id generation fails.Alasdair Kergon2005-01-201-1/+2
|
* Store snapshot and origin sizes separately.Alasdair Kergon2005-01-191-3/+4
|
* Update copyright notices.Alasdair Kergon2004-03-301-2/+11
|
* Default stripesize 64k & config file setting for it;Alasdair Kergon2002-12-191-5/+5
| | | | | | Clear many compiler warnings (i386) & associated bugs - hopefully without introducing too many new bugs:-) (Same exercise required for other archs.) Default compilation has optimisation - or else use ./configure --enable-debug
* Maintain snapshot_count correctly.Alasdair Kergon2002-12-051-0/+2
|
* Some new features.Alasdair Kergon2002-11-181-2/+10
|
* TidyAlasdair Kergon2002-05-311-4/+5
|
* Remove a no-op.Alasdair Kergon2002-05-091-12/+9
|
* o Added function find_snapshots to snapshot_manip.c that returns a listAJ Lewis2002-05-081-0/+33
| | | | | | of snapshots whose origin is the lv passed in. o Used this new function to make lvdisplay properly display all snapshots attached to a origin.
* Merge with text format branch.Alasdair Kergon2002-04-241-6/+19
| | | | | | | | | | | | | | | | | | | Lots of changes/very little testing so far => there'll be bugs! Use 'vgcreate -M text' to create a volume group with its metadata stored in text files. Text format metadata changes should be reasonably atomic, with a (basic) automatic recovery mechanism if the system crashes while a change is in progress. Add a metadata section to lvm.conf to specify multiple directories if you want (recommended) to keep multiple copies of the metadata (eg on different filesystems). e.g. metadata { dirs = ["/etc/lvm/metadata1","/usr/local/lvm/metadata2"] } Plenty of refinements still in the pipeline.
* o Remove the vg argument from find_cowJoe Thornber2002-02-251-2/+2
|
* Avoid ambigous volume_group argument in vg_add_snapshot()Heinz Mauelshagen2002-02-211-4/+3
|
* o add find_cow function.Joe Thornber2002-02-211-0/+14
|
* Remove VG arg from lv_is_cow() and lv_is_origin() - use lv->vg instead.Alasdair Kergon2002-02-201-5/+5
|