From patchwork Tue Oct 2 08:55:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1536451 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 87771DF238 for ; Tue, 2 Oct 2012 08:56:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754860Ab2JBI4P (ORCPT ); Tue, 2 Oct 2012 04:56:15 -0400 Received: from mga03.intel.com ([143.182.124.21]:51424 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754674Ab2JBI4O (ORCPT ); Tue, 2 Oct 2012 04:56:14 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 02 Oct 2012 01:56:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,522,1344236400"; d="scan'208";a="199528012" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.21.40]) by azsmga001.ch.intel.com with ESMTP; 02 Oct 2012 01:56:12 -0700 From: "Yan, Zheng" To: sage@inktank.com, ceph-devel@vger.kernel.org Cc: "Yan, Zheng" Subject: [PATCH 07/12] mds: Avoid save unnecessary parent snaprealm Date: Tue, 2 Oct 2012 16:55:47 +0800 Message-Id: <1349168152-13281-7-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1349168152-13281-1-git-send-email-zheng.z.yan@intel.com> References: <1349168152-13281-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" We can avoid save parent snaprealm if current_parent_since is greater than parent snaprealm's newest sequence. Signed-off-by: Yan, Zheng --- src/mds/CInode.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 8fed424..8566e55 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -386,8 +386,10 @@ void CInode::project_past_snaprealm_parent(SnapRealm *newparent) if (newparent != oldparent) { snapid_t oldparentseq = oldparent->get_newest_seq(); - new_snap->past_parents[oldparentseq].ino = oldparent->inode->ino(); - new_snap->past_parents[oldparentseq].first = new_snap->current_parent_since; + if (oldparentseq + 1 > new_snap->current_parent_since) { + new_snap->past_parents[oldparentseq].ino = oldparent->inode->ino(); + new_snap->past_parents[oldparentseq].first = new_snap->current_parent_since; + } new_snap->current_parent_since = MAX(oldparentseq, newparent->get_last_created()) + 1; } }