From bbe1b93ed9d9fbe7ba269c62bc99ddce3af3653a Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sun, 26 May 2024 00:33:16 +0200 Subject: [PATCH] hash: increase some default hash table size Size of these hashes was quite small, so raise the size of hashed entries to reduce amount of hash collistion. Select some unique/unused number for hash_create below 8192. --- lib/device/dev-cache.c | 2 +- lib/filters/filter-persistent.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c index c4fdbe1fc..a816eb19a 100644 --- a/lib/device/dev-cache.c +++ b/lib/device/dev-cache.c @@ -1311,7 +1311,7 @@ int dev_cache_init(struct cmd_context *cmd) if (!(_cache.mem = dm_pool_create("dev_cache", 10 * 1024))) return_0; - if (!(_cache.names = dm_hash_create(1020)) || + if (!(_cache.names = dm_hash_create(8190)) || !(_cache.vgid_index = dm_hash_create(30)) || !(_cache.lvid_index = dm_hash_create(29))) { dm_pool_destroy(_cache.mem); diff --git a/lib/filters/filter-persistent.c b/lib/filters/filter-persistent.c index 212a5c183..7b20ff1d1 100644 --- a/lib/filters/filter-persistent.c +++ b/lib/filters/filter-persistent.c @@ -58,7 +58,7 @@ static int _init_hash(struct pfilter *pf) if (pf->devices) dm_hash_destroy(pf->devices); - if (!(pf->devices = dm_hash_create(511))) + if (!(pf->devices = dm_hash_create(8191))) return_0; return 1;