mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +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:
parent
3d9957e3dd
commit
e043e03cd8
@ -1395,6 +1395,28 @@ int replace_lv_with_error_segment(struct logical_volume *lv)
|
|||||||
return 1;
|
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.
|
* Remove given number of extents from LV.
|
||||||
*/
|
*/
|
||||||
|
@ -738,6 +738,8 @@ int lv_empty(struct logical_volume *lv);
|
|||||||
/* Empty an LV and add error segment */
|
/* Empty an LV and add error segment */
|
||||||
int replace_lv_with_error_segment(struct logical_volume *lv);
|
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 */
|
/* Entry point for all LV extent allocations */
|
||||||
int lv_extend(struct logical_volume *lv,
|
int lv_extend(struct logical_volume *lv,
|
||||||
const struct segment_type *segtype,
|
const struct segment_type *segtype,
|
||||||
|
@ -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)
|
int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
if (!cmd->partial_activation && (lv->status & PARTIAL_LV)) {
|
if (!lv_refresh_suspend_resume(cmd, lv))
|
||||||
log_error("Refusing refresh of partial LV %s."
|
return_0;
|
||||||
" 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check if snapshot merge should be polled
|
* check if snapshot merge should be polled
|
||||||
|
Loading…
Reference in New Issue
Block a user