1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

raid: Turn lv_raid_change_image_count into wrapper

Eventually the separate entry point will disappear.
This commit is contained in:
Alasdair G Kergon 2016-08-05 14:10:41 +01:00
parent b66fa91c46
commit 7482ff93b8
2 changed files with 15 additions and 11 deletions

View File

@ -1190,7 +1190,7 @@ struct logical_volume *first_replicator_dev(const struct logical_volume *lv);
int lv_is_raid_with_tracking(const struct logical_volume *lv);
uint32_t lv_raid_image_count(const struct logical_volume *lv);
int lv_raid_change_image_count(struct logical_volume *lv,
uint32_t new_count, struct dm_list *pvs);
uint32_t new_count, struct dm_list *allocate_pvs);
int lv_raid_split(struct logical_volume *lv, const char *split_name,
uint32_t new_count, struct dm_list *splittable_pvs);
int lv_raid_split_and_track(struct logical_volume *lv,

View File

@ -1171,21 +1171,18 @@ static int _raid_remove_images(struct logical_volume *lv,
}
/*
* lv_raid_change_image_count
* @lv
* @new_count: The absolute count of images (e.g. '2' for a 2-way mirror)
* @pvs: The list of PVs that are candidates for removal (or empty list)
* _lv_raid_change_image_count
* new_count: The absolute count of images (e.g. '2' for a 2-way mirror)
* allocate_pvs: The list of PVs that are candidates for removal (or empty list)
*
* RAID arrays have 'images' which are composed of two parts, they are:
* - 'rimage': The data/parity holding portion
* - 'rmeta' : The metadata holding portion (i.e. superblock/bitmap area)
* This function adds or removes _both_ portions of the image and commits
* the results.
*
* Returns: 1 on success, 0 on failure
*/
int lv_raid_change_image_count(struct logical_volume *lv,
uint32_t new_count, struct dm_list *pvs)
static int _lv_raid_change_image_count(struct logical_volume *lv, uint32_t new_count,
struct dm_list *allocate_pvs, struct dm_list *removal_lvs)
{
uint32_t old_count = lv_raid_image_count(lv);
@ -1206,9 +1203,15 @@ int lv_raid_change_image_count(struct logical_volume *lv,
}
if (old_count > new_count)
return _raid_remove_images(lv, new_count, pvs);
return _raid_remove_images(lv, new_count, allocate_pvs);
return _raid_add_images(lv, new_count, pvs);
return _raid_add_images(lv, new_count, allocate_pvs);
}
int lv_raid_change_image_count(struct logical_volume *lv, uint32_t new_count,
struct dm_list *allocate_pvs)
{
return _lv_raid_change_image_count(lv, new_count, allocate_pvs, NULL);
}
int lv_raid_split(struct logical_volume *lv, const char *split_name,
@ -1543,6 +1546,7 @@ static int _alloc_rmeta_devs_for_rimage_devs(struct logical_volume *lv,
return 1;
}
/* Add new @lvs to @lv at @area_offset */
static int _add_image_component_list(struct lv_segment *seg, int delete_from_list,
uint64_t lv_flags, struct dm_list *lvs, uint32_t area_offset)