From patchwork Fri Jun 21 06:39:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2760441 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B808FC0AB1 for ; Fri, 21 Jun 2013 06:44:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA153201C0 for ; Fri, 21 Jun 2013 06:44:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE094201BE for ; Fri, 21 Jun 2013 06:44:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161448Ab3FUGoX (ORCPT ); Fri, 21 Jun 2013 02:44:23 -0400 Received: from mga01.intel.com ([192.55.52.88]:50145 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161442Ab3FUGoX (ORCPT ); Fri, 21 Jun 2013 02:44:23 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 20 Jun 2013 23:44:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,911,1363158000"; d="scan'208";a="357230668" Received: from zyan5-mobl.sh.intel.com ([10.239.13.101]) by fmsmga002.fm.intel.com with ESMTP; 20 Jun 2013 23:44:21 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, greg@inktank.com, "Yan, Zheng" Subject: [PATCH 1/2] mds: use "open-by-ino" helper to handle LOOKUPINO request Date: Fri, 21 Jun 2013 14:39:26 +0800 Message-Id: <1371796767-16205-1-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.8.1.4 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Yan, Zheng" Fixes #3541 Signed-off-by: Yan, Zheng --- src/mds/Server.cc | 38 ++++++++------------------------------ src/mds/Server.h | 1 - 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 1d16d04..e84626b 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -2483,41 +2483,19 @@ void Server::handle_client_lookup_ino(MDRequest *mdr) void Server::_lookup_ino(MDRequest *mdr) { inodeno_t ino = mdr->client_request->get_filepath().get_ino(); - dout(10) << "_lookup_ino " << mdr << " checking peers for ino " << ino << dendl; - mdcache->find_ino_peers(ino, - new C_MDS_LookupIno2(this, mdr), -1); + dout(10) << "_lookup_ino " << mdr << " opening ino " << ino << dendl; + mdcache->open_ino(ino, (int64_t)-1, new C_MDS_LookupIno2(this, mdr), false); } -struct C_MDS_LookupIno3 : public Context { - Server *server; - MDRequest *mdr; - C_MDS_LookupIno3(Server *s, MDRequest *r) : server(s), mdr(r) {} - void finish(int r) { - server->_lookup_ino_3(mdr, r); - } -}; - void Server::_lookup_ino_2(MDRequest *mdr, int r) { inodeno_t ino = mdr->client_request->get_filepath().get_ino(); - dout(10) << "_lookup_ino_2 " << mdr << " checked peers for ino " << ino - << " and got r=" << r << dendl; - if (r == 0) { - dispatch_client_request(mdr); - return; - } - - // okay fine, maybe it's a directory though... - mdcache->find_ino_dir(ino, new C_MDS_LookupIno3(this, mdr)); -} - -void Server::_lookup_ino_3(MDRequest *mdr, int r) -{ - inodeno_t ino = mdr->client_request->get_filepath().get_ino(); - dout(10) << "_lookup_ino_3 " << mdr << " checked dir obj for ino " << ino - << " and got r=" << r << dendl; - if (r == 0) { - dispatch_client_request(mdr); + dout(10) << "_lookup_ino_2 " << mdr << " ino " << ino << " r=" << r << dendl; + if (r >= 0) { + if (r == mds->get_nodeid()) + dispatch_client_request(mdr); + else + mdcache->request_forward(mdr, r); return; } diff --git a/src/mds/Server.h b/src/mds/Server.h index 269b286..2da4055 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -146,7 +146,6 @@ public: void handle_client_lookup_ino(MDRequest *mdr); void _lookup_ino(MDRequest *mdr); void _lookup_ino_2(MDRequest *mdr, int r); - void _lookup_ino_3(MDRequest *mdr, int r); void handle_client_readdir(MDRequest *mdr); void handle_client_file_setlock(MDRequest *mdr); void handle_client_file_readlock(MDRequest *mdr);