mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
cleanup: change ondisk committed
Patch has no functional change.
This commit is contained in:
parent
d9faf85987
commit
4312b09635
@ -333,7 +333,7 @@ int lv_suspend(struct cmd_context *cmd, const char *lvid_s)
|
|||||||
}
|
}
|
||||||
*******/
|
*******/
|
||||||
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive,
|
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive,
|
||||||
const struct logical_volume *ondisk_lv, const struct logical_volume *incore_lv)
|
const struct logical_volume *lv, const struct logical_volume *lv_pre)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1793,12 +1793,12 @@ static int _preload_detached_lv(struct logical_volume *lv, void *data)
|
|||||||
|
|
||||||
static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
||||||
struct lv_activate_opts *laopts, int error_if_not_suspended,
|
struct lv_activate_opts *laopts, int error_if_not_suspended,
|
||||||
const struct logical_volume *ondisk_lv, const struct logical_volume *incore_lv)
|
const struct logical_volume *lv, const struct logical_volume *lv_pre)
|
||||||
{
|
{
|
||||||
const struct logical_volume *pvmove_lv = NULL;
|
const struct logical_volume *pvmove_lv = NULL;
|
||||||
const struct logical_volume *ondisk_lv_to_free = NULL;
|
const struct logical_volume *lv_to_free = NULL;
|
||||||
const struct logical_volume *incore_lv_to_free = NULL;
|
const struct logical_volume *lv_pre_to_free = NULL;
|
||||||
struct logical_volume *lv_pre;
|
struct logical_volume *lv_pre_tmp;
|
||||||
struct seg_list *sl;
|
struct seg_list *sl;
|
||||||
struct lv_segment *snap_seg;
|
struct lv_segment *snap_seg;
|
||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
@ -1808,27 +1808,28 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
if (!activation())
|
if (!activation())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!ondisk_lv && !(ondisk_lv_to_free = ondisk_lv = lv_from_lvid(cmd, lvid_s, 0)))
|
/* lv comes from committed metadata */
|
||||||
|
if (!lv && !(lv_to_free = lv = lv_from_lvid(cmd, lvid_s, 0)))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
/* Use precommitted metadata if present */
|
/* Use precommitted metadata if present */
|
||||||
if (!incore_lv && !(incore_lv_to_free = incore_lv = lv_from_lvid(cmd, lvid_s, 1)))
|
if (!lv_pre && !(lv_pre_to_free = lv_pre = lv_from_lvid(cmd, lvid_s, 1)))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
/* Ignore origin_only unless LV is origin in both old and new metadata */
|
/* Ignore origin_only unless LV is origin in both old and new metadata */
|
||||||
/* or LV is thin or thin pool volume */
|
/* or LV is thin or thin pool volume */
|
||||||
if (!lv_is_thin_volume(ondisk_lv) && !lv_is_thin_pool(ondisk_lv) &&
|
if (!lv_is_thin_volume(lv) && !lv_is_thin_pool(lv) &&
|
||||||
!(lv_is_origin(ondisk_lv) && lv_is_origin(incore_lv)))
|
!(lv_is_origin(lv) && lv_is_origin(lv_pre)))
|
||||||
laopts->origin_only = 0;
|
laopts->origin_only = 0;
|
||||||
|
|
||||||
if (test_mode()) {
|
if (test_mode()) {
|
||||||
_skip("Suspending %s%s.", ondisk_lv->name,
|
_skip("Suspending %s%s.", display_lvname(lv),
|
||||||
laopts->origin_only ? " origin without snapshots" : "");
|
laopts->origin_only ? " origin without snapshots" : "");
|
||||||
r = 1;
|
r = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lv_info(cmd, ondisk_lv, laopts->origin_only, &info, 0, 0))
|
if (!lv_info(cmd, lv, laopts->origin_only, &info, 0, 0))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
if (!info.exists || info.suspended) {
|
if (!info.exists || info.suspended) {
|
||||||
@ -1840,10 +1841,10 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lv_read_replicator_vgs(ondisk_lv))
|
if (!lv_read_replicator_vgs(lv))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
lv_calculate_readahead(ondisk_lv, NULL);
|
lv_calculate_readahead(lv, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Preload devices for the LV.
|
* Preload devices for the LV.
|
||||||
@ -1852,58 +1853,57 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
* tables for all the changed LVs here, as the relationships
|
* tables for all the changed LVs here, as the relationships
|
||||||
* are not found by walking the new metadata.
|
* are not found by walking the new metadata.
|
||||||
*/
|
*/
|
||||||
if (!lv_is_locked(incore_lv) &&
|
if (lv_is_locked(lv) && !lv_is_locked(lv_pre) &&
|
||||||
lv_is_locked(ondisk_lv) &&
|
(pvmove_lv = find_pvmove_lv_in_lv(lv))) {
|
||||||
(pvmove_lv = find_pvmove_lv_in_lv(ondisk_lv))) {
|
|
||||||
/* Preload all the LVs above the PVMOVE LV */
|
/* Preload all the LVs above the PVMOVE LV */
|
||||||
dm_list_iterate_items(sl, &pvmove_lv->segs_using_this_lv) {
|
dm_list_iterate_items(sl, &pvmove_lv->segs_using_this_lv) {
|
||||||
if (!(lv_pre = find_lv(incore_lv->vg, sl->seg->lv->name))) {
|
if (!(lv_pre_tmp = find_lv(lv_pre->vg, sl->seg->lv->name))) {
|
||||||
log_error(INTERNAL_ERROR "LV %s missing from preload metadata", sl->seg->lv->name);
|
log_error(INTERNAL_ERROR "LV %s missing from preload metadata", sl->seg->lv->name);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!_lv_preload(lv_pre, laopts, &flush_required))
|
if (!_lv_preload(lv_pre_tmp, laopts, &flush_required))
|
||||||
goto_out;
|
goto_out;
|
||||||
}
|
}
|
||||||
/* Now preload the PVMOVE LV itself */
|
/* Now preload the PVMOVE LV itself */
|
||||||
if (!(lv_pre = find_lv(incore_lv->vg, pvmove_lv->name))) {
|
if (!(lv_pre_tmp = find_lv(lv_pre->vg, pvmove_lv->name))) {
|
||||||
log_error(INTERNAL_ERROR "LV %s missing from preload metadata", pvmove_lv->name);
|
log_error(INTERNAL_ERROR "LV %s missing from preload metadata", pvmove_lv->name);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!_lv_preload(lv_pre, laopts, &flush_required))
|
if (!_lv_preload(lv_pre_tmp, laopts, &flush_required))
|
||||||
goto_out;
|
goto_out;
|
||||||
} else {
|
} else {
|
||||||
if (!_lv_preload(incore_lv, laopts, &flush_required))
|
if (!_lv_preload(lv_pre, laopts, &flush_required))
|
||||||
/* FIXME Revert preloading */
|
/* FIXME Revert preloading */
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search for existing LVs that have become detached and preload them.
|
* Search for existing LVs that have become detached and preload them.
|
||||||
*/
|
*/
|
||||||
detached.lv_pre = incore_lv;
|
detached.lv_pre = lv_pre;
|
||||||
detached.laopts = laopts;
|
detached.laopts = laopts;
|
||||||
detached.flush_required = &flush_required;
|
detached.flush_required = &flush_required;
|
||||||
|
|
||||||
if (!for_each_sub_lv((struct logical_volume *)ondisk_lv, &_preload_detached_lv, &detached))
|
if (!for_each_sub_lv((struct logical_volume *)lv, &_preload_detached_lv, &detached))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Preload any snapshots that are being removed.
|
* Preload any snapshots that are being removed.
|
||||||
*/
|
*/
|
||||||
if (!laopts->origin_only && lv_is_origin(ondisk_lv)) {
|
if (!laopts->origin_only && lv_is_origin(lv)) {
|
||||||
dm_list_iterate_items_gen(snap_seg, &ondisk_lv->snapshot_segs, origin_list) {
|
dm_list_iterate_items_gen(snap_seg, &lv->snapshot_segs, origin_list) {
|
||||||
if (!(lv_pre = find_lv_in_vg_by_lvid(incore_lv->vg, &snap_seg->cow->lvid))) {
|
if (!(lv_pre_tmp = find_lv_in_vg_by_lvid(lv_pre->vg, &snap_seg->cow->lvid))) {
|
||||||
log_error(INTERNAL_ERROR "LV %s (%s) missing from preload metadata",
|
log_error(INTERNAL_ERROR "LV %s (%s) missing from preload metadata",
|
||||||
snap_seg->cow->name, snap_seg->cow->lvid.id[1].uuid);
|
snap_seg->cow->name, snap_seg->cow->lvid.id[1].uuid);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!lv_is_cow(lv_pre) &&
|
if (!lv_is_cow(lv_pre_tmp) &&
|
||||||
!_lv_preload(lv_pre, laopts, &flush_required))
|
!_lv_preload(lv_pre_tmp, laopts, &flush_required))
|
||||||
goto_out;
|
goto_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!monitor_dev_for_events(cmd, ondisk_lv, laopts, 0))
|
if (!monitor_dev_for_events(cmd, lv, laopts, 0))
|
||||||
/* FIXME Consider aborting here */
|
/* FIXME Consider aborting here */
|
||||||
stack;
|
stack;
|
||||||
|
|
||||||
@ -1912,14 +1912,14 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
critical_section_inc(cmd, "suspending pvmove LV");
|
critical_section_inc(cmd, "suspending pvmove LV");
|
||||||
|
|
||||||
if (!laopts->origin_only &&
|
if (!laopts->origin_only &&
|
||||||
(lv_is_origin(incore_lv) || lv_is_cow(incore_lv)))
|
(lv_is_origin(lv_pre) || lv_is_cow(lv_pre)))
|
||||||
lockfs = 1;
|
lockfs = 1;
|
||||||
|
|
||||||
/* Converting non-thin LV to thin external origin ? */
|
/* Converting non-thin LV to thin external origin ? */
|
||||||
if (!lv_is_thin_volume(ondisk_lv) && lv_is_thin_volume(incore_lv))
|
if (!lv_is_thin_volume(lv) && lv_is_thin_volume(lv_pre))
|
||||||
lockfs = 1; /* Sync before conversion */
|
lockfs = 1; /* Sync before conversion */
|
||||||
|
|
||||||
if (laopts->origin_only && lv_is_thin_volume(ondisk_lv) && lv_is_thin_volume(incore_lv))
|
if (laopts->origin_only && lv_is_thin_volume(lv) && lv_is_thin_volume(lv_pre))
|
||||||
lockfs = 1;
|
lockfs = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1930,9 +1930,9 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
* inactive table to load or not instead so lv_suspend
|
* inactive table to load or not instead so lv_suspend
|
||||||
* can be called separately for each LV safely.
|
* can be called separately for each LV safely.
|
||||||
*/
|
*/
|
||||||
if ((incore_lv->vg->status & PRECOMMITTED) &&
|
if ((lv_pre->vg->status & PRECOMMITTED) &&
|
||||||
lv_is_locked(incore_lv) && find_pvmove_lv_in_lv(incore_lv)) {
|
lv_is_locked(lv_pre) && find_pvmove_lv_in_lv(lv_pre)) {
|
||||||
if (!_lv_suspend_lv(incore_lv, laopts, lockfs, flush_required)) {
|
if (!_lv_suspend_lv(lv_pre, laopts, lockfs, flush_required)) {
|
||||||
critical_section_dec(cmd, "failed precommitted suspend");
|
critical_section_dec(cmd, "failed precommitted suspend");
|
||||||
if (pvmove_lv)
|
if (pvmove_lv)
|
||||||
critical_section_dec(cmd, "failed precommitted suspend (pvmove)");
|
critical_section_dec(cmd, "failed precommitted suspend (pvmove)");
|
||||||
@ -1940,7 +1940,7 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Normal suspend */
|
/* Normal suspend */
|
||||||
if (!_lv_suspend_lv(ondisk_lv, laopts, lockfs, flush_required)) {
|
if (!_lv_suspend_lv(lv, laopts, lockfs, flush_required)) {
|
||||||
critical_section_dec(cmd, "failed suspend");
|
critical_section_dec(cmd, "failed suspend");
|
||||||
if (pvmove_lv)
|
if (pvmove_lv)
|
||||||
critical_section_dec(cmd, "failed suspend (pvmove)");
|
critical_section_dec(cmd, "failed suspend (pvmove)");
|
||||||
@ -1950,11 +1950,11 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
|
|
||||||
r = 1;
|
r = 1;
|
||||||
out:
|
out:
|
||||||
if (incore_lv_to_free)
|
if (lv_pre_to_free)
|
||||||
release_vg(incore_lv_to_free->vg);
|
release_vg(lv_pre_to_free->vg);
|
||||||
if (ondisk_lv_to_free) {
|
if (lv_to_free) {
|
||||||
lv_release_replicator_vgs(ondisk_lv_to_free);
|
lv_release_replicator_vgs(lv_to_free);
|
||||||
release_vg(ondisk_lv_to_free->vg);
|
release_vg(lv_to_free->vg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
@ -1967,14 +1967,14 @@ out:
|
|||||||
* Returns success if the device is not active
|
* Returns success if the device is not active
|
||||||
*/
|
*/
|
||||||
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive,
|
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive,
|
||||||
const struct logical_volume *ondisk_lv, const struct logical_volume *incore_lv)
|
const struct logical_volume *lv, const struct logical_volume *lv_pre)
|
||||||
{
|
{
|
||||||
struct lv_activate_opts laopts = {
|
struct lv_activate_opts laopts = {
|
||||||
.origin_only = origin_only,
|
.origin_only = origin_only,
|
||||||
.exclusive = exclusive
|
.exclusive = exclusive
|
||||||
};
|
};
|
||||||
|
|
||||||
return _lv_suspend(cmd, lvid_s, &laopts, 0, ondisk_lv, incore_lv);
|
return _lv_suspend(cmd, lvid_s, &laopts, 0, lv, lv_pre);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No longer used */
|
/* No longer used */
|
||||||
|
@ -106,7 +106,7 @@ void activation_exit(void);
|
|||||||
|
|
||||||
/* int lv_suspend(struct cmd_context *cmd, const char *lvid_s); */
|
/* int lv_suspend(struct cmd_context *cmd, const char *lvid_s); */
|
||||||
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive,
|
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive,
|
||||||
const struct logical_volume *lv_ondisk, const struct logical_volume *lv_incore);
|
const struct logical_volume *lv, const struct logical_volume *lv_pre);
|
||||||
int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, const struct logical_volume *lv);
|
int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, const struct logical_volume *lv);
|
||||||
int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
|
int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
|
||||||
unsigned origin_only, unsigned exclusive, unsigned revert, const struct logical_volume *lv);
|
unsigned origin_only, unsigned exclusive, unsigned revert, const struct logical_volume *lv);
|
||||||
|
Loading…
Reference in New Issue
Block a user