From patchwork Mon May 27 02:12:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2617231 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 BCD60DFB79 for ; Mon, 27 May 2013 02:12:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755933Ab3E0CMN (ORCPT ); Sun, 26 May 2013 22:12:13 -0400 Received: from mga01.intel.com ([192.55.52.88]:6941 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755779Ab3E0CMM (ORCPT ); Sun, 26 May 2013 22:12:12 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 26 May 2013 19:12:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,747,1363158000"; d="scan'208";a="343699348" Received: from zyan5-mobl.sh.intel.com (HELO [10.239.13.105]) ([10.239.13.105]) by fmsmga002.fm.intel.com with ESMTP; 26 May 2013 19:12:11 -0700 Message-ID: <51A2C0FB.5050601@intel.com> Date: Mon, 27 May 2013 10:12:11 +0800 From: "Yan, Zheng" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: Sage Weil CC: ceph-devel@vger.kernel.org, greg@inktank.com Subject: Re: [PATCH 14/30] mds: export CInode:mds_caps_wanted References: <1369296418-14871-1-git-send-email-zheng.z.yan@intel.com> <1369296418-14871-15-git-send-email-zheng.z.yan@intel.com> In-Reply-To: Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org updated version --- From 2ff69c453d24404f3b4215cdd977d6fabcd5ea9b Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Mon, 6 May 2013 09:06:52 +0800 Subject: [PATCH 14/33] mds: export CInode:mds_caps_wanted CInode:mds_caps_wanted is used to keep track of caps wanted by non-auth MDS. The auth MDS checks it when choosing locks' states. Signed-off-by: Yan, Zheng --- src/mds/CInode.h | 4 ++-- src/mds/Migrator.cc | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 47973c2..727e18c 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -369,7 +369,7 @@ public: protected: // file capabilities map client_caps; // client -> caps - map mds_caps_wanted; // [auth] mds -> caps wanted + map mds_caps_wanted; // [auth] mds -> caps wanted int replica_caps_wanted; // [replica] what i've requested from auth map > client_snap_caps; // [auth] [snap] dirty metadata we still need from the head @@ -709,7 +709,7 @@ public: bool is_any_caps() { return !client_caps.empty(); } bool is_any_nonstale_caps() { return count_nonstale_caps(); } - map& get_mds_caps_wanted() { return mds_caps_wanted; } + map& get_mds_caps_wanted() { return mds_caps_wanted; } map& get_client_caps() { return client_caps; } Capability *get_client_cap(client_t client) { diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 5cc26a3..766ecf9 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -1025,6 +1025,7 @@ void Migrator::encode_export_inode_caps(CInode *in, bufferlist& bl, map cap_map; in->export_client_caps(cap_map); ::encode(cap_map, bl); + ::encode(in->get_mds_caps_wanted(), bl); in->state_set(CInode::STATE_EXPORTINGCAPS); in->get(CInode::PIN_EXPORTINGCAPS); @@ -2379,7 +2380,8 @@ void Migrator::decode_import_inode_caps(CInode *in, { map cap_map; ::decode(cap_map, blp); - if (!cap_map.empty()) { + ::decode(in->get_mds_caps_wanted(), blp); + if (!cap_map.empty() || !in->get_mds_caps_wanted().empty()) { cap_imports[in].swap(cap_map); in->get(CInode::PIN_IMPORTINGCAPS); } @@ -2388,8 +2390,6 @@ void Migrator::decode_import_inode_caps(CInode *in, void Migrator::finish_import_inode_caps(CInode *in, int from, map &cap_map) { - assert(!cap_map.empty()); - for (map::iterator it = cap_map.begin(); it != cap_map.end(); ++it) { @@ -2406,6 +2406,7 @@ void Migrator::finish_import_inode_caps(CInode *in, int from, mds->mdcache->do_cap_import(session, in, cap); } + in->replica_caps_wanted = 0; in->put(CInode::PIN_IMPORTINGCAPS); }