MCPcopy Create free account
hub / github.com/ceph/ceph / trim_cache

Method trim_cache

src/client/Client.cc:887–913  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

885// metadata cache stuff
886
887void Client::trim_cache(bool trim_kernel_dcache)
888{
889 uint64_t max = cct->_conf->client_cache_size;
890 ldout(cct, 20) << "trim_cache size " << lru.lru_get_size() << " max " << max << dendl;
891 unsigned last = 0;
892 while (lru.lru_get_size() != last) {
893 last = lru.lru_get_size();
894
895 if (!is_unmounting() && lru.lru_get_size() <= max) break;
896
897 // trim!
898 Dentry *dn = static_cast<Dentry*>(lru.lru_get_next_expire());
899 if (!dn)
900 break; // done
901
902 trim_dentry(dn);
903 }
904
905 if (trim_kernel_dcache && lru.lru_get_size() > max)
906 _invalidate_kernel_dcache();
907
908 // hose root?
909 if (lru.lru_get_size() == 0 && root && root->get_nref() == 1 && inode_map.size() == 1 + root_parents.size()) {
910 ldout(cct, 15) << "trim_cache trimmed root " << root << dendl;
911 root.reset();
912 }
913}
914
915void Client::trim_cache_for_reconnect(MetaSession *s)
916{

Callers

nothing calls this directly

Calls 5

lru_get_sizeMethod · 0.80
lru_get_next_expireMethod · 0.80
get_nrefMethod · 0.80
sizeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected