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

lv_refresh: move the bulk of the function into lib

So that it can be used from other lib code.
This commit is contained in:
David Teigland 2015-06-16 13:38:40 -05:00
parent 3d9957e3dd
commit e043e03cd8
3 changed files with 26 additions and 16 deletions

View File

@ -1395,6 +1395,28 @@ int replace_lv_with_error_segment(struct logical_volume *lv)
return 1;
}
int lv_refresh_suspend_resume(struct cmd_context *cmd, struct logical_volume *lv)
{
if (!cmd->partial_activation && (lv->status & PARTIAL_LV)) {
log_error("Refusing refresh of partial LV %s."
" Use '--activationmode partial' to override.",
display_lvname(lv));
return 0;
}
if (!suspend_lv(cmd, lv)) {
log_error("Failed to suspend %s.", display_lvname(lv));
return 0;
}
if (!resume_lv(cmd, lv)) {
log_error("Failed to reactivate %s.", display_lvname(lv));
return 0;
}
return 1;
}
/*
* Remove given number of extents from LV.
*/

View File

@ -738,6 +738,8 @@ int lv_empty(struct logical_volume *lv);
/* Empty an LV and add error segment */
int replace_lv_with_error_segment(struct logical_volume *lv);
int lv_refresh_suspend_resume(struct cmd_context *cmd, struct logical_volume *lv);
/* Entry point for all LV extent allocations */
int lv_extend(struct logical_volume *lv,
const struct segment_type *segtype,

View File

@ -850,22 +850,8 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)
{
if (!cmd->partial_activation && (lv->status & PARTIAL_LV)) {
log_error("Refusing refresh of partial LV %s."
" Use '--activationmode partial' to override.",
lv->name);
return 0;
}
if (!suspend_lv(cmd, lv)) {
log_error("Failed to suspend %s.", lv->name);
return 0;
}
if (!resume_lv(cmd, lv)) {
log_error("Failed to reactivate %s.", lv->name);
return 0;
}
if (!lv_refresh_suspend_resume(cmd, lv))
return_0;
/*
* check if snapshot merge should be polled