util/disk_cache: Switch to multipart mesa-db cache

Replace single file mesa-db cache with multipart mesa-db cache.
Each part of the multipart cache essentially is a single file
mesa-db cache, aka database shard. Multipart cache brings much
more optimized cache eviction times in comparison to a single file
cache.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20256>
This commit is contained in:
Dmitry Osipenko
2022-10-24 20:46:21 +03:00
committed by Marge Bot
parent fd9f7b748e
commit 4fe2247be5
3 changed files with 11 additions and 9 deletions
+6 -5
View File
@@ -1054,8 +1054,8 @@ disk_cache_db_load_item(struct disk_cache *cache, const cache_key key,
size_t *size)
{
size_t cache_tem_size = 0;
void *cache_item = mesa_cache_db_read_entry(&cache->cache_db, key,
&cache_tem_size);
void *cache_item = mesa_cache_db_multipart_read_entry(&cache->cache_db,
key, &cache_tem_size);
if (!cache_item)
return NULL;
@@ -1075,8 +1075,9 @@ disk_cache_db_write_item_to_disk(struct disk_cache_put_job *dc_job)
if (!create_cache_item_header_and_blob(dc_job, &cache_blob))
return false;
bool r = mesa_cache_db_entry_write(&dc_job->cache->cache_db, dc_job->key,
cache_blob.data, cache_blob.size);
bool r = mesa_cache_db_multipart_entry_write(&dc_job->cache->cache_db,
dc_job->key, cache_blob.data,
cache_blob.size);
blob_finish(&cache_blob);
return r;
@@ -1085,7 +1086,7 @@ disk_cache_db_write_item_to_disk(struct disk_cache_put_job *dc_job)
bool
disk_cache_db_load_cache_index(void *mem_ctx, struct disk_cache *cache)
{
return mesa_cache_db_open(&cache->cache_db, cache->path);
return mesa_cache_db_multipart_open(&cache->cache_db, cache->path);
}
#endif