Module: Mesa Branch: main Commit: dab1bd5a77e82ced0b9446d63a147e79307708f1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dab1bd5a77e82ced0b9446d63a147e79307708f1
Author: Rob Clark <[email protected]> Date: Sat Apr 1 07:35:01 2023 -0700 util/disk_cache: Use queue state to skip put If we move the blob-cache path into the async queue, then path_init_failed is no longer a good way to check if puts should be a no-op. But fortunately checking if the queue is initialized is, and is a more obvious check because what it is guarding is a util_queue_add_job(). Signed-off-by: Rob Clark <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22248> --- src/util/disk_cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index e7aa1bea9ab..cd338f8b353 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -317,7 +317,7 @@ disk_cache_destroy(struct disk_cache *cache) cache->stats.misses); } - if (cache && !cache->path_init_failed) { + if (cache && util_queue_is_initialized(&cache->cache_queue)) { util_queue_finish(&cache->cache_queue); util_queue_destroy(&cache->cache_queue); @@ -551,7 +551,7 @@ disk_cache_put(struct disk_cache *cache, const cache_key key, return; } - if (cache->path_init_failed) + if (!util_queue_is_initialized(&cache->cache_queue)) return; struct disk_cache_put_job *dc_job = @@ -575,7 +575,7 @@ disk_cache_put_nocopy(struct disk_cache *cache, const cache_key key, return; } - if (cache->path_init_failed) { + if (!util_queue_is_initialized(&cache->cache_queue)) { free(data); return; }
