util/disk_cache: dont create multidisk cache dir if unused

As reported in issue #11825 the code that is meant to clean up old
cache dirs actually ends up creating an empty dir due to reusing
existing code to create the cache path required for the potential
cleanup.

Here we make the code more flexible allowing cache path strings
to be returned by the helpers if the directory already exists
or returning NULL if we don't want to create a new directory.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11825
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33699>
This commit is contained in:
Timothy Arceri
2025-02-24 11:16:44 +11:00
committed by Marge Bot
parent 4d36528d04
commit 5ad508d743
3 changed files with 39 additions and 24 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ disk_cache_type_create(const char *gpu_name,
goto path_fail;
char *path = disk_cache_generate_cache_dir(local, gpu_name, driver_id,
cache_dir_name, cache_type);
cache_dir_name, cache_type, true);
if (!path)
goto path_fail;