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

thin: add detach_pool_metadata_lv

Add internal function detach_pool_metadata_lv().
This commit is contained in:
Zdenek Kabelac 2012-12-02 01:28:51 +01:00
parent c5e2f08cf9
commit 6987a353de
3 changed files with 21 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
Implement internal function detach_pool_metadata_lv().
Fix lvm2app to return all property sizes in bytes.
Recognize DM_DISABLE_UDEV environment variable for a complete fallback.
Do not verify udev operations if --noudevsync command option is used.

View File

@ -460,6 +460,8 @@ int fixup_imported_mirrors(struct volume_group *vg);
*/
int attach_pool_metadata_lv(struct lv_segment *pool_seg,
struct logical_volume *pool_metadata_lv);
int detach_pool_metadata_lv(struct lv_segment *pool_seg,
struct logical_volume **pool_metadata_lv);
int attach_pool_data_lv(struct lv_segment *pool_seg,
struct logical_volume *pool_data_lv);
int attach_pool_lv(struct lv_segment *seg, struct logical_volume *pool_lv,

View File

@ -30,6 +30,24 @@ int attach_pool_metadata_lv(struct lv_segment *pool_seg, struct logical_volume *
return add_seg_to_segs_using_this_lv(metadata_lv, pool_seg);
}
int detach_pool_metadata_lv(struct lv_segment *pool_seg, struct logical_volume **metadata_lv)
{
struct logical_volume *lv = pool_seg->metadata_lv;
if (!lv || !lv_is_thin_pool_metadata(lv) ||
!remove_seg_from_segs_using_this_lv(lv, pool_seg)) {
log_error(INTERNAL_ERROR "LV %s is invalid thin pool.", pool_seg->lv->name);
return 0;
}
lv_set_visible(lv);
lv->status &= ~THIN_POOL_METADATA;
*metadata_lv = lv;
pool_seg->metadata_lv = NULL;
return 1;
}
int attach_pool_data_lv(struct lv_segment *pool_seg, struct logical_volume *pool_data_lv)
{
if (!set_lv_segment_area_lv(pool_seg, 0, pool_data_lv, 0, THIN_POOL_DATA))