Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

octopus: mds/CInode: Optimize only pinned by subtrees check #37248

Merged
merged 1 commit into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/mds/CInode.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,9 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
get_subtree_dirfrags(v);
return v;
}
int get_num_subtree_roots() const {
return num_subtree_roots;
}

CDir *get_or_open_dirfrag(MDCache *mdcache, frag_t fg);
CDir *add_dirfrag(CDir *dir);
Expand Down
4 changes: 2 additions & 2 deletions src/mds/MDCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6819,9 +6819,9 @@ std::pair<bool, uint64_t> MDCache::trim(uint64_t count)
}
} else if (!diri->is_auth() && dir->get_num_ref() <= 1) {
// only subtree pin
auto&& ls = diri->get_subtree_dirfrags();
if (diri->get_num_ref() > (int)ls.size()) // only pinned by subtrees
if (diri->get_num_ref() > diri->get_num_subtree_roots()) {
continue;
}

// don't trim subtree root if its auth MDS is recovering.
// This simplify the cache rejoin code.
Expand Down