From ab053ad6c17a7ac4fac22183153e6a46be9fe4be Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Fri, 5 Apr 2002 14:32:22 +0000 Subject: [PATCH] Fix lv_setup() not to generate a new lvid each time if asked to setup the same LV more than once - subsequent times validate only. --- lib/format1/format1.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/format1/format1.c b/lib/format1/format1.c index c67d4658f..19daae03a 100644 --- a/lib/format1/format1.c +++ b/lib/format1/format1.c @@ -438,11 +438,16 @@ static int _find_free_lvnum(struct logical_volume *lv) return i; } +/* + * Validate/populate LV structure for format1. + * Supplied LV structure can be for a new LV or for an already-existing one. + */ static int _lv_setup(struct format_instance *fi, struct logical_volume *lv) { uint64_t max_size = UINT_MAX; - lvid_from_lvnum(&lv->lvid, &lv->vg->id, _find_free_lvnum(lv)); + if (!*lv->lvid.s) + lvid_from_lvnum(&lv->lvid, &lv->vg->id, _find_free_lvnum(lv)); if (lv->le_count > MAX_LE_TOTAL) { log_error("logical volumes cannot contain more than " -- 2.43.5