mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Extend _for_each_pv() to allow termination without error.
This commit is contained in:
parent
7dce16f234
commit
b6f8552074
@ -1,5 +1,7 @@
|
|||||||
Version 2.02.11 -
|
Version 2.02.11 -
|
||||||
=====================================
|
=====================================
|
||||||
|
Extend _for_each_pv() to allow termination without error.
|
||||||
|
Abstract _is_contiguous().
|
||||||
Remove duplicated pv arg from _check_contiguous().
|
Remove duplicated pv arg from _check_contiguous().
|
||||||
Accept regionsize with lvconvert.
|
Accept regionsize with lvconvert.
|
||||||
Add report columns with underscore before field names ending 'size'.
|
Add report columns with underscore before field names ending 'size'.
|
||||||
|
@ -670,6 +670,8 @@ static int _alloc_parallel_area(struct alloc_handle *ah, uint32_t needed,
|
|||||||
* Call fn for each AREA_PV used by the LV segment at lv:le of length *max_seg_len.
|
* Call fn for each AREA_PV used by the LV segment at lv:le of length *max_seg_len.
|
||||||
* If any constituent area contains more than one segment, max_seg_len is
|
* If any constituent area contains more than one segment, max_seg_len is
|
||||||
* reduced to cover only the first.
|
* reduced to cover only the first.
|
||||||
|
* fn should return 0 on error, 1 to continue scanning or >1 to terminate without error.
|
||||||
|
* In the last case, this function passes on the return code.
|
||||||
*/
|
*/
|
||||||
static int _for_each_pv(struct cmd_context *cmd, struct logical_volume *lv,
|
static int _for_each_pv(struct cmd_context *cmd, struct logical_volume *lv,
|
||||||
uint32_t le, uint32_t len, uint32_t *max_seg_len,
|
uint32_t le, uint32_t len, uint32_t *max_seg_len,
|
||||||
@ -679,6 +681,7 @@ static int _for_each_pv(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
uint32_t s;
|
uint32_t s;
|
||||||
uint32_t remaining_seg_len, area_len, area_multiple;
|
uint32_t remaining_seg_len, area_len, area_multiple;
|
||||||
|
int r;
|
||||||
|
|
||||||
if (!(seg = find_seg_by_le(lv, le))) {
|
if (!(seg = find_seg_by_le(lv, le))) {
|
||||||
log_error("Failed to find segment for %s extent %" PRIu32,
|
log_error("Failed to find segment for %s extent %" PRIu32,
|
||||||
@ -698,20 +701,29 @@ static int _for_each_pv(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
area_multiple = segtype_is_striped(seg->segtype) ? seg->area_count : 1;
|
area_multiple = segtype_is_striped(seg->segtype) ? seg->area_count : 1;
|
||||||
area_len = remaining_seg_len / area_multiple ? : 1;
|
area_len = remaining_seg_len / area_multiple ? : 1;
|
||||||
|
|
||||||
for (s = 0; s < seg->area_count; s++)
|
for (s = 0; s < seg->area_count; s++) {
|
||||||
if (seg_type(seg, s) == AREA_LV) {
|
if (seg_type(seg, s) == AREA_LV) {
|
||||||
if (!_for_each_pv(cmd, seg_lv(seg, s),
|
if (!(r = _for_each_pv(cmd, seg_lv(seg, s),
|
||||||
seg_le(seg, s) + (le - seg->le) / area_multiple,
|
seg_le(seg, s) +
|
||||||
area_len, max_seg_len, fn, data))
|
(le - seg->le) / area_multiple,
|
||||||
return_0;
|
area_len, max_seg_len, fn,
|
||||||
} else if ((seg_type(seg, s) == AREA_PV) &&
|
data)))
|
||||||
!fn(cmd, seg_pvseg(seg, s), data))
|
stack;
|
||||||
return_0;
|
} else if (seg_type(seg, s) == AREA_PV)
|
||||||
|
if (!(r = fn(cmd, seg_pvseg(seg, s), data)))
|
||||||
|
stack;
|
||||||
|
|
||||||
if (seg_is_mirrored(seg) && seg->log_lv &&
|
if (r != 1)
|
||||||
!_for_each_pv(cmd, seg->log_lv, 0, MIRROR_LOG_SIZE,
|
return r;
|
||||||
NULL, fn, data))
|
}
|
||||||
return_0;
|
|
||||||
|
if (seg_is_mirrored(seg) && seg->log_lv) {
|
||||||
|
if (!(r = _for_each_pv(cmd, seg->log_lv, 0, MIRROR_LOG_SIZE,
|
||||||
|
NULL, fn, data)))
|
||||||
|
stack;
|
||||||
|
if (r != 1)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME Add snapshot cow LVs etc. */
|
/* FIXME Add snapshot cow LVs etc. */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user