| 885 | // metadata cache stuff |
| 886 | |
| 887 | void 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 | |
| 915 | void Client::trim_cache_for_reconnect(MetaSession *s) |
| 916 | { |
nothing calls this directly
no test coverage detected