]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add dentries in dirfrag to LRU in reverse order
authorYan, Zheng <zheng.z.yan@intel.com>
Tue, 1 Apr 2014 13:08:02 +0000 (21:08 +0800)
committerYan, Zheng <zheng.z.yan@intel.com>
Wed, 2 Apr 2014 04:19:26 +0000 (12:19 +0800)
Files in a dirfrag are usually processed in the order of readdir
results. Files at the beginning of are more likely to be used in
the future than files at the last.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
src/mds/CDir.cc

index a3b4945e4d84f2e074e066710191ac1680b14600..6e93ec5ecea737777dd9eece940ebe8b74d2b150 100644 (file)
@@ -1540,10 +1540,10 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
 
   bool stray = inode->is_stray();
 
-  unsigned pos = 0;
-  for (map<string, bufferlist>::iterator p = omap.begin();
-       p != omap.end();
-       ++p, ++pos) {
+  unsigned pos = omap.size() - 1;
+  for (map<string, bufferlist>::reverse_iterator p = omap.rbegin();
+       p != omap.rend();
+       ++p, --pos) {
     // dname
     string dname;
     snapid_t first, last;