]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
FileStore: FDCache lookup is rearranged
authorSomnath Roy <somnath.roy@sandisk.com>
Mon, 30 Jun 2014 08:54:36 +0000 (01:54 -0700)
committerSomnath Roy <somnath.roy@sandisk.com>
Thu, 14 Aug 2014 22:28:30 +0000 (15:28 -0700)
In lfn_open() there is no point of building the Index if the
cache lookup is successful and caller is not asking for Index.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
src/os/FileStore.cc

index 9e27244f90d3fe0faed2b8969e04ee1aab8bad4e..4c4a16581501da06c8e69cdd0054ae3d32d8afe7 100644 (file)
@@ -225,8 +225,23 @@ int FileStore::lfn_open(coll_t cid,
         ( oid.shard_id == shard_id_t::NO_SHARD &&
           oid.generation == ghobject_t::NO_GEN ));
   assert(outfd);
+  int r = 0;
 
   bool need_lock = true;
+  if (!replaying) {
+    *outfd = fdcache.lookup(oid);
+    if (*outfd) {
+      if (!index) {
+        return 0;
+      } else {
+        if (!((*index).index)) {
+          r = get_index(cid, index);
+          return r;
+        }
+      }
+    }
+  }
+
   int flags = O_RDWR;
   if (create)
     flags |= O_CREAT;
@@ -235,7 +250,7 @@ int FileStore::lfn_open(coll_t cid,
   if (!index) {
     index = &index2;
   }
-  int r = 0;
+
   if (!((*index).index)) {
     r = get_index(cid, index);
   } else {
@@ -243,11 +258,6 @@ int FileStore::lfn_open(coll_t cid,
   }
 
   int fd, exist;
-  if (!replaying) {
-    *outfd = fdcache.lookup(oid);
-    if (*outfd)
-      return 0;
-  }
 
   
   assert(NULL != (*index).index);