40 lines
1.5 KiB
Diff
40 lines
1.5 KiB
Diff
lib/metadata/pool_manip.c | 10 +++++++++-
|
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c
|
|
index b67882e..1975cb4 100644
|
|
--- a/lib/metadata/pool_manip.c
|
|
+++ b/lib/metadata/pool_manip.c
|
|
@@ -697,6 +697,8 @@ static struct logical_volume *_alloc_pool_metadata_spare(struct volume_group *vg
|
|
int handle_pool_metadata_spare(struct volume_group *vg, uint32_t extents,
|
|
struct dm_list *pvh, int poolmetadataspare)
|
|
{
|
|
+ /* Max usable size of any spare volume is currently 16GiB rouned to extent size */
|
|
+ const uint64_t MAX_SIZE = (UINT64_C(2 * 16) * 1024 * 1024 + vg->extent_size - 1) / vg->extent_size;
|
|
struct logical_volume *lv = vg->pool_metadata_spare_lv;
|
|
uint32_t seg_mirrors;
|
|
struct lv_segment *seg;
|
|
@@ -706,8 +708,11 @@ int handle_pool_metadata_spare(struct volume_group *vg, uint32_t extents,
|
|
/* Find maximal size of metadata LV */
|
|
dm_list_iterate_items(lvl, &vg->lvs)
|
|
if (lv_is_pool_metadata(lvl->lv) &&
|
|
- (lvl->lv->le_count > extents))
|
|
+ (lvl->lv->le_count > extents)) {
|
|
extents = lvl->lv->le_count;
|
|
+ if (extents >= MAX_SIZE)
|
|
+ break;
|
|
+ }
|
|
|
|
if (!poolmetadataspare) {
|
|
/* TODO: Not showing when lvm.conf would define 'n' ? */
|
|
@@ -718,6 +723,9 @@ int handle_pool_metadata_spare(struct volume_group *vg, uint32_t extents,
|
|
return 1;
|
|
}
|
|
|
|
+ if (extents > MAX_SIZE)
|
|
+ extents = MAX_SIZE;
|
|
+
|
|
if (!lv) {
|
|
if (!_alloc_pool_metadata_spare(vg, extents, pvh))
|
|
return_0;
|