Moving membuffer cache related configuration code from deep inside the FSlayer to the svn utilities where all other cache related code lives.Details on the discussion can be found here:http://svn.haxx.se/dev/archive-2011-04/0169.shtmlTo minimize the risks of breaking builds on other platforms, library dependencies will be cleaned up in a follow-up commit.* subversion/include/private/svn_fs_private.h (svn_fs__get_global_membuffer_cache): remove here* subversion/include/private/svn_cache.h (svn_cache__get_global_membuffer_cache): rename and move it to here* subversion/include/svn_fs.h (svn_fs_cache_config_t, svn_fs_get_cache_config, svn_fs_set_cache_config): remove here* subversion/include/svn_cache_config.h (svn_cache_config_t, svn_get_cache_config, svn_set_cache_config): rename and move them to this new header file; adapt docstrings* subversion/libsvn_fs_util/caching.c move to:* subversion/libsvn_subr/svn_cache_config.c (svn_cache_config_t, svn_get_cache_config, svn_set_cache_config): rename* subversion/libsvn_fs_fs/caching.c (svn_fs_fs__initialize_caches, svn_fs_fs__initialize_txn_caches): adapt to renamed API functions* subversion/libsvn_ra/ra_loader.c (svn_ra_initialize): remove cache config code* subversion/svn/main.c (main): move it here and adapt it to renamed API* subversion/svnadmin/main.c (#includes): include svn_cache_config.h instead of svn_fs.h (main): adapt to renamed API functions and structures* subversion/svnserve/main.c (#includes, main): dito* build.conf (libsvn_subr): add the new svn_cache_config.h header to the DLL exports
LINUX and possibly other OS will over-commit memory. I.e. actualmemory pages allocation will be deferred to the time of the firstaccess. As a result, the application may simply segfault later.Therefore, ensure that the membuffer creation actually allocatesmemory pages. Also, free the whole cache memory if allocation of some parts failed. Continue with the cache disabled in that case.* subversion/libsvn_fs_util/caching.c (svn_fs__get_global_membuffer_cache): if cache creation fails, actually free the previously allocated memory* subversion/libsvn_subr/cache-membuffer.c (secure_aligned_pcalloc): replacement for apr_pcalloc that will not crash upon OOM (svn_cache__membuffer_cache_create): ensure that memory gets actually allocated despite of overcommitment by the OS; don't try to continue upon OOM
Defer cache initialization to first usage: mod_dav_svn may have to call svn_fs_set_cache_config() more than once if the Apache configcontains multiple caching related parameters (not today, but in thenear future). Also, this reduces the memory footprint if not all serverinstances actually access FSFS repositories.* subversion/libsvn_fs_util/caching.c (svn_fs__get_global_membuffer_cache): make it thread-safe and allow for concurrent initialization. (svn_fs_set_cache_config): don't create caches as a side-effect.