diff mbox

[29/29] mds: optimize C_MDC_RetryOpenRemoteIno

Message ID 1357290140-17044-30-git-send-email-zheng.z.yan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yan, Zheng Jan. 4, 2013, 9:02 a.m. UTC
From: "Yan, Zheng" <zheng.z.yan@intel.com>

When opening remote inode, C_MDC_RetryOpenRemoteIno is used as onfinish
context for discovering remote inode. When it is called, the MDS may
already have the inode.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
---
 src/mds/MDCache.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index 236a0b9..9557436 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -7049,7 +7049,11 @@  public:
   C_MDC_RetryOpenRemoteIno(MDCache *mdc, inodeno_t i, Context *c, bool wx) :
     mdcache(mdc), ino(i), want_xlocked(wx), onfinish(c) {}
   void finish(int r) {
-    mdcache->open_remote_ino(ino, onfinish, want_xlocked);
+    if (mdcache->get_inode(ino)) {
+      onfinish->finish(0);
+      delete onfinish;
+    } else
+      mdcache->open_remote_ino(ino, onfinish, want_xlocked);
   }
 };