darktable-org/darktable — pull request #535 by pedrocr (2014-04-24 20:33:51+00:00)
Title: Disk paging for the thumbnail cache

To be able to handle large collections quickly there needs to be disk caching of the thumbnail contents. This implements a very simple method:

* Whenever dt_cache_gc runs and evicts a cache slot, write that to disk
* Whenever dt_cache_read_get has a cache miss, first see if it's on disk and load it if it exists

The filebacked option to dt_cache is enabled with dt_cache_set_filebacked and then everything else is transparent to the caller. The filebacking was enabled for DT_MIPMAP_0 through DT_MIPMAP_3 (the thumbnail levels).

This patch stills needs review, particularly for the correctness of the locking, especially inside dt_cache_read_get where we now sometimes write into the slot but don't have a write lock. From the context I wasn't sure it was needed, but I may be wrong.