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 <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22248>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user