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

vg: remove unused hostnames hash table

The hash table of lv creation hostnames was not used for anything,
so remove it.
This commit is contained in:
David Teigland 2024-09-23 15:04:53 -05:00
parent 1c3d7dfb07
commit d7a028aaad
3 changed files with 1 additions and 21 deletions

View File

@ -1558,8 +1558,6 @@ bad:
int lv_set_creation(struct logical_volume *lv, int lv_set_creation(struct logical_volume *lv,
const char *hostname, uint64_t timestamp) const char *hostname, uint64_t timestamp)
{ {
const char *hn;
if (!hostname) { if (!hostname) {
if (!_utsinit) { if (!_utsinit) {
if (uname(&_utsname)) { if (uname(&_utsname)) {
@ -1573,17 +1571,7 @@ int lv_set_creation(struct logical_volume *lv,
hostname = _utsname.nodename; hostname = _utsname.nodename;
} }
if (!(hn = dm_hash_lookup(lv->vg->hostnames, hostname))) { lv->hostname = dm_pool_strdup(lv->vg->vgmem, 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->timestamp = timestamp ? : (uint64_t) time(NULL); lv->timestamp = timestamp ? : (uint64_t) time(NULL);
return 1; return 1;

View File

@ -46,12 +46,6 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
vg->vgmem = vgmem; vg->vgmem = vgmem;
vg->alloc = ALLOC_NORMAL; 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->pvs);
dm_list_init(&vg->pv_write_list); dm_list_init(&vg->pv_write_list);
dm_list_init(&vg->lvs); dm_list_init(&vg->lvs);
@ -81,7 +75,6 @@ static void _free_vg(struct volume_group *vg)
if (vg->committed_cft) if (vg->committed_cft)
config_destroy(vg->committed_cft); config_destroy(vg->committed_cft);
dm_hash_destroy(vg->hostnames);
dm_pool_destroy(vg->vgmem); dm_pool_destroy(vg->vgmem);
} }

View File

@ -129,7 +129,6 @@ struct volume_group {
uint32_t mda_copies; /* target number of mdas for this VG */ 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 *pool_metadata_spare_lv; /* one per VG */
struct logical_volume *sanlock_lv; /* one per VG */ struct logical_volume *sanlock_lv; /* one per VG */
struct dm_list msg_list; struct dm_list msg_list;