Author: ivan Date: Wed May 27 11:09:58 2015 New Revision: 1681974 URL: http://svn.apache.org/r1681974 Log: Avoid double cache lookup in FSFS in some cases.
Discussion: http://svn.haxx.se/dev/archive-2015-05/0172.shtml * subversion/libsvn_fs_fs/cached_data.c (svn_fs_fs__rep_contents_dir_entry): Use get_dir_contents() function to read directory entries on cache miss instead of svn_fs_fs__rep_contents_dir() because it performs cache lookup before reading data from disk. Modified: subversion/trunk/subversion/libsvn_fs_fs/cached_data.c Modified: subversion/trunk/subversion/libsvn_fs_fs/cached_data.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/cached_data.c?rev=1681974&r1=1681973&r2=1681974&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_fs/cached_data.c (original) +++ subversion/trunk/subversion/libsvn_fs_fs/cached_data.c Wed May 27 11:09:58 2015 @@ -2751,17 +2751,20 @@ svn_fs_fs__rep_contents_dir_entry(svn_fs /* fetch data from disk if we did not find it in the cache */ if (! found) { - apr_array_header_t *entries; svn_fs_dirent_t *entry; svn_fs_dirent_t *entry_copy = NULL; + svn_fs_fs__dir_data_t dir; - /* read the dir from the file system. It will probably be put it - into the cache for faster lookup in future calls. */ - SVN_ERR(svn_fs_fs__rep_contents_dir(&entries, fs, noderev, - scratch_pool, scratch_pool)); + /* Read in the directory contents. */ + SVN_ERR(get_dir_contents(&dir, fs, noderev, scratch_pool, + scratch_pool)); + + /* Update the cache, if we are to use one. */ + if (cache) + SVN_ERR(svn_cache__set(cache, key, &dir, scratch_pool)); /* find desired entry and return a copy in POOL, if found */ - entry = svn_fs_fs__find_dir_entry(entries, name, NULL); + entry = svn_fs_fs__find_dir_entry(dir.entries, name, NULL); if (entry) { entry_copy = apr_palloc(result_pool, sizeof(*entry_copy));
