Lines 99-113
Link Here
|
99 |
* Devices that must be created before this one can be created. |
99 |
* Devices that must be created before this one can be created. |
100 |
* Reloads get propagated to this list. Holds str_lists. |
100 |
* Reloads get propagated to this list. Holds str_lists. |
101 |
*/ |
101 |
*/ |
102 |
struct list pre_create; |
102 |
struct lvm_list pre_create; |
103 |
|
103 |
|
104 |
/* Inverse of pre_create */ |
104 |
/* Inverse of pre_create */ |
105 |
struct list pre_suspend; |
105 |
struct lvm_list pre_suspend; |
106 |
|
106 |
|
107 |
}; |
107 |
}; |
108 |
|
108 |
|
109 |
struct dl_list { |
109 |
struct dl_list { |
110 |
struct list list; |
110 |
struct lvm_list list; |
111 |
struct dev_layer *dl; |
111 |
struct dev_layer *dl; |
112 |
}; |
112 |
}; |
113 |
|
113 |
|
Lines 128-149
Link Here
|
128 |
* list of struct lv_list, contains lvs that we wish to |
128 |
* list of struct lv_list, contains lvs that we wish to |
129 |
* be active after execution. |
129 |
* be active after execution. |
130 |
*/ |
130 |
*/ |
131 |
struct list active_list; |
131 |
struct lvm_list active_list; |
132 |
|
132 |
|
133 |
/* |
133 |
/* |
134 |
* Layers that need reloading. |
134 |
* Layers that need reloading. |
135 |
*/ |
135 |
*/ |
136 |
struct list reload_list; |
136 |
struct lvm_list reload_list; |
137 |
|
137 |
|
138 |
/* |
138 |
/* |
139 |
* Layers that need suspending. |
139 |
* Layers that need suspending. |
140 |
*/ |
140 |
*/ |
141 |
struct list suspend_list; |
141 |
struct lvm_list suspend_list; |
142 |
|
142 |
|
143 |
/* |
143 |
/* |
144 |
* Layers that will need removing after activation. |
144 |
* Layers that will need removing after activation. |
145 |
*/ |
145 |
*/ |
146 |
struct list remove_list; |
146 |
struct lvm_list remove_list; |
147 |
|
147 |
|
148 |
struct hash_table *layers; |
148 |
struct hash_table *layers; |
149 |
}; |
149 |
}; |
Lines 213-219
Link Here
|
213 |
len += hyphens + 2; |
213 |
len += hyphens + 2; |
214 |
|
214 |
|
215 |
if (!(r = pool_alloc(mem, len))) { |
215 |
if (!(r = pool_alloc(mem, len))) { |
216 |
stack; |
216 |
STACK; |
217 |
return NULL; |
217 |
return NULL; |
218 |
} |
218 |
} |
219 |
|
219 |
|
Lines 260-266
Link Here
|
260 |
len = strlen(lvid) + strlen(layer) + 2; |
260 |
len = strlen(lvid) + strlen(layer) + 2; |
261 |
|
261 |
|
262 |
if (!(dlid = pool_alloc(mem, len))) { |
262 |
if (!(dlid = pool_alloc(mem, len))) { |
263 |
stack; |
263 |
STACK; |
264 |
return NULL; |
264 |
return NULL; |
265 |
} |
265 |
} |
266 |
|
266 |
|
Lines 278-284
Link Here
|
278 |
struct dm_task *dmt; |
278 |
struct dm_task *dmt; |
279 |
|
279 |
|
280 |
if (!(dmt = dm_task_create(task))) { |
280 |
if (!(dmt = dm_task_create(task))) { |
281 |
stack; |
281 |
STACK; |
282 |
return NULL; |
282 |
return NULL; |
283 |
} |
283 |
} |
284 |
|
284 |
|
Lines 305-327
Link Here
|
305 |
dmtask = mknodes ? DM_DEVICE_MKNODES : DM_DEVICE_INFO; |
305 |
dmtask = mknodes ? DM_DEVICE_MKNODES : DM_DEVICE_INFO; |
306 |
|
306 |
|
307 |
if (!(dmt = _setup_task(name, uuid, 0, dmtask))) { |
307 |
if (!(dmt = _setup_task(name, uuid, 0, dmtask))) { |
308 |
stack; |
308 |
STACK; |
309 |
return 0; |
309 |
return 0; |
310 |
} |
310 |
} |
311 |
|
311 |
|
312 |
if (!dm_task_run(dmt)) { |
312 |
if (!dm_task_run(dmt)) { |
313 |
stack; |
313 |
STACK; |
314 |
goto out; |
314 |
goto out; |
315 |
} |
315 |
} |
316 |
|
316 |
|
317 |
if (!dm_task_get_info(dmt, info)) { |
317 |
if (!dm_task_get_info(dmt, info)) { |
318 |
stack; |
318 |
STACK; |
319 |
goto out; |
319 |
goto out; |
320 |
} |
320 |
} |
321 |
|
321 |
|
322 |
if (info->exists && uuid_out) { |
322 |
if (info->exists && uuid_out) { |
323 |
if (!(u = dm_task_get_uuid(dmt))) { |
323 |
if (!(u = dm_task_get_uuid(dmt))) { |
324 |
stack; |
324 |
STACK; |
325 |
goto out; |
325 |
goto out; |
326 |
} |
326 |
} |
327 |
*uuid_out = pool_strdup(mem, u); |
327 |
*uuid_out = pool_strdup(mem, u); |
Lines 359-370
Link Here
|
359 |
char *params = NULL; |
359 |
char *params = NULL; |
360 |
|
360 |
|
361 |
if (!(dmt = _setup_task(name, uuid, 0, DM_DEVICE_STATUS))) { |
361 |
if (!(dmt = _setup_task(name, uuid, 0, DM_DEVICE_STATUS))) { |
362 |
stack; |
362 |
STACK; |
363 |
return 0; |
363 |
return 0; |
364 |
} |
364 |
} |
365 |
|
365 |
|
366 |
if (!dm_task_run(dmt)) { |
366 |
if (!dm_task_run(dmt)) { |
367 |
stack; |
367 |
STACK; |
368 |
goto out; |
368 |
goto out; |
369 |
} |
369 |
} |
370 |
|
370 |
|
Lines 428-434
Link Here
|
428 |
char *type = NULL; |
428 |
char *type = NULL; |
429 |
char *params = NULL; |
429 |
char *params = NULL; |
430 |
float percent2; |
430 |
float percent2; |
431 |
struct list *segh = &lv->segments; |
431 |
struct lvm_list *segh = &lv->segments; |
432 |
struct lv_segment *seg = NULL; |
432 |
struct lv_segment *seg = NULL; |
433 |
|
433 |
|
434 |
uint64_t numerator, denominator; |
434 |
uint64_t numerator, denominator; |
Lines 439-455
Link Here
|
439 |
if (!(dmt = _setup_task(name, uuid, event_nr, |
439 |
if (!(dmt = _setup_task(name, uuid, event_nr, |
440 |
wait ? DM_DEVICE_WAITEVENT : DM_DEVICE_STATUS))) |
440 |
wait ? DM_DEVICE_WAITEVENT : DM_DEVICE_STATUS))) |
441 |
{ |
441 |
{ |
442 |
stack; |
442 |
STACK; |
443 |
return 0; |
443 |
return 0; |
444 |
} |
444 |
} |
445 |
|
445 |
|
446 |
if (!dm_task_run(dmt)) { |
446 |
if (!dm_task_run(dmt)) { |
447 |
stack; |
447 |
STACK; |
448 |
goto out; |
448 |
goto out; |
449 |
} |
449 |
} |
450 |
|
450 |
|
451 |
if (!dm_task_get_info(dmt, &info) || !info.exists) { |
451 |
if (!dm_task_get_info(dmt, &info) || !info.exists) { |
452 |
stack; |
452 |
STACK; |
453 |
goto out; |
453 |
goto out; |
454 |
} |
454 |
} |
455 |
|
455 |
|
Lines 460-471
Link Here
|
460 |
next = dm_get_next_target(dmt, next, &start, &length, &type, |
460 |
next = dm_get_next_target(dmt, next, &start, &length, &type, |
461 |
¶ms); |
461 |
¶ms); |
462 |
if (lv) { |
462 |
if (lv) { |
463 |
if (!(segh = list_next(&lv->segments, segh))) { |
463 |
if (!(segh = lvm_list_next(&lv->segments, segh))) { |
464 |
log_error("Number of segments in active LV %s " |
464 |
log_error("Number of segments in active LV %s " |
465 |
"does not match metadata", lv->name); |
465 |
"does not match metadata", lv->name); |
466 |
goto out; |
466 |
goto out; |
467 |
} |
467 |
} |
468 |
seg = list_item(segh, struct lv_segment); |
468 |
seg = lvm_list_item(segh, struct lv_segment); |
469 |
} |
469 |
} |
470 |
|
470 |
|
471 |
if (!type || !params || strcmp(type, target_type)) |
471 |
if (!type || !params || strcmp(type, target_type)) |
Lines 507-513
Link Here
|
507 |
} |
507 |
} |
508 |
} while (next); |
508 |
} while (next); |
509 |
|
509 |
|
510 |
if (lv && (segh = list_next(&lv->segments, segh))) { |
510 |
if (lv && (segh = lvm_list_next(&lv->segments, segh))) { |
511 |
log_error("Number of segments in active LV %s does not " |
511 |
log_error("Number of segments in active LV %s does not " |
512 |
"match metadata", lv->name); |
512 |
"match metadata", lv->name); |
513 |
goto out; |
513 |
goto out; |
Lines 551-562
Link Here
|
551 |
log_verbose("Renaming %s to %s", dl->name, newname); |
551 |
log_verbose("Renaming %s to %s", dl->name, newname); |
552 |
|
552 |
|
553 |
if (!(dmt = _setup_task(dl->name, NULL, 0, DM_DEVICE_RENAME))) { |
553 |
if (!(dmt = _setup_task(dl->name, NULL, 0, DM_DEVICE_RENAME))) { |
554 |
stack; |
554 |
STACK; |
555 |
return 0; |
555 |
return 0; |
556 |
} |
556 |
} |
557 |
|
557 |
|
558 |
if (!dm_task_set_newname(dmt, newname)) { |
558 |
if (!dm_task_set_newname(dmt, newname)) { |
559 |
stack; |
559 |
STACK; |
560 |
r = 0; |
560 |
r = 0; |
561 |
goto out; |
561 |
goto out; |
562 |
} |
562 |
} |
Lines 582-588
Link Here
|
582 |
log_verbose("Loading %s", dl->name); |
582 |
log_verbose("Loading %s", dl->name); |
583 |
if (!(dmt = _setup_task(task == DM_DEVICE_CREATE ? dl->name : NULL, |
583 |
if (!(dmt = _setup_task(task == DM_DEVICE_CREATE ? dl->name : NULL, |
584 |
dl->dlid, 0, task))) { |
584 |
dl->dlid, 0, task))) { |
585 |
stack; |
585 |
STACK; |
586 |
return 0; |
586 |
return 0; |
587 |
} |
587 |
} |
588 |
|
588 |
|
Lines 639-651
Link Here
|
639 |
} |
639 |
} |
640 |
|
640 |
|
641 |
if (!dm_task_get_info(dmt, &dl->info)) { |
641 |
if (!dm_task_get_info(dmt, &dl->info)) { |
642 |
stack; |
642 |
STACK; |
643 |
r = 0; |
643 |
r = 0; |
644 |
goto out; |
644 |
goto out; |
645 |
} |
645 |
} |
646 |
|
646 |
|
647 |
if (!dl->info.exists || !dl->info.live_table) { |
647 |
if (!dl->info.exists || !dl->info.live_table) { |
648 |
stack; |
648 |
STACK; |
649 |
r = 0; |
649 |
r = 0; |
650 |
goto out; |
650 |
goto out; |
651 |
} |
651 |
} |
Lines 674-680
Link Here
|
674 |
log_very_verbose("Removing %s", dl->name); |
674 |
log_very_verbose("Removing %s", dl->name); |
675 |
|
675 |
|
676 |
if (!(dmt = _setup_task(dl->name, NULL, 0, DM_DEVICE_REMOVE))) { |
676 |
if (!(dmt = _setup_task(dl->name, NULL, 0, DM_DEVICE_REMOVE))) { |
677 |
stack; |
677 |
STACK; |
678 |
return 0; |
678 |
return 0; |
679 |
} |
679 |
} |
680 |
|
680 |
|
Lines 705-711
Link Here
|
705 |
|
705 |
|
706 |
log_very_verbose("%s %s", sus ? "Suspending" : "Resuming", name); |
706 |
log_very_verbose("%s %s", sus ? "Suspending" : "Resuming", name); |
707 |
if (!(dmt = _setup_task(name, NULL, 0, task))) { |
707 |
if (!(dmt = _setup_task(name, NULL, 0, task))) { |
708 |
stack; |
708 |
STACK; |
709 |
return 0; |
709 |
return 0; |
710 |
} |
710 |
} |
711 |
|
711 |
|
Lines 723-729
Link Here
|
723 |
return 1; |
723 |
return 1; |
724 |
|
724 |
|
725 |
if (!_suspend_or_resume(dl->name, SUSPEND)) { |
725 |
if (!_suspend_or_resume(dl->name, SUSPEND)) { |
726 |
stack; |
726 |
STACK; |
727 |
return 0; |
727 |
return 0; |
728 |
} |
728 |
} |
729 |
|
729 |
|
Lines 737-743
Link Here
|
737 |
return 1; |
737 |
return 1; |
738 |
|
738 |
|
739 |
if (!_suspend_or_resume(dl->name, RESUME)) { |
739 |
if (!_suspend_or_resume(dl->name, RESUME)) { |
740 |
stack; |
740 |
STACK; |
741 |
return 0; |
741 |
return 0; |
742 |
} |
742 |
} |
743 |
|
743 |
|
Lines 858-864
Link Here
|
858 |
|
858 |
|
859 |
if (!dm_task_add_target(dmt, esize * seg->le, esize * seg->len, |
859 |
if (!dm_task_add_target(dmt, esize * seg->le, esize * seg->len, |
860 |
target, params)) { |
860 |
target, params)) { |
861 |
stack; |
861 |
STACK; |
862 |
return 0; |
862 |
return 0; |
863 |
} |
863 |
} |
864 |
|
864 |
|
Lines 887-893
Link Here
|
887 |
dbg_free(params); |
887 |
dbg_free(params); |
888 |
|
888 |
|
889 |
if (!ret) |
889 |
if (!ret) |
890 |
stack; |
890 |
STACK; |
891 |
|
891 |
|
892 |
if (ret >= 0) |
892 |
if (ret >= 0) |
893 |
return ret; |
893 |
return ret; |
Lines 902-915
Link Here
|
902 |
static int _populate_vanilla(struct dev_manager *dm, |
902 |
static int _populate_vanilla(struct dev_manager *dm, |
903 |
struct dm_task *dmt, struct dev_layer *dl) |
903 |
struct dm_task *dmt, struct dev_layer *dl) |
904 |
{ |
904 |
{ |
905 |
struct list *segh; |
905 |
struct lvm_list *segh; |
906 |
struct lv_segment *seg; |
906 |
struct lv_segment *seg; |
907 |
struct logical_volume *lv = dl->lv; |
907 |
struct logical_volume *lv = dl->lv; |
908 |
|
908 |
|
909 |
dm->pvmove_mirror_count = 0u; |
909 |
dm->pvmove_mirror_count = 0u; |
910 |
|
910 |
|
911 |
list_iterate(segh, &lv->segments) { |
911 |
lvm_list_iterate(segh, &lv->segments) { |
912 |
seg = list_item(segh, struct lv_segment); |
912 |
seg = lvm_list_item(segh, struct lv_segment); |
913 |
if (!_emit_target(dm, dmt, seg)) { |
913 |
if (!_emit_target(dm, dmt, seg)) { |
914 |
log_error("Unable to build table for '%s'", lv->name); |
914 |
log_error("Unable to build table for '%s'", lv->name); |
915 |
return 0; |
915 |
return 0; |
Lines 927-933
Link Here
|
927 |
struct dev_layer *dlr; |
927 |
struct dev_layer *dlr; |
928 |
|
928 |
|
929 |
if (!(real = _build_dlid(dm->mem, dl->lv->lvid.s, "real"))) { |
929 |
if (!(real = _build_dlid(dm->mem, dl->lv->lvid.s, "real"))) { |
930 |
stack; |
930 |
STACK; |
931 |
return 0; |
931 |
return 0; |
932 |
} |
932 |
} |
933 |
|
933 |
|
Lines 947-953
Link Here
|
947 |
dl->lv->size, params); |
947 |
dl->lv->size, params); |
948 |
if (!dm_task_add_target(dmt, UINT64_C(0), dl->lv->size, |
948 |
if (!dm_task_add_target(dmt, UINT64_C(0), dl->lv->size, |
949 |
"snapshot-origin", params)) { |
949 |
"snapshot-origin", params)) { |
950 |
stack; |
950 |
STACK; |
951 |
return 0; |
951 |
return 0; |
952 |
} |
952 |
} |
953 |
|
953 |
|
Lines 969-980
Link Here
|
969 |
} |
969 |
} |
970 |
|
970 |
|
971 |
if (!(origin = _build_dlid(dm->mem, s->origin->lvid.s, "real"))) { |
971 |
if (!(origin = _build_dlid(dm->mem, s->origin->lvid.s, "real"))) { |
972 |
stack; |
972 |
STACK; |
973 |
return 0; |
973 |
return 0; |
974 |
} |
974 |
} |
975 |
|
975 |
|
976 |
if (!(cow = _build_dlid(dm->mem, s->cow->lvid.s, "cow"))) { |
976 |
if (!(cow = _build_dlid(dm->mem, s->cow->lvid.s, "cow"))) { |
977 |
stack; |
977 |
STACK; |
978 |
return 0; |
978 |
return 0; |
979 |
} |
979 |
} |
980 |
|
980 |
|
Lines 1005-1011
Link Here
|
1005 |
|
1005 |
|
1006 |
if (lvm_snprintf(params, sizeof(params), "%s %s P %d", |
1006 |
if (lvm_snprintf(params, sizeof(params), "%s %s P %d", |
1007 |
devbufo, devbufc, s->chunk_size) == -1) { |
1007 |
devbufo, devbufc, s->chunk_size) == -1) { |
1008 |
stack; |
1008 |
STACK; |
1009 |
return 0; |
1009 |
return 0; |
1010 |
} |
1010 |
} |
1011 |
|
1011 |
|
Lines 1013-1019
Link Here
|
1013 |
s->origin->size, params); |
1013 |
s->origin->size, params); |
1014 |
if (!dm_task_add_target |
1014 |
if (!dm_task_add_target |
1015 |
(dmt, UINT64_C(0), s->origin->size, "snapshot", params)) { |
1015 |
(dmt, UINT64_C(0), s->origin->size, "snapshot", params)) { |
1016 |
stack; |
1016 |
STACK; |
1017 |
return 0; |
1017 |
return 0; |
1018 |
} |
1018 |
} |
1019 |
|
1019 |
|
Lines 1030-1041
Link Here
|
1030 |
struct dev_manager *dm; |
1030 |
struct dev_manager *dm; |
1031 |
|
1031 |
|
1032 |
if (!(mem = pool_create(16 * 1024))) { |
1032 |
if (!(mem = pool_create(16 * 1024))) { |
1033 |
stack; |
1033 |
STACK; |
1034 |
return NULL; |
1034 |
return NULL; |
1035 |
} |
1035 |
} |
1036 |
|
1036 |
|
1037 |
if (!(dm = pool_alloc(mem, sizeof(*dm)))) { |
1037 |
if (!(dm = pool_alloc(mem, sizeof(*dm)))) { |
1038 |
stack; |
1038 |
STACK; |
1039 |
goto bad; |
1039 |
goto bad; |
1040 |
} |
1040 |
} |
1041 |
|
1041 |
|
Lines 1056-1074
Link Here
|
1056 |
dm->mirror_region_size = mirror_region_size; |
1056 |
dm->mirror_region_size = mirror_region_size; |
1057 |
|
1057 |
|
1058 |
if (!(dm->vg_name = pool_strdup(dm->mem, vg_name))) { |
1058 |
if (!(dm->vg_name = pool_strdup(dm->mem, vg_name))) { |
1059 |
stack; |
1059 |
STACK; |
1060 |
goto bad; |
1060 |
goto bad; |
1061 |
} |
1061 |
} |
1062 |
|
1062 |
|
1063 |
if (!(dm->layers = hash_create(32))) { |
1063 |
if (!(dm->layers = hash_create(32))) { |
1064 |
stack; |
1064 |
STACK; |
1065 |
goto bad; |
1065 |
goto bad; |
1066 |
} |
1066 |
} |
1067 |
|
1067 |
|
1068 |
list_init(&dm->active_list); |
1068 |
lvm_list_init(&dm->active_list); |
1069 |
list_init(&dm->reload_list); |
1069 |
lvm_list_init(&dm->reload_list); |
1070 |
list_init(&dm->remove_list); |
1070 |
lvm_list_init(&dm->remove_list); |
1071 |
list_init(&dm->suspend_list); |
1071 |
lvm_list_init(&dm->suspend_list); |
1072 |
|
1072 |
|
1073 |
return dm; |
1073 |
return dm; |
1074 |
|
1074 |
|
Lines 1092-1098
Link Here
|
1092 |
* Build a name for the top layer. |
1092 |
* Build a name for the top layer. |
1093 |
*/ |
1093 |
*/ |
1094 |
if (!(name = _build_name(dm->mem, lv->vg->name, lv->name, NULL))) { |
1094 |
if (!(name = _build_name(dm->mem, lv->vg->name, lv->name, NULL))) { |
1095 |
stack; |
1095 |
STACK; |
1096 |
return 0; |
1096 |
return 0; |
1097 |
} |
1097 |
} |
1098 |
|
1098 |
|
Lines 1101-1107
Link Here
|
1101 |
*/ |
1101 |
*/ |
1102 |
log_debug("Getting device info for %s", name); |
1102 |
log_debug("Getting device info for %s", name); |
1103 |
if (!_info(name, lv->lvid.s, mknodes, info, NULL, NULL)) { |
1103 |
if (!_info(name, lv->lvid.s, mknodes, info, NULL, NULL)) { |
1104 |
stack; |
1104 |
STACK; |
1105 |
return 0; |
1105 |
return 0; |
1106 |
} |
1106 |
} |
1107 |
|
1107 |
|
Lines 1117-1123
Link Here
|
1117 |
* Build a name for the top layer. |
1117 |
* Build a name for the top layer. |
1118 |
*/ |
1118 |
*/ |
1119 |
if (!(name = _build_name(dm->mem, lv->vg->name, lv->name, NULL))) { |
1119 |
if (!(name = _build_name(dm->mem, lv->vg->name, lv->name, NULL))) { |
1120 |
stack; |
1120 |
STACK; |
1121 |
return 0; |
1121 |
return 0; |
1122 |
} |
1122 |
} |
1123 |
|
1123 |
|
Lines 1127-1133
Link Here
|
1127 |
log_debug("Getting device status percentage for %s", name); |
1127 |
log_debug("Getting device status percentage for %s", name); |
1128 |
if (!(_percent(dm, name, lv->lvid.s, "snapshot", 0, NULL, percent, |
1128 |
if (!(_percent(dm, name, lv->lvid.s, "snapshot", 0, NULL, percent, |
1129 |
NULL))) { |
1129 |
NULL))) { |
1130 |
stack; |
1130 |
STACK; |
1131 |
return 0; |
1131 |
return 0; |
1132 |
} |
1132 |
} |
1133 |
|
1133 |
|
Lines 1149-1155
Link Here
|
1149 |
* Build a name for the top layer. |
1149 |
* Build a name for the top layer. |
1150 |
*/ |
1150 |
*/ |
1151 |
if (!(name = _build_name(dm->mem, lv->vg->name, lv->name, NULL))) { |
1151 |
if (!(name = _build_name(dm->mem, lv->vg->name, lv->name, NULL))) { |
1152 |
stack; |
1152 |
STACK; |
1153 |
return 0; |
1153 |
return 0; |
1154 |
} |
1154 |
} |
1155 |
|
1155 |
|
Lines 1158-1164
Link Here
|
1158 |
log_debug("Getting device mirror status percentage for %s", name); |
1158 |
log_debug("Getting device mirror status percentage for %s", name); |
1159 |
if (!(_percent(dm, name, lv->lvid.s, "mirror", wait, lv, percent, |
1159 |
if (!(_percent(dm, name, lv->lvid.s, "mirror", wait, lv, percent, |
1160 |
event_nr))) { |
1160 |
event_nr))) { |
1161 |
stack; |
1161 |
STACK; |
1162 |
return 0; |
1162 |
return 0; |
1163 |
} |
1163 |
} |
1164 |
|
1164 |
|
Lines 1172-1178
Link Here
|
1172 |
char *uuid; |
1172 |
char *uuid; |
1173 |
|
1173 |
|
1174 |
if (!(dl = pool_zalloc(dm->mem, sizeof(*dl)))) { |
1174 |
if (!(dl = pool_zalloc(dm->mem, sizeof(*dl)))) { |
1175 |
stack; |
1175 |
STACK; |
1176 |
return NULL; |
1176 |
return NULL; |
1177 |
} |
1177 |
} |
1178 |
|
1178 |
|
Lines 1180-1186
Link Here
|
1180 |
|
1180 |
|
1181 |
log_debug("Getting device info for %s", dl->name); |
1181 |
log_debug("Getting device info for %s", dl->name); |
1182 |
if (!_info(dl->name, dlid, 0, &dl->info, dm->mem, &uuid)) { |
1182 |
if (!_info(dl->name, dlid, 0, &dl->info, dm->mem, &uuid)) { |
1183 |
stack; |
1183 |
STACK; |
1184 |
return NULL; |
1184 |
return NULL; |
1185 |
} |
1185 |
} |
1186 |
|
1186 |
|
Lines 1189-1199
Link Here
|
1189 |
else |
1189 |
else |
1190 |
dl->dlid = dlid; |
1190 |
dl->dlid = dlid; |
1191 |
|
1191 |
|
1192 |
list_init(&dl->pre_create); |
1192 |
lvm_list_init(&dl->pre_create); |
1193 |
list_init(&dl->pre_suspend); |
1193 |
lvm_list_init(&dl->pre_suspend); |
1194 |
|
1194 |
|
1195 |
if (!hash_insert(dm->layers, dl->dlid, dl)) { |
1195 |
if (!hash_insert(dm->layers, dl->dlid, dl)) { |
1196 |
stack; |
1196 |
STACK; |
1197 |
return NULL; |
1197 |
return NULL; |
1198 |
} |
1198 |
} |
1199 |
|
1199 |
|
Lines 1213-1230
Link Here
|
1213 |
struct dev_layer *dl; |
1213 |
struct dev_layer *dl; |
1214 |
|
1214 |
|
1215 |
if (!(name = _build_name(dm->mem, lv->vg->name, lv->name, layer))) { |
1215 |
if (!(name = _build_name(dm->mem, lv->vg->name, lv->name, layer))) { |
1216 |
stack; |
1216 |
STACK; |
1217 |
return NULL; |
1217 |
return NULL; |
1218 |
} |
1218 |
} |
1219 |
|
1219 |
|
1220 |
if (!(dlid = _build_dlid(dm->mem, lv->lvid.s, layer))) { |
1220 |
if (!(dlid = _build_dlid(dm->mem, lv->lvid.s, layer))) { |
1221 |
stack; |
1221 |
STACK; |
1222 |
return NULL; |
1222 |
return NULL; |
1223 |
} |
1223 |
} |
1224 |
|
1224 |
|
1225 |
if (!(dl = hash_lookup(dm->layers, dlid)) && |
1225 |
if (!(dl = hash_lookup(dm->layers, dlid)) && |
1226 |
!(dl = _create_dev(dm, name, dlid))) { |
1226 |
!(dl = _create_dev(dm, name, dlid))) { |
1227 |
stack; |
1227 |
STACK; |
1228 |
return NULL; |
1228 |
return NULL; |
1229 |
} |
1229 |
} |
1230 |
|
1230 |
|
Lines 1246-1252
Link Here
|
1246 |
struct dev_layer *dl; |
1246 |
struct dev_layer *dl; |
1247 |
|
1247 |
|
1248 |
if (!(dlid = _build_dlid(dm->mem, lvid, layer))) { |
1248 |
if (!(dlid = _build_dlid(dm->mem, lvid, layer))) { |
1249 |
stack; |
1249 |
STACK; |
1250 |
return NULL; |
1250 |
return NULL; |
1251 |
} |
1251 |
} |
1252 |
|
1252 |
|
Lines 1262-1273
Link Here
|
1262 |
* only one layer. |
1262 |
* only one layer. |
1263 |
*/ |
1263 |
*/ |
1264 |
struct dev_layer *dl, *dlr; |
1264 |
struct dev_layer *dl, *dlr; |
1265 |
struct list *segh; |
1265 |
struct lvm_list *segh; |
1266 |
struct lv_segment *seg; |
1266 |
struct lv_segment *seg; |
1267 |
uint32_t s; |
1267 |
uint32_t s; |
1268 |
|
1268 |
|
1269 |
if (!(dl = _create_layer(dm, NULL, lv))) { |
1269 |
if (!(dl = _create_layer(dm, NULL, lv))) { |
1270 |
stack; |
1270 |
STACK; |
1271 |
return 0; |
1271 |
return 0; |
1272 |
} |
1272 |
} |
1273 |
dl->populate = _populate_vanilla; |
1273 |
dl->populate = _populate_vanilla; |
Lines 1280-1287
Link Here
|
1280 |
_set_flag(dl, TOPLEVEL); |
1280 |
_set_flag(dl, TOPLEVEL); |
1281 |
|
1281 |
|
1282 |
/* Add dependencies for any LVs that segments refer to */ |
1282 |
/* Add dependencies for any LVs that segments refer to */ |
1283 |
list_iterate(segh, &lv->segments) { |
1283 |
lvm_list_iterate(segh, &lv->segments) { |
1284 |
seg = list_item(segh, struct lv_segment); |
1284 |
seg = lvm_list_item(segh, struct lv_segment); |
1285 |
if (seg->type != SEG_STRIPED && seg->type != SEG_MIRRORED) |
1285 |
if (seg->type != SEG_STRIPED && seg->type != SEG_MIRRORED) |
1286 |
continue; |
1286 |
continue; |
1287 |
for (s = 0; s < seg->area_count; s++) { |
1287 |
for (s = 0; s < seg->area_count; s++) { |
Lines 1291-1297
Link Here
|
1291 |
_build_dlid(dm->mem, |
1291 |
_build_dlid(dm->mem, |
1292 |
seg->area[s].u.lv. |
1292 |
seg->area[s].u.lv. |
1293 |
lv->lvid.s, NULL))) { |
1293 |
lv->lvid.s, NULL))) { |
1294 |
stack; |
1294 |
STACK; |
1295 |
return 0; |
1295 |
return 0; |
1296 |
} |
1296 |
} |
1297 |
_set_flag(dl, NOPROPAGATE); |
1297 |
_set_flag(dl, NOPROPAGATE); |
Lines 1303-1309
Link Here
|
1303 |
|
1303 |
|
1304 |
/* Deactivating the last snapshot */ |
1304 |
/* Deactivating the last snapshot */ |
1305 |
if (!(dlr = _create_layer(dm, "real", lv))) { |
1305 |
if (!(dlr = _create_layer(dm, "real", lv))) { |
1306 |
stack; |
1306 |
STACK; |
1307 |
return 0; |
1307 |
return 0; |
1308 |
} |
1308 |
} |
1309 |
|
1309 |
|
Lines 1315-1321
Link Here
|
1315 |
/* add the dependency on the real device */ |
1315 |
/* add the dependency on the real device */ |
1316 |
if (!str_list_add(dm->mem, &dl->pre_create, |
1316 |
if (!str_list_add(dm->mem, &dl->pre_create, |
1317 |
pool_strdup(dm->mem, dlr->dlid))) { |
1317 |
pool_strdup(dm->mem, dlr->dlid))) { |
1318 |
stack; |
1318 |
STACK; |
1319 |
return 0; |
1319 |
return 0; |
1320 |
} |
1320 |
} |
1321 |
|
1321 |
|
Lines 1329-1335
Link Here
|
1329 |
const char *real_dlid; |
1329 |
const char *real_dlid; |
1330 |
|
1330 |
|
1331 |
if (!(dl = _create_layer(dm, "real", lv))) { |
1331 |
if (!(dl = _create_layer(dm, "real", lv))) { |
1332 |
stack; |
1332 |
STACK; |
1333 |
return 0; |
1333 |
return 0; |
1334 |
} |
1334 |
} |
1335 |
dl->populate = _populate_vanilla; |
1335 |
dl->populate = _populate_vanilla; |
Lines 1339-1345
Link Here
|
1339 |
real_dlid = dl->dlid; |
1339 |
real_dlid = dl->dlid; |
1340 |
|
1340 |
|
1341 |
if (!(dl = _create_layer(dm, NULL, lv))) { |
1341 |
if (!(dl = _create_layer(dm, NULL, lv))) { |
1342 |
stack; |
1342 |
STACK; |
1343 |
return 0; |
1343 |
return 0; |
1344 |
} |
1344 |
} |
1345 |
dl->populate = _populate_origin; |
1345 |
dl->populate = _populate_origin; |
Lines 1349-1355
Link Here
|
1349 |
/* add the dependency on the real device */ |
1349 |
/* add the dependency on the real device */ |
1350 |
if (!str_list_add(dm->mem, &dl->pre_create, |
1350 |
if (!str_list_add(dm->mem, &dl->pre_create, |
1351 |
pool_strdup(dm->mem, real_dlid))) { |
1351 |
pool_strdup(dm->mem, real_dlid))) { |
1352 |
stack; |
1352 |
STACK; |
1353 |
return 0; |
1353 |
return 0; |
1354 |
} |
1354 |
} |
1355 |
|
1355 |
|
Lines 1360-1373
Link Here
|
1360 |
{ |
1360 |
{ |
1361 |
struct logical_volume *active; |
1361 |
struct logical_volume *active; |
1362 |
struct snapshot *s; |
1362 |
struct snapshot *s; |
1363 |
struct list *sh; |
1363 |
struct lvm_list *sh; |
1364 |
|
1364 |
|
1365 |
/* |
1365 |
/* |
1366 |
* We only need to create an origin layer if one of our |
1366 |
* We only need to create an origin layer if one of our |
1367 |
* snapshots is in the active list |
1367 |
* snapshots is in the active list |
1368 |
*/ |
1368 |
*/ |
1369 |
list_iterate(sh, &dm->active_list) { |
1369 |
lvm_list_iterate(sh, &dm->active_list) { |
1370 |
active = list_item(sh, struct lv_list)->lv; |
1370 |
active = lvm_list_item(sh, struct lv_list)->lv; |
1371 |
if ((s = find_cow(active)) && (s->origin == lv)) |
1371 |
if ((s = find_cow(active)) && (s->origin == lv)) |
1372 |
return _expand_origin_real(dm, lv); |
1372 |
return _expand_origin_real(dm, lv); |
1373 |
} |
1373 |
} |
Lines 1389-1395
Link Here
|
1389 |
const char *cow_dlid; |
1389 |
const char *cow_dlid; |
1390 |
|
1390 |
|
1391 |
if (!(dl = _create_layer(dm, "cow", lv))) { |
1391 |
if (!(dl = _create_layer(dm, "cow", lv))) { |
1392 |
stack; |
1392 |
STACK; |
1393 |
return 0; |
1393 |
return 0; |
1394 |
} |
1394 |
} |
1395 |
dl->populate = _populate_vanilla; |
1395 |
dl->populate = _populate_vanilla; |
Lines 1400-1406
Link Here
|
1400 |
cow_dlid = dl->dlid; |
1400 |
cow_dlid = dl->dlid; |
1401 |
|
1401 |
|
1402 |
if (!(dl = _create_layer(dm, NULL, lv))) { |
1402 |
if (!(dl = _create_layer(dm, NULL, lv))) { |
1403 |
stack; |
1403 |
STACK; |
1404 |
return 0; |
1404 |
return 0; |
1405 |
} |
1405 |
} |
1406 |
dl->populate = _populate_snapshot; |
1406 |
dl->populate = _populate_snapshot; |
Lines 1410-1429
Link Here
|
1410 |
/* add the dependency on the cow device */ |
1410 |
/* add the dependency on the cow device */ |
1411 |
if (!str_list_add(dm->mem, &dl->pre_create, |
1411 |
if (!str_list_add(dm->mem, &dl->pre_create, |
1412 |
pool_strdup(dm->mem, cow_dlid))) { |
1412 |
pool_strdup(dm->mem, cow_dlid))) { |
1413 |
stack; |
1413 |
STACK; |
1414 |
return 0; |
1414 |
return 0; |
1415 |
} |
1415 |
} |
1416 |
|
1416 |
|
1417 |
/* add the dependency on the real origin device */ |
1417 |
/* add the dependency on the real origin device */ |
1418 |
if (!str_list_add(dm->mem, &dl->pre_create, |
1418 |
if (!str_list_add(dm->mem, &dl->pre_create, |
1419 |
_build_dlid(dm->mem, s->origin->lvid.s, "real"))) { |
1419 |
_build_dlid(dm->mem, s->origin->lvid.s, "real"))) { |
1420 |
stack; |
1420 |
STACK; |
1421 |
return 0; |
1421 |
return 0; |
1422 |
} |
1422 |
} |
1423 |
|
1423 |
|
1424 |
/* add the dependency on the visible origin device */ |
1424 |
/* add the dependency on the visible origin device */ |
1425 |
if (!str_list_add(dm->mem, &dl->pre_suspend, s->origin->lvid.s)) { |
1425 |
if (!str_list_add(dm->mem, &dl->pre_suspend, s->origin->lvid.s)) { |
1426 |
stack; |
1426 |
STACK; |
1427 |
return 0; |
1427 |
return 0; |
1428 |
} |
1428 |
} |
1429 |
|
1429 |
|
Lines 1469-1480
Link Here
|
1469 |
static int _trace_layer_marks(struct dev_manager *dm, struct dev_layer *dl, |
1469 |
static int _trace_layer_marks(struct dev_manager *dm, struct dev_layer *dl, |
1470 |
int flag) |
1470 |
int flag) |
1471 |
{ |
1471 |
{ |
1472 |
struct list *sh; |
1472 |
struct lvm_list *sh; |
1473 |
const char *dlid; |
1473 |
const char *dlid; |
1474 |
struct dev_layer *dep; |
1474 |
struct dev_layer *dep; |
1475 |
|
1475 |
|
1476 |
list_iterate(sh, &dl->pre_create) { |
1476 |
lvm_list_iterate(sh, &dl->pre_create) { |
1477 |
dlid = list_item(sh, struct str_list)->str; |
1477 |
dlid = lvm_list_item(sh, struct str_list)->str; |
1478 |
|
1478 |
|
1479 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1479 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1480 |
log_error("Couldn't find device layer '%s'.", dlid); |
1480 |
log_error("Couldn't find device layer '%s'.", dlid); |
Lines 1491-1497
Link Here
|
1491 |
_set_flag(dep, flag); |
1491 |
_set_flag(dep, flag); |
1492 |
|
1492 |
|
1493 |
if (!_trace_layer_marks(dm, dep, flag)) { |
1493 |
if (!_trace_layer_marks(dm, dep, flag)) { |
1494 |
stack; |
1494 |
STACK; |
1495 |
return 0; |
1495 |
return 0; |
1496 |
} |
1496 |
} |
1497 |
} |
1497 |
} |
Lines 1510-1516
Link Here
|
1510 |
hash_iterate(hn, dm->layers) { |
1510 |
hash_iterate(hn, dm->layers) { |
1511 |
dl = hash_get_data(dm->layers, hn); |
1511 |
dl = hash_get_data(dm->layers, hn); |
1512 |
if (_get_flag(dl, flag) && !_trace_layer_marks(dm, dl, flag)) { |
1512 |
if (_get_flag(dl, flag) && !_trace_layer_marks(dm, dl, flag)) { |
1513 |
stack; |
1513 |
STACK; |
1514 |
return 0; |
1514 |
return 0; |
1515 |
} |
1515 |
} |
1516 |
} |
1516 |
} |
Lines 1522-1538
Link Here
|
1522 |
* Marks the top layers, then traces these through the |
1522 |
* Marks the top layers, then traces these through the |
1523 |
* dependencies. |
1523 |
* dependencies. |
1524 |
*/ |
1524 |
*/ |
1525 |
static int _mark_lvs(struct dev_manager *dm, struct list *lvs, int flag) |
1525 |
static int _mark_lvs(struct dev_manager *dm, struct lvm_list *lvs, int flag) |
1526 |
{ |
1526 |
{ |
1527 |
struct list *lvh; |
1527 |
struct lvm_list *lvh; |
1528 |
struct logical_volume *lv; |
1528 |
struct logical_volume *lv; |
1529 |
struct dev_layer *dl; |
1529 |
struct dev_layer *dl; |
1530 |
|
1530 |
|
1531 |
list_iterate(lvh, lvs) { |
1531 |
lvm_list_iterate(lvh, lvs) { |
1532 |
lv = list_item(lvh, struct lv_list)->lv; |
1532 |
lv = lvm_list_item(lvh, struct lv_list)->lv; |
1533 |
|
1533 |
|
1534 |
if (!(dl = _lookup(dm, lv->lvid.s, NULL))) { |
1534 |
if (!(dl = _lookup(dm, lv->lvid.s, NULL))) { |
1535 |
stack; |
1535 |
STACK; |
1536 |
return 0; |
1536 |
return 0; |
1537 |
} |
1537 |
} |
1538 |
|
1538 |
|
Lines 1540-1546
Link Here
|
1540 |
} |
1540 |
} |
1541 |
|
1541 |
|
1542 |
if (!_trace_all_marks(dm, flag)) { |
1542 |
if (!_trace_all_marks(dm, flag)) { |
1543 |
stack; |
1543 |
STACK; |
1544 |
return 0; |
1544 |
return 0; |
1545 |
} |
1545 |
} |
1546 |
|
1546 |
|
Lines 1549-1560
Link Here
|
1549 |
|
1549 |
|
1550 |
static int _suspend_parents(struct dev_manager *dm, struct dev_layer *dl) |
1550 |
static int _suspend_parents(struct dev_manager *dm, struct dev_layer *dl) |
1551 |
{ |
1551 |
{ |
1552 |
struct list *sh; |
1552 |
struct lvm_list *sh; |
1553 |
struct dev_layer *dep; |
1553 |
struct dev_layer *dep; |
1554 |
const char *dlid; |
1554 |
const char *dlid; |
1555 |
|
1555 |
|
1556 |
list_iterate(sh, &dl->pre_suspend) { |
1556 |
lvm_list_iterate(sh, &dl->pre_suspend) { |
1557 |
dlid = list_item(sh, struct str_list)->str; |
1557 |
dlid = lvm_list_item(sh, struct str_list)->str; |
1558 |
|
1558 |
|
1559 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1559 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1560 |
log_debug("_suspend_parents couldn't find device " |
1560 |
log_debug("_suspend_parents couldn't find device " |
Lines 1568-1579
Link Here
|
1568 |
} |
1568 |
} |
1569 |
|
1569 |
|
1570 |
if (!_suspend_parents(dm, dep)) { |
1570 |
if (!_suspend_parents(dm, dep)) { |
1571 |
stack; |
1571 |
STACK; |
1572 |
return 0; |
1572 |
return 0; |
1573 |
} |
1573 |
} |
1574 |
|
1574 |
|
1575 |
if (dep->info.exists & !_suspend(dep)) { |
1575 |
if (dep->info.exists & !_suspend(dep)) { |
1576 |
stack; |
1576 |
STACK; |
1577 |
return 0; |
1577 |
return 0; |
1578 |
} |
1578 |
} |
1579 |
} |
1579 |
} |
Lines 1583-1594
Link Here
|
1583 |
|
1583 |
|
1584 |
static int _resume_with_deps(struct dev_manager *dm, struct dev_layer *dl) |
1584 |
static int _resume_with_deps(struct dev_manager *dm, struct dev_layer *dl) |
1585 |
{ |
1585 |
{ |
1586 |
struct list *sh; |
1586 |
struct lvm_list *sh; |
1587 |
struct dev_layer *dep; |
1587 |
struct dev_layer *dep; |
1588 |
const char *dlid; |
1588 |
const char *dlid; |
1589 |
|
1589 |
|
1590 |
list_iterate(sh, &dl->pre_create) { |
1590 |
lvm_list_iterate(sh, &dl->pre_create) { |
1591 |
dlid = list_item(sh, struct str_list)->str; |
1591 |
dlid = lvm_list_item(sh, struct str_list)->str; |
1592 |
|
1592 |
|
1593 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1593 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1594 |
log_debug("_resume_with_deps couldn't find device " |
1594 |
log_debug("_resume_with_deps couldn't find device " |
Lines 1602-1614
Link Here
|
1602 |
} |
1602 |
} |
1603 |
|
1603 |
|
1604 |
if (!_resume_with_deps(dm, dep)) { |
1604 |
if (!_resume_with_deps(dm, dep)) { |
1605 |
stack; |
1605 |
STACK; |
1606 |
return 0; |
1606 |
return 0; |
1607 |
} |
1607 |
} |
1608 |
} |
1608 |
} |
1609 |
|
1609 |
|
1610 |
if (dl->info.exists & !_get_flag(dl, SUSPENDED) && !_resume(dl)) { |
1610 |
if (dl->info.exists & !_get_flag(dl, SUSPENDED) && !_resume(dl)) { |
1611 |
stack; |
1611 |
STACK; |
1612 |
return 0; |
1612 |
return 0; |
1613 |
} |
1613 |
} |
1614 |
|
1614 |
|
Lines 1621-1627
Link Here
|
1621 |
*/ |
1621 |
*/ |
1622 |
static int _create_rec(struct dev_manager *dm, struct dev_layer *dl) |
1622 |
static int _create_rec(struct dev_manager *dm, struct dev_layer *dl) |
1623 |
{ |
1623 |
{ |
1624 |
struct list *sh; |
1624 |
struct lvm_list *sh; |
1625 |
struct dev_layer *dep; |
1625 |
struct dev_layer *dep; |
1626 |
const char *dlid; |
1626 |
const char *dlid; |
1627 |
char *newname, *suffix; |
1627 |
char *newname, *suffix; |
Lines 1629-1640
Link Here
|
1629 |
/* Suspend? */ |
1629 |
/* Suspend? */ |
1630 |
if (_get_flag(dl, SUSPENDED) && |
1630 |
if (_get_flag(dl, SUSPENDED) && |
1631 |
(!_suspend_parents(dm, dl) || !_suspend(dl))) { |
1631 |
(!_suspend_parents(dm, dl) || !_suspend(dl))) { |
1632 |
stack; |
1632 |
STACK; |
1633 |
return 0; |
1633 |
return 0; |
1634 |
} |
1634 |
} |
1635 |
|
1635 |
|
1636 |
list_iterate(sh, &dl->pre_create) { |
1636 |
lvm_list_iterate(sh, &dl->pre_create) { |
1637 |
dlid = list_item(sh, struct str_list)->str; |
1637 |
dlid = lvm_list_item(sh, struct str_list)->str; |
1638 |
|
1638 |
|
1639 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1639 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1640 |
log_error("Couldn't find device layer '%s'.", dlid); |
1640 |
log_error("Couldn't find device layer '%s'.", dlid); |
Lines 1647-1653
Link Here
|
1647 |
} |
1647 |
} |
1648 |
|
1648 |
|
1649 |
if (!_create_rec(dm, dep)) { |
1649 |
if (!_create_rec(dm, dep)) { |
1650 |
stack; |
1650 |
STACK; |
1651 |
return 0; |
1651 |
return 0; |
1652 |
} |
1652 |
} |
1653 |
} |
1653 |
} |
Lines 1661-1667
Link Here
|
1661 |
if (strcmp(newname, dl->name)) { |
1661 |
if (strcmp(newname, dl->name)) { |
1662 |
if (!_suspend_parents(dm, dl) || |
1662 |
if (!_suspend_parents(dm, dl) || |
1663 |
!_suspend(dl) || !_rename(dl, newname)) { |
1663 |
!_suspend(dl) || !_rename(dl, newname)) { |
1664 |
stack; |
1664 |
STACK; |
1665 |
return 0; |
1665 |
return 0; |
1666 |
} |
1666 |
} |
1667 |
} |
1667 |
} |
Lines 1671-1677
Link Here
|
1671 |
if (!dl->info.exists) { |
1671 |
if (!dl->info.exists) { |
1672 |
if (!_suspend_parents(dm, dl) || |
1672 |
if (!_suspend_parents(dm, dl) || |
1673 |
!_load(dm, dl, DM_DEVICE_CREATE)) { |
1673 |
!_load(dm, dl, DM_DEVICE_CREATE)) { |
1674 |
stack; |
1674 |
STACK; |
1675 |
return 0; |
1675 |
return 0; |
1676 |
} |
1676 |
} |
1677 |
return 1; |
1677 |
return 1; |
Lines 1681-1687
Link Here
|
1681 |
if (_get_flag(dl, RELOAD) && |
1681 |
if (_get_flag(dl, RELOAD) && |
1682 |
(!_suspend_parents(dm, dl) || !_suspend(dl) || |
1682 |
(!_suspend_parents(dm, dl) || !_suspend(dl) || |
1683 |
!_load(dm, dl, DM_DEVICE_RELOAD))) { |
1683 |
!_load(dm, dl, DM_DEVICE_RELOAD))) { |
1684 |
stack; |
1684 |
STACK; |
1685 |
return 0; |
1685 |
return 0; |
1686 |
} |
1686 |
} |
1687 |
|
1687 |
|
Lines 1691-1706
Link Here
|
1691 |
|
1691 |
|
1692 |
static int _build_all_layers(struct dev_manager *dm, struct volume_group *vg) |
1692 |
static int _build_all_layers(struct dev_manager *dm, struct volume_group *vg) |
1693 |
{ |
1693 |
{ |
1694 |
struct list *lvh; |
1694 |
struct lvm_list *lvh; |
1695 |
struct logical_volume *lvt; |
1695 |
struct logical_volume *lvt; |
1696 |
|
1696 |
|
1697 |
/* |
1697 |
/* |
1698 |
* Build layers for complete vg. |
1698 |
* Build layers for complete vg. |
1699 |
*/ |
1699 |
*/ |
1700 |
list_iterate(lvh, &vg->lvs) { |
1700 |
lvm_list_iterate(lvh, &vg->lvs) { |
1701 |
lvt = list_item(lvh, struct lv_list)->lv; |
1701 |
lvt = lvm_list_item(lvh, struct lv_list)->lv; |
1702 |
if (!_expand_lv(dm, lvt)) { |
1702 |
if (!_expand_lv(dm, lvt)) { |
1703 |
stack; |
1703 |
STACK; |
1704 |
return 0; |
1704 |
return 0; |
1705 |
} |
1705 |
} |
1706 |
} |
1706 |
} |
Lines 1723-1734
Link Here
|
1723 |
if (!_get_flag(dl, ACTIVE)) { |
1723 |
if (!_get_flag(dl, ACTIVE)) { |
1724 |
dll = pool_alloc(dm->mem, sizeof(*dll)); |
1724 |
dll = pool_alloc(dm->mem, sizeof(*dll)); |
1725 |
if (!dll) { |
1725 |
if (!dll) { |
1726 |
stack; |
1726 |
STACK; |
1727 |
return 0; |
1727 |
return 0; |
1728 |
} |
1728 |
} |
1729 |
|
1729 |
|
1730 |
dll->dl = dl; |
1730 |
dll->dl = dl; |
1731 |
list_add(&dm->remove_list, &dll->list); |
1731 |
lvm_list_add(&dm->remove_list, &dll->list); |
1732 |
} |
1732 |
} |
1733 |
} |
1733 |
} |
1734 |
|
1734 |
|
Lines 1739-1753
Link Here
|
1739 |
{ |
1739 |
{ |
1740 |
struct hash_node *hn; |
1740 |
struct hash_node *hn; |
1741 |
struct dev_layer *dl; |
1741 |
struct dev_layer *dl; |
1742 |
struct list *sh; |
1742 |
struct lvm_list *sh; |
1743 |
const char *dlid; |
1743 |
const char *dlid; |
1744 |
struct dev_layer *dep; |
1744 |
struct dev_layer *dep; |
1745 |
|
1745 |
|
1746 |
hash_iterate(hn, dm->layers) { |
1746 |
hash_iterate(hn, dm->layers) { |
1747 |
dl = hash_get_data(dm->layers, hn); |
1747 |
dl = hash_get_data(dm->layers, hn); |
1748 |
|
1748 |
|
1749 |
list_iterate(sh, &dl->pre_suspend) { |
1749 |
lvm_list_iterate(sh, &dl->pre_suspend) { |
1750 |
dlid = list_item(sh, struct str_list)->str; |
1750 |
dlid = lvm_list_item(sh, struct str_list)->str; |
1751 |
|
1751 |
|
1752 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1752 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1753 |
log_debug("_populate_pre_suspend_lists: " |
1753 |
log_debug("_populate_pre_suspend_lists: " |
Lines 1758-1770
Link Here
|
1758 |
|
1758 |
|
1759 |
if (!str_list_add(dm->mem, &dep->pre_create, |
1759 |
if (!str_list_add(dm->mem, &dep->pre_create, |
1760 |
dl->dlid)) { |
1760 |
dl->dlid)) { |
1761 |
stack; |
1761 |
STACK; |
1762 |
return 0; |
1762 |
return 0; |
1763 |
} |
1763 |
} |
1764 |
} |
1764 |
} |
1765 |
|
1765 |
|
1766 |
list_iterate(sh, &dl->pre_create) { |
1766 |
lvm_list_iterate(sh, &dl->pre_create) { |
1767 |
dlid = list_item(sh, struct str_list)->str; |
1767 |
dlid = lvm_list_item(sh, struct str_list)->str; |
1768 |
|
1768 |
|
1769 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1769 |
if (!(dep = hash_lookup(dm->layers, dlid))) { |
1770 |
log_debug("_populate_pre_suspend_lists: " |
1770 |
log_debug("_populate_pre_suspend_lists: " |
Lines 1775-1781
Link Here
|
1775 |
|
1775 |
|
1776 |
if (!str_list_add(dm->mem, &dep->pre_suspend, |
1776 |
if (!str_list_add(dm->mem, &dep->pre_suspend, |
1777 |
dl->dlid)) { |
1777 |
dl->dlid)) { |
1778 |
stack; |
1778 |
STACK; |
1779 |
return 0; |
1779 |
return 0; |
1780 |
} |
1780 |
} |
1781 |
} |
1781 |
} |
Lines 1790-1819
Link Here
|
1790 |
static int _remove_old_layers(struct dev_manager *dm) |
1790 |
static int _remove_old_layers(struct dev_manager *dm) |
1791 |
{ |
1791 |
{ |
1792 |
int change; |
1792 |
int change; |
1793 |
struct list *rh, *n; |
1793 |
struct lvm_list *rh, *n; |
1794 |
struct dev_layer *dl; |
1794 |
struct dev_layer *dl; |
1795 |
|
1795 |
|
1796 |
do { |
1796 |
do { |
1797 |
change = 0; |
1797 |
change = 0; |
1798 |
list_iterate_safe(rh, n, &dm->remove_list) { |
1798 |
lvm_list_iterate_safe(rh, n, &dm->remove_list) { |
1799 |
dl = list_item(rh, struct dl_list)->dl; |
1799 |
dl = lvm_list_item(rh, struct dl_list)->dl; |
1800 |
|
1800 |
|
1801 |
if (!dl->info.exists) { |
1801 |
if (!dl->info.exists) { |
1802 |
list_del(rh); |
1802 |
lvm_list_del(rh); |
1803 |
continue; |
1803 |
continue; |
1804 |
} |
1804 |
} |
1805 |
|
1805 |
|
1806 |
if (_remove(dl)) { |
1806 |
if (_remove(dl)) { |
1807 |
change = 1; |
1807 |
change = 1; |
1808 |
list_del(rh); |
1808 |
lvm_list_del(rh); |
1809 |
} |
1809 |
} |
1810 |
} |
1810 |
} |
1811 |
|
1811 |
|
1812 |
} while (change); |
1812 |
} while (change); |
1813 |
|
1813 |
|
1814 |
if (!list_empty(&dm->remove_list)) { |
1814 |
if (!lvm_list_empty(&dm->remove_list)) { |
1815 |
list_iterate(rh, &dm->remove_list) { |
1815 |
lvm_list_iterate(rh, &dm->remove_list) { |
1816 |
dl = list_item(rh, struct dl_list)->dl; |
1816 |
dl = lvm_list_item(rh, struct dl_list)->dl; |
1817 |
log_error("Couldn't deactivate device %s", dl->name); |
1817 |
log_error("Couldn't deactivate device %s", dl->name); |
1818 |
} |
1818 |
} |
1819 |
return 0; |
1819 |
return 0; |
Lines 1833-1839
Link Here
|
1833 |
struct dev_layer *dl; |
1833 |
struct dev_layer *dl; |
1834 |
|
1834 |
|
1835 |
if (!_build_all_layers(dm, vg)) { |
1835 |
if (!_build_all_layers(dm, vg)) { |
1836 |
stack; |
1836 |
STACK; |
1837 |
return 0; |
1837 |
return 0; |
1838 |
} |
1838 |
} |
1839 |
|
1839 |
|
Lines 1842-1848
Link Here
|
1842 |
*/ |
1842 |
*/ |
1843 |
_clear_marks(dm, RELOAD); |
1843 |
_clear_marks(dm, RELOAD); |
1844 |
if (!_mark_lvs(dm, &dm->reload_list, RELOAD)) { |
1844 |
if (!_mark_lvs(dm, &dm->reload_list, RELOAD)) { |
1845 |
stack; |
1845 |
STACK; |
1846 |
return 0; |
1846 |
return 0; |
1847 |
} |
1847 |
} |
1848 |
|
1848 |
|
Lines 1851-1857
Link Here
|
1851 |
*/ |
1851 |
*/ |
1852 |
_clear_marks(dm, ACTIVE); |
1852 |
_clear_marks(dm, ACTIVE); |
1853 |
if (!_mark_lvs(dm, &dm->active_list, ACTIVE)) { |
1853 |
if (!_mark_lvs(dm, &dm->active_list, ACTIVE)) { |
1854 |
stack; |
1854 |
STACK; |
1855 |
return 0; |
1855 |
return 0; |
1856 |
} |
1856 |
} |
1857 |
|
1857 |
|
Lines 1860-1876
Link Here
|
1860 |
*/ |
1860 |
*/ |
1861 |
_clear_marks(dm, SUSPENDED); |
1861 |
_clear_marks(dm, SUSPENDED); |
1862 |
if (!_mark_lvs(dm, &dm->suspend_list, SUSPENDED)) { |
1862 |
if (!_mark_lvs(dm, &dm->suspend_list, SUSPENDED)) { |
1863 |
stack; |
1863 |
STACK; |
1864 |
return 0; |
1864 |
return 0; |
1865 |
} |
1865 |
} |
1866 |
|
1866 |
|
1867 |
if (!_fill_in_remove_list(dm)) { |
1867 |
if (!_fill_in_remove_list(dm)) { |
1868 |
stack; |
1868 |
STACK; |
1869 |
return 0; |
1869 |
return 0; |
1870 |
} |
1870 |
} |
1871 |
|
1871 |
|
1872 |
if (!_populate_pre_suspend_lists(dm)) { |
1872 |
if (!_populate_pre_suspend_lists(dm)) { |
1873 |
stack; |
1873 |
STACK; |
1874 |
return 0; |
1874 |
return 0; |
1875 |
} |
1875 |
} |
1876 |
|
1876 |
|
Lines 1882-1888
Link Here
|
1882 |
|
1882 |
|
1883 |
if (_get_flag(dl, ACTIVE) && _get_flag(dl, TOPLEVEL)) |
1883 |
if (_get_flag(dl, ACTIVE) && _get_flag(dl, TOPLEVEL)) |
1884 |
if (!_create_rec(dm, dl)) { |
1884 |
if (!_create_rec(dm, dl)) { |
1885 |
stack; |
1885 |
STACK; |
1886 |
return 0; |
1886 |
return 0; |
1887 |
} |
1887 |
} |
1888 |
} |
1888 |
} |
Lines 1892-1904
Link Here
|
1892 |
dl = hash_get_data(dm->layers, hn); |
1892 |
dl = hash_get_data(dm->layers, hn); |
1893 |
|
1893 |
|
1894 |
if (!_resume_with_deps(dm, dl)) { |
1894 |
if (!_resume_with_deps(dm, dl)) { |
1895 |
stack; |
1895 |
STACK; |
1896 |
return 0; |
1896 |
return 0; |
1897 |
} |
1897 |
} |
1898 |
} |
1898 |
} |
1899 |
|
1899 |
|
1900 |
if (!_remove_old_layers(dm)) { |
1900 |
if (!_remove_old_layers(dm)) { |
1901 |
stack; |
1901 |
STACK; |
1902 |
return 0; |
1902 |
return 0; |
1903 |
} |
1903 |
} |
1904 |
|
1904 |
|
Lines 1934-1945
Link Here
|
1934 |
log_debug("Found existing layer '%s'", name); |
1934 |
log_debug("Found existing layer '%s'", name); |
1935 |
|
1935 |
|
1936 |
if (!(copy = pool_strdup(dm->mem, name))) { |
1936 |
if (!(copy = pool_strdup(dm->mem, name))) { |
1937 |
stack; |
1937 |
STACK; |
1938 |
return 0; |
1938 |
return 0; |
1939 |
} |
1939 |
} |
1940 |
|
1940 |
|
1941 |
if (!(dl = _create_dev(dm, copy, ""))) { |
1941 |
if (!(dl = _create_dev(dm, copy, ""))) { |
1942 |
stack; |
1942 |
STACK; |
1943 |
return 0; |
1943 |
return 0; |
1944 |
} |
1944 |
} |
1945 |
|
1945 |
|
Lines 1971-1977
Link Here
|
1971 |
names = (void *) names + next; |
1971 |
names = (void *) names + next; |
1972 |
if (_belong_to_vg(dm->vg_name, names->name) && |
1972 |
if (_belong_to_vg(dm->vg_name, names->name) && |
1973 |
!_add_existing_layer(dm, names->name)) { |
1973 |
!_add_existing_layer(dm, names->name)) { |
1974 |
stack; |
1974 |
STACK; |
1975 |
r = 0; |
1975 |
r = 0; |
1976 |
break; |
1976 |
break; |
1977 |
} |
1977 |
} |
Lines 1984-2013
Link Here
|
1984 |
} |
1984 |
} |
1985 |
|
1985 |
|
1986 |
static int _add_lv(struct pool *mem, |
1986 |
static int _add_lv(struct pool *mem, |
1987 |
struct list *head, struct logical_volume *lv) |
1987 |
struct lvm_list *head, struct logical_volume *lv) |
1988 |
{ |
1988 |
{ |
1989 |
struct lv_list *lvl; |
1989 |
struct lv_list *lvl; |
1990 |
|
1990 |
|
1991 |
if (!(lvl = pool_alloc(mem, sizeof(*lvl)))) { |
1991 |
if (!(lvl = pool_alloc(mem, sizeof(*lvl)))) { |
1992 |
stack; |
1992 |
STACK; |
1993 |
return 0; |
1993 |
return 0; |
1994 |
} |
1994 |
} |
1995 |
|
1995 |
|
1996 |
lvl->lv = lv; |
1996 |
lvl->lv = lv; |
1997 |
list_add(head, &lvl->list); |
1997 |
lvm_list_add(head, &lvl->list); |
1998 |
|
1998 |
|
1999 |
return 1; |
1999 |
return 1; |
2000 |
} |
2000 |
} |
2001 |
|
2001 |
|
2002 |
static int _add_lvs(struct pool *mem, |
2002 |
static int _add_lvs(struct pool *mem, |
2003 |
struct list *head, struct logical_volume *origin) |
2003 |
struct lvm_list *head, struct logical_volume *origin) |
2004 |
{ |
2004 |
{ |
2005 |
struct logical_volume *lv; |
2005 |
struct logical_volume *lv; |
2006 |
struct snapshot *s; |
2006 |
struct snapshot *s; |
2007 |
struct list *lvh; |
2007 |
struct lvm_list *lvh; |
2008 |
|
2008 |
|
2009 |
list_iterate(lvh, &origin->vg->lvs) { |
2009 |
lvm_list_iterate(lvh, &origin->vg->lvs) { |
2010 |
lv = list_item(lvh, struct lv_list)->lv; |
2010 |
lv = lvm_list_item(lvh, struct lv_list)->lv; |
2011 |
if ((s = find_cow(lv)) && s->origin == origin) |
2011 |
if ((s = find_cow(lv)) && s->origin == origin) |
2012 |
if (!_add_lv(mem, head, lv)) |
2012 |
if (!_add_lv(mem, head, lv)) |
2013 |
return 0; |
2013 |
return 0; |
Lines 2016-2030
Link Here
|
2016 |
return _add_lv(mem, head, origin); |
2016 |
return _add_lv(mem, head, origin); |
2017 |
} |
2017 |
} |
2018 |
|
2018 |
|
2019 |
static void _remove_lv(struct list *head, struct logical_volume *lv) |
2019 |
static void _remove_lv(struct lvm_list *head, struct logical_volume *lv) |
2020 |
{ |
2020 |
{ |
2021 |
struct list *lvh; |
2021 |
struct lvm_list *lvh; |
2022 |
struct lv_list *lvl; |
2022 |
struct lv_list *lvl; |
2023 |
|
2023 |
|
2024 |
list_iterate(lvh, head) { |
2024 |
lvm_list_iterate(lvh, head) { |
2025 |
lvl = list_item(lvh, struct lv_list); |
2025 |
lvl = lvm_list_item(lvh, struct lv_list); |
2026 |
if (lvl->lv == lv) { |
2026 |
if (lvl->lv == lv) { |
2027 |
list_del(lvh); |
2027 |
lvm_list_del(lvh); |
2028 |
break; |
2028 |
break; |
2029 |
} |
2029 |
} |
2030 |
} |
2030 |
} |
Lines 2034-2046
Link Here
|
2034 |
{ |
2034 |
{ |
2035 |
struct logical_volume *active, *old_origin; |
2035 |
struct logical_volume *active, *old_origin; |
2036 |
struct snapshot *s; |
2036 |
struct snapshot *s; |
2037 |
struct list *sh, *active_head; |
2037 |
struct lvm_list *sh, *active_head; |
2038 |
|
2038 |
|
2039 |
active_head = &dm->active_list; |
2039 |
active_head = &dm->active_list; |
2040 |
|
2040 |
|
2041 |
/* Remove any snapshots with given origin */ |
2041 |
/* Remove any snapshots with given origin */ |
2042 |
list_iterate(sh, active_head) { |
2042 |
lvm_list_iterate(sh, active_head) { |
2043 |
active = list_item(sh, struct lv_list)->lv; |
2043 |
active = lvm_list_item(sh, struct lv_list)->lv; |
2044 |
if ((s = find_cow(active)) && s->origin == lv) { |
2044 |
if ((s = find_cow(active)) && s->origin == lv) { |
2045 |
_remove_lv(active_head, active); |
2045 |
_remove_lv(active_head, active); |
2046 |
} |
2046 |
} |
Lines 2054-2061
Link Here
|
2054 |
old_origin = s->origin; |
2054 |
old_origin = s->origin; |
2055 |
|
2055 |
|
2056 |
/* Was this the last active snapshot with this origin? */ |
2056 |
/* Was this the last active snapshot with this origin? */ |
2057 |
list_iterate(sh, active_head) { |
2057 |
lvm_list_iterate(sh, active_head) { |
2058 |
active = list_item(sh, struct lv_list)->lv; |
2058 |
active = lvm_list_item(sh, struct lv_list)->lv; |
2059 |
if ((s = find_cow(active)) && s->origin == old_origin) { |
2059 |
if ((s = find_cow(active)) && s->origin == old_origin) { |
2060 |
return 1; |
2060 |
return 1; |
2061 |
} |
2061 |
} |
Lines 2069-2081
Link Here
|
2069 |
{ |
2069 |
{ |
2070 |
struct logical_volume *suspended; |
2070 |
struct logical_volume *suspended; |
2071 |
struct snapshot *s; |
2071 |
struct snapshot *s; |
2072 |
struct list *sh, *suspend_head; |
2072 |
struct lvm_list *sh, *suspend_head; |
2073 |
|
2073 |
|
2074 |
suspend_head = &dm->suspend_list; |
2074 |
suspend_head = &dm->suspend_list; |
2075 |
|
2075 |
|
2076 |
/* Remove from list any snapshots with given origin */ |
2076 |
/* Remove from list any snapshots with given origin */ |
2077 |
list_iterate(sh, suspend_head) { |
2077 |
lvm_list_iterate(sh, suspend_head) { |
2078 |
suspended = list_item(sh, struct lv_list)->lv; |
2078 |
suspended = lvm_list_item(sh, struct lv_list)->lv; |
2079 |
if ((s = find_cow(suspended)) && s->origin == lv) { |
2079 |
if ((s = find_cow(suspended)) && s->origin == lv) { |
2080 |
_remove_lv(suspend_head, suspended); |
2080 |
_remove_lv(suspend_head, suspended); |
2081 |
} |
2081 |
} |
Lines 2089-2103
Link Here
|
2089 |
static int _fill_in_active_list(struct dev_manager *dm, struct volume_group *vg) |
2089 |
static int _fill_in_active_list(struct dev_manager *dm, struct volume_group *vg) |
2090 |
{ |
2090 |
{ |
2091 |
char *dlid; |
2091 |
char *dlid; |
2092 |
struct list *lvh; |
2092 |
struct lvm_list *lvh; |
2093 |
struct logical_volume *lv; |
2093 |
struct logical_volume *lv; |
2094 |
struct dev_layer *dl; |
2094 |
struct dev_layer *dl; |
2095 |
|
2095 |
|
2096 |
list_iterate(lvh, &vg->lvs) { |
2096 |
lvm_list_iterate(lvh, &vg->lvs) { |
2097 |
lv = list_item(lvh, struct lv_list)->lv; |
2097 |
lv = lvm_list_item(lvh, struct lv_list)->lv; |
2098 |
|
2098 |
|
2099 |
if (!(dlid = _build_dlid(dm->mem, lv->lvid.s, NULL))) { |
2099 |
if (!(dlid = _build_dlid(dm->mem, lv->lvid.s, NULL))) { |
2100 |
stack; |
2100 |
STACK; |
2101 |
return 0; |
2101 |
return 0; |
2102 |
} |
2102 |
} |
2103 |
|
2103 |
|
Lines 2109-2121
Link Here
|
2109 |
dl->info.suspended ? " (suspended)" : ""); |
2109 |
dl->info.suspended ? " (suspended)" : ""); |
2110 |
|
2110 |
|
2111 |
if (!_add_lv(dm->mem, &dm->active_list, lv)) { |
2111 |
if (!_add_lv(dm->mem, &dm->active_list, lv)) { |
2112 |
stack; |
2112 |
STACK; |
2113 |
return 0; |
2113 |
return 0; |
2114 |
} |
2114 |
} |
2115 |
|
2115 |
|
2116 |
if (dl->info.suspended) { |
2116 |
if (dl->info.suspended) { |
2117 |
if (!_add_lv(dm->mem, &dm->suspend_list, lv)) { |
2117 |
if (!_add_lv(dm->mem, &dm->suspend_list, lv)) { |
2118 |
stack; |
2118 |
STACK; |
2119 |
return 0; |
2119 |
return 0; |
2120 |
} |
2120 |
} |
2121 |
} |
2121 |
} |
Lines 2129-2147
Link Here
|
2129 |
action_t action) |
2129 |
action_t action) |
2130 |
{ |
2130 |
{ |
2131 |
if (!_scan_existing_devices(dm)) { |
2131 |
if (!_scan_existing_devices(dm)) { |
2132 |
stack; |
2132 |
STACK; |
2133 |
return 0; |
2133 |
return 0; |
2134 |
} |
2134 |
} |
2135 |
|
2135 |
|
2136 |
if (!_fill_in_active_list(dm, lv->vg)) { |
2136 |
if (!_fill_in_active_list(dm, lv->vg)) { |
2137 |
stack; |
2137 |
STACK; |
2138 |
return 0; |
2138 |
return 0; |
2139 |
} |
2139 |
} |
2140 |
|
2140 |
|
2141 |
if (action == ACTIVATE || action == DEACTIVATE) |
2141 |
if (action == ACTIVATE || action == DEACTIVATE) |
2142 |
/* Get into known state - remove from active list if present */ |
2142 |
/* Get into known state - remove from active list if present */ |
2143 |
if (!_remove_lvs(dm, lv)) { |
2143 |
if (!_remove_lvs(dm, lv)) { |
2144 |
stack; |
2144 |
STACK; |
2145 |
return 0; |
2145 |
return 0; |
2146 |
} |
2146 |
} |
2147 |
|
2147 |
|
Lines 2149-2155
Link Here
|
2149 |
/* Add to active & reload lists */ |
2149 |
/* Add to active & reload lists */ |
2150 |
if (!_add_lvs(dm->mem, &dm->reload_list, lv) || |
2150 |
if (!_add_lvs(dm->mem, &dm->reload_list, lv) || |
2151 |
!_add_lvs(dm->mem, &dm->active_list, lv)) { |
2151 |
!_add_lvs(dm->mem, &dm->active_list, lv)) { |
2152 |
stack; |
2152 |
STACK; |
2153 |
return 0; |
2153 |
return 0; |
2154 |
} |
2154 |
} |
2155 |
} |
2155 |
} |
Lines 2157-2175
Link Here
|
2157 |
if (action == SUSPEND || action == RESUME || action == ACTIVATE) |
2157 |
if (action == SUSPEND || action == RESUME || action == ACTIVATE) |
2158 |
/* Get into known state - remove from suspend list if present */ |
2158 |
/* Get into known state - remove from suspend list if present */ |
2159 |
if (!_remove_suspended_lvs(dm, lv)) { |
2159 |
if (!_remove_suspended_lvs(dm, lv)) { |
2160 |
stack; |
2160 |
STACK; |
2161 |
return 0; |
2161 |
return 0; |
2162 |
} |
2162 |
} |
2163 |
|
2163 |
|
2164 |
if (action == SUSPEND) { |
2164 |
if (action == SUSPEND) { |
2165 |
if (!_add_lvs(dm->mem, &dm->suspend_list, lv)) { |
2165 |
if (!_add_lvs(dm->mem, &dm->suspend_list, lv)) { |
2166 |
stack; |
2166 |
STACK; |
2167 |
return 0; |
2167 |
return 0; |
2168 |
} |
2168 |
} |
2169 |
} |
2169 |
} |
2170 |
|
2170 |
|
2171 |
if (!_execute(dm, lv->vg)) { |
2171 |
if (!_execute(dm, lv->vg)) { |
2172 |
stack; |
2172 |
STACK; |
2173 |
return 0; |
2173 |
return 0; |
2174 |
} |
2174 |
} |
2175 |
|
2175 |
|
Lines 2197-2203
Link Here
|
2197 |
|
2197 |
|
2198 |
if (!(name = _build_name(lv->vg->cmd->mem, lv->vg->name, |
2198 |
if (!(name = _build_name(lv->vg->cmd->mem, lv->vg->name, |
2199 |
lv->name, NULL))) { |
2199 |
lv->name, NULL))) { |
2200 |
stack; |
2200 |
STACK; |
2201 |
return 0; |
2201 |
return 0; |
2202 |
} |
2202 |
} |
2203 |
|
2203 |
|