From patchwork Fri Jan 4 09:02:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1931971 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id EAF48DFABD for ; Fri, 4 Jan 2013 09:03:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754188Ab3ADJDV (ORCPT ); Fri, 4 Jan 2013 04:03:21 -0500 Received: from mga01.intel.com ([192.55.52.88]:53494 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754098Ab3ADJC5 (ORCPT ); Fri, 4 Jan 2013 04:02:57 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 04 Jan 2013 01:02:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,409,1355126400"; d="scan'208";a="272790122" Received: from zyan5-mobl.sh.intel.com ([10.239.36.28]) by fmsmga002.fm.intel.com with ESMTP; 04 Jan 2013 01:02:56 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 29/29] mds: optimize C_MDC_RetryOpenRemoteIno Date: Fri, 4 Jan 2013 17:02:20 +0800 Message-Id: <1357290140-17044-30-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1357290140-17044-1-git-send-email-zheng.z.yan@intel.com> References: <1357290140-17044-1-git-send-email-zheng.z.yan@intel.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: "Yan, Zheng" 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 --- src/mds/MDCache.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); } };