From 16241b2dc7c4041533e32bacd7a023c70a9db800 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 28 Oct 2024 11:05:59 +0100 Subject: [PATCH] lv_manip: init major minor in alloc_lv Move initialization of major and minor to alloc_lv(). --- lib/format_text/import_vsn1.c | 2 -- lib/metadata/lv_manip.c | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c index 3a824f5a3..4f76625a5 100644 --- a/lib/format_text/import_vsn1.c +++ b/lib/format_text/import_vsn1.c @@ -973,8 +973,6 @@ static int _read_lvsegs(struct cmd_context *cmd, return_0; lv->size = (uint64_t) lv->le_count * (uint64_t) vg->extent_size; - lv->minor = -1; - lv->major = -1; if (lv->status & FIXED_MINOR) { if (!_read_int32(lvn, "minor", &lv->minor)) { diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 348548e1f..a1d4f641a 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -7303,6 +7303,9 @@ struct logical_volume *alloc_lv(struct dm_pool *mem) return NULL; } + lv->major = -1; + lv->minor = -1; + dm_list_init(&lv->snapshot_segs); dm_list_init(&lv->segments); dm_list_init(&lv->tags); @@ -7356,8 +7359,6 @@ struct logical_volume *lv_create_empty(const char *name, lv->status = status; lv->alloc = alloc; lv->read_ahead = vg->cmd->default_settings.read_ahead; - lv->major = -1; - lv->minor = -1; lv->size = UINT64_C(0); lv->le_count = 0;