From d7a028aaad7070c62ff8071315886a589d231e34 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Mon, 23 Sep 2024 15:04:53 -0500 Subject: [PATCH] vg: remove unused hostnames hash table The hash table of lv creation hostnames was not used for anything, so remove it. --- lib/metadata/lv.c | 14 +------------- lib/metadata/vg.c | 7 ------- lib/metadata/vg.h | 1 - 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c index 36301b9a3..a240ed3ba 100644 --- a/lib/metadata/lv.c +++ b/lib/metadata/lv.c @@ -1558,8 +1558,6 @@ bad: int lv_set_creation(struct logical_volume *lv, const char *hostname, uint64_t timestamp) { - const char *hn; - if (!hostname) { if (!_utsinit) { if (uname(&_utsname)) { @@ -1573,17 +1571,7 @@ int lv_set_creation(struct logical_volume *lv, hostname = _utsname.nodename; } - if (!(hn = dm_hash_lookup(lv->vg->hostnames, hostname))) { - if (!(hn = dm_pool_strdup(lv->vg->vgmem, hostname))) { - log_error("Failed to duplicate hostname"); - return 0; - } - - if (!dm_hash_insert(lv->vg->hostnames, hostname, (void*)hn)) - return_0; - } - - lv->hostname = hn; + lv->hostname = dm_pool_strdup(lv->vg->vgmem, hostname); lv->timestamp = timestamp ? : (uint64_t) time(NULL); return 1; diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c index adc954bab..8e7fb41a6 100644 --- a/lib/metadata/vg.c +++ b/lib/metadata/vg.c @@ -46,12 +46,6 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd, vg->vgmem = vgmem; vg->alloc = ALLOC_NORMAL; - if (!(vg->hostnames = dm_hash_create(14))) { - log_error("Failed to allocate VG hostname hashtable."); - dm_pool_destroy(vgmem); - return NULL; - } - dm_list_init(&vg->pvs); dm_list_init(&vg->pv_write_list); dm_list_init(&vg->lvs); @@ -81,7 +75,6 @@ static void _free_vg(struct volume_group *vg) if (vg->committed_cft) config_destroy(vg->committed_cft); - dm_hash_destroy(vg->hostnames); dm_pool_destroy(vg->vgmem); } diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h index ae79e6162..d4ba535d9 100644 --- a/lib/metadata/vg.h +++ b/lib/metadata/vg.h @@ -129,7 +129,6 @@ struct volume_group { uint32_t mda_copies; /* target number of mdas for this VG */ - struct dm_hash_table *hostnames; /* map of creation hostnames */ struct logical_volume *pool_metadata_spare_lv; /* one per VG */ struct logical_volume *sanlock_lv; /* one per VG */ struct dm_list msg_list;