Lines Matching defs:pv
27 struct physical_volume *pv,
39 peg->pv = pv;
50 int alloc_pv_segment_whole_pv(struct dm_pool *mem, struct physical_volume *pv)
54 if (!pv->pe_count)
58 if (!(peg = _alloc_pv_segment(mem, pv, 0, pv->pe_count, NULL, 0)))
61 dm_list_add(&pv->segments, &peg->list);
73 if (!(peg = _alloc_pv_segment(mem, pego->pv, pego->pe,
87 static int _pv_split_segment(struct physical_volume *pv, struct pv_segment *peg,
92 if (!(peg_new = _alloc_pv_segment(pv->fmt->cmd->mem, peg->pv, pe,
102 peg->pv->pe_alloc_count -= peg_new->len;
110 * Ensure there is a PV segment boundary at the given extent.
112 int pv_split_segment(struct physical_volume *pv, uint32_t pe)
116 if (pe == pv->pe_count)
119 if (!(peg = find_peg_by_pe(pv, pe))) {
120 log_error("Segment with extent %" PRIu32 " in PV %s not found",
121 pe, pv_dev_name(pv));
129 if (!_pv_split_segment(pv, peg, pe))
136 .pv = NULL,
140 struct pv_segment *assign_peg_to_lvseg(struct physical_volume *pv,
147 /* Missing format1 PV */
148 if (!pv)
151 if (!pv_split_segment(pv, pe) ||
152 !pv_split_segment(pv, pe + area_len))
155 if (!(peg = find_peg_by_pe(pv, pe))) {
156 log_error("Missing PV segment on %s at %u.",
157 pv_dev_name(pv), pe);
164 peg->pv->pe_alloc_count += area_len;
174 "%s PE %" PRIu32, pv_dev_name(peg->pv), peg->pe);
179 peg->pv->pe_alloc_count -= area_reduction;
190 if (!pv_split_segment(peg->pv, peg->pe + peg->lvseg->area_len -
237 dm_list_iterate_items(pvseg, &pvl->pv->segments) {
252 struct physical_volume *pv;
261 pv = pvl->pv;
267 dm_list_iterate_items(peg, &pv->segments) {
272 pv_dev_name(pv), segno++, peg->pe, peg->len,
301 if (start_pe != pv->pe_count) {
302 log_error("PV segment pe_count mismatch: %u != %u",
303 start_pe, pv->pe_count);
307 if (alloced != pv->pe_alloc_count) {
308 log_error("PV segment pe_alloc_count mismatch: "
309 "%u != %u", alloced, pv->pe_alloc_count);
318 log_error("PV segment VG pv_count mismatch: %u != %u",
324 log_error("PV segment VG free_count mismatch: %u != %u",
330 log_error("PV segment VG extent_count mismatch: %u != %u",
338 static int _reduce_pv(struct physical_volume *pv, struct volume_group *vg, uint32_t new_pe_count)
341 uint32_t old_pe_count = pv->pe_count;
343 if (new_pe_count < pv->pe_alloc_count) {
346 pv_dev_name(pv), new_pe_count,
347 pv->pe_alloc_count);
352 dm_list_iterate_items(peg, &pv->segments) {
359 pv_dev_name(pv), new_pe_count);
364 if (!pv_split_segment(pv, new_pe_count))
367 dm_list_iterate_items_safe(peg, pegt, &pv->segments) {
372 pv->pe_count = new_pe_count;
380 static int _extend_pv(struct physical_volume *pv, struct volume_group *vg,
384 uint32_t old_pe_count = pv->pe_count;
386 if ((uint64_t) new_pe_count * pv->pe_size > pv->size ) {
388 "is only room for %" PRIu64 ".", pv_dev_name(pv),
389 new_pe_count, pv->size / pv->pe_size);
393 peg = _alloc_pv_segment(pv->fmt->cmd->mem, pv,
397 dm_list_add(&pv->segments, &peg->list);
399 pv->pe_count = new_pe_count;
408 * Resize a PV in a VG, adding or removing segments as needed.
409 * New size must fit within pv->size.
411 int pv_resize(struct physical_volume *pv,
415 if ((new_pe_count == pv->pe_count)) {
417 pv_dev_name(pv));
423 pv_dev_name(pv), pv->pe_count, new_pe_count);
425 if (new_pe_count > pv->pe_count)
426 return _extend_pv(pv, vg, new_pe_count);
428 return _reduce_pv(pv, vg, new_pe_count);