From d1dcc035666b3ae47145d5aebd262f0375b60f61 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 15 Nov 2010 13:43:56 -0800 Subject: [PATCH] mds: allow frag merge on subtree root Fix purge_stolen and adjust_dir_fragments. Signed-off-by: Sage Weil --- src/mds/CDir.cc | 14 +++++++++----- src/mds/MDCache.cc | 5 ++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 27ed87acff0b6..421cd425aaa51 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -648,13 +648,17 @@ void CDir::purge_stolen(list& waiters, bool replay) if (is_auth()) clear_replica_map(); - if (is_dirty()) mark_clean(); - if (state_test(STATE_IMPORTBOUND)) put(PIN_IMPORTBOUND); - if (state_test(STATE_EXPORTBOUND)) put(PIN_EXPORTBOUND); + if (is_dirty()) + mark_clean(); + if (state_test(STATE_IMPORTBOUND)) + put(PIN_IMPORTBOUND); + if (state_test(STATE_EXPORTBOUND)) + put(PIN_EXPORTBOUND); - if (auth_pins > 0) put(PIN_AUTHPIN); + if (auth_pins > 0) + put(PIN_AUTHPIN); - assert(get_num_ref() == (state_test(STATE_STICKY) ? 1:0)); + assert(get_num_ref() == (state_test(STATE_STICKY) ? 1:0) + (is_subtree_root() ? 1:0)); } void CDir::init_fragment_pins() diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index c106a07d6cace..e06a453369132 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -8630,8 +8630,11 @@ void MDCache::adjust_dir_fragments(CInode *diri, CDir *frag = get_subtree_root((*p)->get_parent_dir()); subtrees[frag].insert(*p); } - + show_subtrees(10); + + dir->put(CDir::PIN_SUBTREE); + dir->dir_auth = CDIR_AUTH_DEFAULT; } diri->close_dirfrag(dir->get_frag()); -- 2.39.5