Skip to content

Commit

Permalink
mds: adapt drop cache for incremental trim
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Donnelly <[email protected]>
  • Loading branch information
batrick committed Jan 29, 2019
1 parent 7bf2f31 commit b750b3b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/mds/MDSRank.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,18 @@ class C_Drop_Cache : public MDSInternalContext {
void trim_cache() {
dout(20) << __func__ << dendl;

if (!mdcache->trim(UINT64_MAX)) {
cmd_err(f, "failed to trim cache");
complete(-EINVAL);
return;
auto [throttled, count] = mdcache->trim(UINT64_MAX);
dout(10) << __func__
<< (throttled ? " (throttled)" : "")
<< " trimmed " << count << " caps" << dendl;
if (throttled && count > 0) {
auto timer = new FunctionContext([this](int _) {
trim_cache();
});
mds->timer.add_event_after(1.0, timer);
} else {
cache_status();
}

cache_status();
}

void cache_status() {
Expand Down

0 comments on commit b750b3b

Please sign in to comment.