1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Make vg_mark_partial_lvs also clear existing PARTIAL_LV flags, so it can be

issued repeatedly on the same VG, keeping the PARTIAL_LV flags up to date.
This commit is contained in:
Petr Rockai 2011-05-07 13:32:05 +00:00
parent 5510b4e7d7
commit 833a287337
4 changed files with 12 additions and 6 deletions

View File

@ -763,6 +763,8 @@ int vg_check_write_mode(struct volume_group *vg);
int lv_has_unknown_segments(const struct logical_volume *lv); int lv_has_unknown_segments(const struct logical_volume *lv);
int vg_has_unknown_segments(const struct volume_group *vg); int vg_has_unknown_segments(const struct volume_group *vg);
int vg_mark_partial_lvs(struct volume_group *vg, int clear);
struct vgcreate_params { struct vgcreate_params {
const char *vg_name; const char *vg_name;
uint32_t extent_size; uint32_t extent_size;

View File

@ -2138,11 +2138,16 @@ static int _lv_mark_if_partial_single(struct logical_volume *lv, void *data)
* propagated transitively, so LVs referencing other LVs are marked * propagated transitively, so LVs referencing other LVs are marked
* partial as well, if any of their referenced LVs are marked partial. * partial as well, if any of their referenced LVs are marked partial.
*/ */
int vg_mark_partial_lvs(struct volume_group *vg) int vg_mark_partial_lvs(struct volume_group *vg, int clear)
{ {
struct lv_list *lvl;
if (clear)
dm_list_iterate_items(lvl, &vg->lvs)
lvl->lv->status &= ~PARTIAL_LV;
if (!_lv_postorder_vg(vg, _lv_mark_if_partial_single, NULL)) if (!_lv_postorder_vg(vg, _lv_mark_if_partial_single, NULL))
return_0; return_0;
return 1; return 1;
} }
@ -2825,7 +2830,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
if (vg_missing_pv_count(correct_vg)) { if (vg_missing_pv_count(correct_vg)) {
log_verbose("There are %d physical volumes missing.", log_verbose("There are %d physical volumes missing.",
vg_missing_pv_count(correct_vg)); vg_missing_pv_count(correct_vg));
vg_mark_partial_lvs(correct_vg); vg_mark_partial_lvs(correct_vg, 1);
} }
return correct_vg; return correct_vg;
} else { } else {
@ -3179,7 +3184,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
if (vg_missing_pv_count(correct_vg)) { if (vg_missing_pv_count(correct_vg)) {
log_verbose("There are %d physical volumes missing.", log_verbose("There are %d physical volumes missing.",
vg_missing_pv_count(correct_vg)); vg_missing_pv_count(correct_vg));
vg_mark_partial_lvs(correct_vg); vg_mark_partial_lvs(correct_vg, 1);
} }
if ((correct_vg->status & PVMOVE) && !pvmove_mode()) { if ((correct_vg->status & PVMOVE) && !pvmove_mode()) {

View File

@ -471,7 +471,6 @@ struct id pv_vgid(const struct physical_volume *pv);
struct physical_volume *pv_by_path(struct cmd_context *cmd, const char *pv_name); struct physical_volume *pv_by_path(struct cmd_context *cmd, const char *pv_name);
int add_pv_to_vg(struct volume_group *vg, const char *pv_name, int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
struct physical_volume *pv); struct physical_volume *pv);
int vg_mark_partial_lvs(struct volume_group *vg);
int is_mirror_image_removable(struct logical_volume *mimage_lv, void *baton); int is_mirror_image_removable(struct logical_volume *mimage_lv, void *baton);
uint64_t find_min_mda_size(struct dm_list *mdas); uint64_t find_min_mda_size(struct dm_list *mdas);

View File

@ -343,7 +343,7 @@ static int _mirrored_transient_status(struct lv_segment *seg, char *params)
/* update PARTIAL_LV flags across the VG */ /* update PARTIAL_LV flags across the VG */
if (failed) if (failed)
vg_mark_partial_lvs(lv->vg); vg_mark_partial_lvs(lv->vg, 0);
return 1; return 1;
} }