Lines Matching refs:lv

253 	struct logical_volume *lv = find_lv(vg, name);
255 if (!lv || (uuid && strcmp(uuid, (char *)&lv->lvid)))
258 return lv;
263 struct logical_volume *lv __attribute((unused)),
273 struct logical_volume *lv,
278 if (!collapse_mirrored_lv(lv)) {
283 lv->status &= ~CONVERTING;
285 log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
290 if (!suspend_lv(cmd, lv)) {
291 log_error("Failed to lock %s", lv->name);
297 resume_lv(cmd, lv);
301 log_very_verbose("Updating \"%s\" in kernel", lv->name);
303 if (!resume_lv(cmd, lv)) {
304 log_error("Problem reactivating %s", lv->name);
309 log_print("Logical volume %s converted.", lv->name);
323 int lvconvert_poll(struct cmd_context *cmd, struct logical_volume *lv,
326 int len = strlen(lv->vg->name) + strlen(lv->name) + 2;
327 char *uuid = alloca(sizeof(lv->lvid));
334 if (!dm_snprintf(lv_full_name, len, "%s/%s", lv->vg->name, lv->name))
337 memcpy(uuid, &lv->lvid, sizeof(lv->lvid));
344 struct logical_volume *lv)
360 len = strlen(lv->name) + 32;
363 dm_snprintf(format, len, "%s_mimage_%%d", lv->name) < 0) {
368 if (!generate_lv_name(lv->vg, format, layer_name, len) ||
379 if (!insert_layer_for_lv(cmd, lv, 0, layer_name)) {
400 static int _failed_mirrors_count(struct logical_volume *lv)
406 dm_list_iterate_items(lvseg, &lv->segments) {
447 static struct logical_volume *_original_lv(struct logical_volume *lv)
449 struct logical_volume *next_lv = lv, *tmp_lv;
500 static int _using_corelog(struct logical_volume *lv)
502 return !first_seg(_original_lv(lv))->log_lv;
507 struct logical_volume *lv,
510 struct logical_volume *original_lv = _original_lv(lv);
511 if (_using_corelog(lv) && !corelog) {
514 lv->vg->extent_size,
515 lv->le_count,
519 } else if (!_using_corelog(lv) && corelog) {
527 static int _lvconvert_mirrors(struct cmd_context *cmd, struct logical_volume *lv,
542 seg = first_seg(lv);
543 existing_mirrors = lv_mirror_count(lv);
549 if (find_temporary_mirror(lv) || (lv->status & CONVERTING))
580 if (!(lv->status & PARTIAL_LV)) {
584 if ((failed_mirrors = _failed_mirrors_count(lv)) < 0)
590 if (!(lp->pvh = _failed_pv_list(lv->vg)))
592 log_lv=first_seg(lv)->log_lv;
601 lv->name, existing_mirrors);
633 if (arg_count(cmd, regionsize_ARG) && (lv->status & MIRRORED) &&
644 if ((lv->status & MIRRORED) && dm_list_size(&lv->segments) != 1) {
646 "mirror segments.", lv->name);
659 if (!(lv->status & MIRRORED)) {
661 lv->name);
673 if (!lv_remove_mirrors(cmd, lv, existing_mirrors - lp->mirrors,
678 !_lv_update_log_type(cmd, lp, lv, corelog))
680 } else if (!(lv->status & MIRRORED)) {
688 dm_list_iterate_items(seg, &lv->segments) {
700 if (!lv_add_mirrors(cmd, lv, lp->mirrors - 1, 1,
702 lv->vg->extent_size,
703 lv->le_count,
711 if (lv->status & MIRROR_NOTSYNCED) {
724 if (lv_is_origin(lv)) {
735 if (!_lv_update_log_type(cmd, lp, lv, corelog))
738 * only if the original lv is using disk log. */
739 if (seg->log_lv && !_insert_lvconvert_layer(cmd, lv)) {
744 if (!lv_add_mirrors(cmd, lv, lp->mirrors - existing_mirrors, 1,
746 lv->vg->extent_size,
747 lv->le_count,
751 layer_lv = seg_lv(first_seg(lv), 0);
752 if (!remove_layer_from_lv(lv, layer_lv) ||
754 !lv_remove(layer_lv) || !vg_write(lv->vg) ||
755 !vg_commit(lv->vg)) {
765 lv->status |= CONVERTING;
770 if (_using_corelog(lv) != corelog) {
771 if (!_lv_update_log_type(cmd, lp, lv, corelog))
775 PRIu32 " mirror(s).", lv->name,
777 if (lv->status & CONVERTING)
783 log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
785 if (!vg_write(lv->vg))
788 if (!suspend_lv(cmd, lv)) {
789 log_error("Failed to lock %s", lv->name);
790 vg_revert(lv->vg);
794 if (!vg_commit(lv->vg)) {
795 resume_lv(cmd, lv);
799 log_very_verbose("Updating \"%s\" in kernel", lv->name);
801 if (!resume_lv(cmd, lv)) {
802 log_error("Problem reactivating %s", lv->name);
813 existing_mirrors = lv_mirror_count(lv);
820 log_print("Logical volume %s converted.", lv->name);
824 backup(lv->vg);
829 struct logical_volume *lv,
835 if (!(org = find_lv(lv->vg, lp->origin))) {
840 if (org == lv) {
842 lv->name);
855 if (!lp->zero || !(lv->status & LVM_WRITE))
856 log_warn("WARNING: \"%s\" not zeroed", lv->name);
857 else if (!set_lv(cmd, lv, UINT64_C(0), 0)) {
863 if (!deactivate_lv(cmd, lv)) {
864 log_error("Couldn't deactivate LV %s.", lv->name);
868 if (!vg_add_snapshot(org, lv, NULL, org->le_count, lp->chunk_size)) {
874 if (!vg_write(lv->vg))
879 vg_revert(lv->vg);
883 if (!vg_commit(lv->vg))
891 log_print("Logical volume %s converted to snapshot.", lv->name);
894 backup(lv->vg);
898 static int lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
903 if (lv->status & LOCKED) {
904 log_error("Cannot convert locked LV %s", lv->name);
908 if (lv_is_cow(lv)) {
910 lv->name);
914 if (lv->status & PVMOVE) {
915 log_error("Unable to convert pvmove LV %s", lv->name);
919 if (arg_count(cmd, repair_ARG) && !(lv->status & MIRRORED)) {
920 log_error("Can't repair non-mirrored LV \"%s\".", lv->name);
925 if (lv->status & MIRRORED) {
926 log_error("Unable to convert mirrored LV \"%s\" into a snapshot.", lv->name);
929 if (!archive(lv->vg)) {
933 if (!lvconvert_snapshot(cmd, lv, lp)) {
937 } else if (arg_count(cmd, mirrors_ARG) || (lv->status & MIRRORED)) {
938 if (!archive(lv->vg)) {
942 if (!_lvconvert_mirrors(cmd, lv, lp)) {
989 ret = lvconvert_single(cmd, lvl->lv, &lp);
995 if (!lv_info(cmd, lvl->lv, &info, 1, 0) || !info.exists) {
999 ret = lvconvert_poll(cmd, lvl->lv,