From: Patrick Donnelly Date: Sun, 20 Jan 2019 04:40:11 +0000 (-0800) Subject: mds: adapt drop cache for incremental trim X-Git-Tag: v12.2.12~63^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ab7ff0fcad9574ff1600c0888d83b7a53357464b;p=ceph.git mds: adapt drop cache for incremental trim Signed-off-by: Patrick Donnelly (cherry picked from commit b750b3bb25d3c0cbad7a24ad6c7fd215d1b16395) --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 2e392ce95ff..d27251d6cf7 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -382,13 +382,20 @@ private: void trim_cache() { dout(20) << __func__ << dendl; - if (!mdcache->trim(UINT64_MAX)) { - cmd_err(f, "failed to trim cache"); - complete(-EINVAL); - return; + auto p = mdcache->trim(UINT64_MAX); + auto& throttled = p.first; + auto& count = p.second; + 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() {