diff mbox

[07/12] mds: Avoid save unnecessary parent snaprealm

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

Commit Message

Yan, Zheng Oct. 2, 2012, 8:55 a.m. UTC
From: "Yan, Zheng" <zheng.z.yan@intel.com>

We can avoid save parent snaprealm if current_parent_since is greater
than parent snaprealm's newest sequence.

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

Patch

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;
   }
 }