mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lv_manip: add for_each_sub_lv_except_pools()
for_each_sub_lv() now scans in depth also pools, however for rename we actually do want to skip pools. So add a new for_each_sub_lv_except_pools() to be used by rename, every other user of for_each_sub_lv() scans every sub LV with pools included. This is i.e. necessary for properly working preload of pools that are using raid arrays.
This commit is contained in:
parent
c35503e0f7
commit
2e35c68122
@ -1,5 +1,6 @@
|
||||
Version 2.02.116 -
|
||||
====================================
|
||||
Scan pools in for_each_sub_lv() and add for_each_sub_lv_except_pools().
|
||||
Fix lvm2app lvm_lv_get_property return value for fields with info/status ioctl.
|
||||
Fix lvm2app regression in lvm_lv_get_attr causing unknown values (2.02.115).
|
||||
Set default cache_mode to writehrough when missing in metadata.
|
||||
|
@ -3883,9 +3883,9 @@ static int _rename_cb(struct logical_volume *lv, void *data)
|
||||
* Loop down sub LVs and call fn for each.
|
||||
* fn is responsible to log necessary information on failure.
|
||||
*/
|
||||
int for_each_sub_lv(struct logical_volume *lv,
|
||||
int (*fn)(struct logical_volume *lv, void *data),
|
||||
void *data)
|
||||
static int _for_each_sub_lv(struct logical_volume *lv, int skip_pools,
|
||||
int (*fn)(struct logical_volume *lv, void *data),
|
||||
void *data)
|
||||
{
|
||||
struct logical_volume *org;
|
||||
struct lv_segment *seg;
|
||||
@ -3913,6 +3913,13 @@ int for_each_sub_lv(struct logical_volume *lv,
|
||||
return_0;
|
||||
}
|
||||
|
||||
if (seg->pool_lv && !skip_pools) {
|
||||
if (!fn(seg->pool_lv, data))
|
||||
return_0;
|
||||
if (!for_each_sub_lv(seg->pool_lv, fn, data))
|
||||
return_0;
|
||||
}
|
||||
|
||||
for (s = 0; s < seg->area_count; s++) {
|
||||
if (seg_type(seg, s) != AREA_LV)
|
||||
continue;
|
||||
@ -3939,6 +3946,20 @@ int for_each_sub_lv(struct logical_volume *lv,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int for_each_sub_lv(struct logical_volume *lv,
|
||||
int (*fn)(struct logical_volume *lv, void *data),
|
||||
void *data)
|
||||
{
|
||||
return _for_each_sub_lv(lv, 0, fn, data);
|
||||
}
|
||||
|
||||
int for_each_sub_lv_except_pools(struct logical_volume *lv,
|
||||
int (*fn)(struct logical_volume *lv, void *data),
|
||||
void *data)
|
||||
{
|
||||
return _for_each_sub_lv(lv, 1, fn, data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Core of LV renaming routine.
|
||||
* VG must be locked by caller.
|
||||
@ -3975,7 +3996,7 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
}
|
||||
|
||||
/* rename sub LVs */
|
||||
if (!for_each_sub_lv(lv, _rename_cb, (void *) &lv_names))
|
||||
if (!for_each_sub_lv_except_pools(lv, _rename_cb, (void *) &lv_names))
|
||||
return_0;
|
||||
|
||||
/* rename main LV */
|
||||
|
@ -430,6 +430,9 @@ int lv_split_segment(struct logical_volume *lv, uint32_t le);
|
||||
int add_seg_to_segs_using_this_lv(struct logical_volume *lv, struct lv_segment *seg);
|
||||
int remove_seg_from_segs_using_this_lv(struct logical_volume *lv, struct lv_segment *seg);
|
||||
|
||||
int for_each_sub_lv_except_pools(struct logical_volume *lv,
|
||||
int (*fn)(struct logical_volume *lv, void *data),
|
||||
void *data);
|
||||
int for_each_sub_lv(struct logical_volume *lv,
|
||||
int (*fn)(struct logical_volume *lv, void *data),
|
||||
void *data);
|
||||
|
Loading…
Reference in New Issue
Block a user