mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
raid: Move two functions.
This commit is contained in:
parent
802bd34562
commit
30884208d4
@ -3281,7 +3281,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
|
|||||||
log_debug("Adjusted allocation request to %" PRIu32 " logical extents. Existing size %" PRIu32 ". New size %" PRIu32 ".",
|
log_debug("Adjusted allocation request to %" PRIu32 " logical extents. Existing size %" PRIu32 ". New size %" PRIu32 ".",
|
||||||
total_extents, existing_extents, total_extents + existing_extents);
|
total_extents, existing_extents, total_extents + existing_extents);
|
||||||
if (ah->log_len)
|
if (ah->log_len)
|
||||||
log_debug("Mirror log of %" PRIu32 " extents of size %" PRIu32 "sectors needed for region size %" PRIu32 ".",
|
log_debug("Mirror log of %" PRIu32 " extents of size %" PRIu32 " sectors needed for region size %" PRIu32 ".",
|
||||||
ah->log_len, extent_size, ah->region_size);
|
ah->log_len, extent_size, ah->region_size);
|
||||||
|
|
||||||
if (mirrors || stripes)
|
if (mirrors || stripes)
|
||||||
|
@ -190,6 +190,38 @@ static void _clear_allocation_prohibited(struct dm_list *pvs)
|
|||||||
pvl->pv->status &= ~PV_ALLOCATION_PROHIBITED;
|
pvl->pv->status &= ~PV_ALLOCATION_PROHIBITED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME Move this out */
|
||||||
|
/* Write, commit and optionally backup metadata of vg */
|
||||||
|
static int _vg_write_commit_backup(struct volume_group *vg)
|
||||||
|
{
|
||||||
|
if (!vg_write(vg) || !vg_commit(vg)) {
|
||||||
|
log_error("Failed to commit VG %s metadata.", vg->name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!backup(vg))
|
||||||
|
log_warn("WARNING: Backup of VG %s metadata failed. Continuing.", vg->name);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deactivate and remove the LVs on removal_lvs list from vg.
|
||||||
|
*/
|
||||||
|
static int _deactivate_and_remove_lvs(struct volume_group *vg, struct dm_list *removal_lvs)
|
||||||
|
{
|
||||||
|
struct lv_list *lvl;
|
||||||
|
|
||||||
|
dm_list_iterate_items(lvl, removal_lvs) {
|
||||||
|
if (!deactivate_lv(vg->cmd, lvl->lv))
|
||||||
|
return_0;
|
||||||
|
if (!lv_remove(lvl->lv))
|
||||||
|
return_0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* _raid_in_sync
|
* _raid_in_sync
|
||||||
* @lv
|
* @lv
|
||||||
@ -1494,21 +1526,6 @@ int lv_raid_merge(struct logical_volume *image_lv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Deactivate and remove the LVs on removal_lvs list from vg.
|
|
||||||
*/
|
|
||||||
static int _deactivate_and_remove_lvs(struct volume_group *vg, struct dm_list *removal_lvs)
|
|
||||||
{
|
|
||||||
struct lv_list *lvl;
|
|
||||||
|
|
||||||
dm_list_iterate_items(lvl, removal_lvs)
|
|
||||||
if (!deactivate_lv(vg->cmd, lvl->lv) ||
|
|
||||||
!lv_remove(lvl->lv))
|
|
||||||
return_0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate metadata devs for all @new_data_devs and link them to list @new_meta_lvs
|
* Allocate metadata devs for all @new_data_devs and link them to list @new_meta_lvs
|
||||||
*/
|
*/
|
||||||
@ -1769,22 +1786,6 @@ static int _alloc_and_add_rmeta_devs_for_lv(struct logical_volume *lv, struct dm
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* FIXME Move this out */
|
|
||||||
/* Write, commit and optionally backup metadata of vg */
|
|
||||||
static int _vg_write_commit_backup(struct volume_group *vg)
|
|
||||||
{
|
|
||||||
if (!vg_write(vg) || !vg_commit(vg)) {
|
|
||||||
log_error("Failed to commit VG %s metadata.", vg->name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!backup(vg))
|
|
||||||
log_warn("WARNING: Backup of VG %s metadata failed. Continuing.", vg->name);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Eliminate the extracted LVs on @removal_lvs from @vg incl. vg write, commit and backup
|
* Eliminate the extracted LVs on @removal_lvs from @vg incl. vg write, commit and backup
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user