diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 16:45:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 16:45:44 +0000 |
commit | 17d6a993fc17d533460c5f40f3908c708e057c18 (patch) | |
tree | 1a3bd93e0ecd74fa02f93a528fe2f87e5314c4b5 /src/mds/MDCache.cc | |
parent | Releasing progress-linux version 18.2.2-0progress7.99u1. (diff) | |
download | ceph-17d6a993fc17d533460c5f40f3908c708e057c18.tar.xz ceph-17d6a993fc17d533460c5f40f3908c708e057c18.zip |
Merging upstream version 18.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/mds/MDCache.cc | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 2ea13155e..5480e6dcd 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6784,6 +6784,13 @@ std::pair<bool, uint64_t> MDCache::trim_lru(uint64_t count, expiremap& expiremap << " pinned=" << lru.lru_get_num_pinned() << dendl; + dout(20) << "bottom_lru: " << bottom_lru.lru_get_size() << " items" + ", " << bottom_lru.lru_get_top() << " top" + ", " << bottom_lru.lru_get_bot() << " bot" + ", " << bottom_lru.lru_get_pintail() << " pintail" + ", " << bottom_lru.lru_get_num_pinned() << " pinned" + << dendl; + const uint64_t trim_counter_start = trim_counter.get(); bool throttled = false; while (1) { @@ -6804,20 +6811,25 @@ std::pair<bool, uint64_t> MDCache::trim_lru(uint64_t count, expiremap& expiremap } unexpirables.clear(); + dout(20) << "lru: " << lru.lru_get_size() << " items" + ", " << lru.lru_get_top() << " top" + ", " << lru.lru_get_bot() << " bot" + ", " << lru.lru_get_pintail() << " pintail" + ", " << lru.lru_get_num_pinned() << " pinned" + << dendl; + // trim dentries from the LRU until count is reached - // if mds is in standby_replay and skip trimming the inodes - while (!throttled && (cache_toofull() || count > 0 || is_standby_replay)) { + while (!throttled && (cache_toofull() || count > 0)) { throttled |= trim_counter_start+trimmed >= trim_threshold; if (throttled) break; CDentry *dn = static_cast<CDentry*>(lru.lru_expire()); if (!dn) { break; } - if (is_standby_replay && dn->get_linkage()->inode) { - // we move the inodes that need to be trimmed to the end of the lru queue. - // refer to MDCache::standby_trim_segment - lru.lru_insert_bot(dn); - break; + if ((is_standby_replay && dn->get_linkage()->inode && + dn->get_linkage()->inode->item_open_file.is_on_list())) { + dout(20) << "unexpirable: " << *dn << dendl; + unexpirables.push_back(dn); } else if (trim_dentry(dn, expiremap)) { unexpirables.push_back(dn); } else { @@ -7463,69 +7475,42 @@ void MDCache::try_trim_non_auth_subtree(CDir *dir) void MDCache::standby_trim_segment(LogSegment *ls) { - auto try_trim_inode = [this](CInode *in) { - if (in->get_num_ref() == 0 && - !in->item_open_file.is_on_list() && - in->parent != NULL && - in->parent->get_num_ref() == 0){ - touch_dentry_bottom(in->parent); - } - }; - - auto try_trim_dentry = [this](CDentry *dn) { - if (dn->get_num_ref() > 0) - return; - auto in = dn->get_linkage()->inode; - if(in && in->item_open_file.is_on_list()) - return; - touch_dentry_bottom(dn); - }; - ls->new_dirfrags.clear_list(); ls->open_files.clear_list(); while (!ls->dirty_dirfrags.empty()) { CDir *dir = ls->dirty_dirfrags.front(); dir->mark_clean(); - if (dir->inode) - try_trim_inode(dir->inode); } while (!ls->dirty_inodes.empty()) { CInode *in = ls->dirty_inodes.front(); in->mark_clean(); - try_trim_inode(in); } while (!ls->dirty_dentries.empty()) { CDentry *dn = ls->dirty_dentries.front(); dn->mark_clean(); - try_trim_dentry(dn); } while (!ls->dirty_parent_inodes.empty()) { CInode *in = ls->dirty_parent_inodes.front(); in->clear_dirty_parent(); - try_trim_inode(in); } while (!ls->dirty_dirfrag_dir.empty()) { CInode *in = ls->dirty_dirfrag_dir.front(); in->filelock.remove_dirty(); - try_trim_inode(in); } while (!ls->dirty_dirfrag_nest.empty()) { CInode *in = ls->dirty_dirfrag_nest.front(); in->nestlock.remove_dirty(); - try_trim_inode(in); } while (!ls->dirty_dirfrag_dirfragtree.empty()) { CInode *in = ls->dirty_dirfrag_dirfragtree.front(); in->dirfragtreelock.remove_dirty(); - try_trim_inode(in); } while (!ls->truncating_inodes.empty()) { auto it = ls->truncating_inodes.begin(); CInode *in = *it; ls->truncating_inodes.erase(it); in->put(CInode::PIN_TRUNCATING); - try_trim_inode(in); } } @@ -9897,6 +9882,12 @@ void MDCache::request_cleanup(MDRequestRef& mdr) // remove from map active_requests.erase(mdr->reqid); + // queue next replay op? + if (mdr->is_queued_for_replay() && !mdr->get_queued_next_replay_op()) { + mdr->set_queued_next_replay_op(); + mds->queue_one_replay(); + } + if (mds->logger) log_stat(); @@ -13444,6 +13435,12 @@ bool MDCache::dump_inode(Formatter *f, uint64_t number) { return true; } +void MDCache::dump_dir(Formatter *f, CDir *dir, bool dentry_dump) { + f->open_object_section("dir"); + dir->dump(f, dentry_dump ? CDir::DUMP_ALL : CDir::DUMP_DEFAULT); + f->close_section(); +} + void MDCache::handle_mdsmap(const MDSMap &mdsmap, const MDSMap &oldmap) { const mds_rank_t max_mds = mdsmap.get_max_mds(); @@ -13506,7 +13503,7 @@ void MDCache::upkeep_main(void) if (active_with_clients) { trim_client_leases(); } - if (is_open()) { + if (is_open() || mds->is_standby_replay()) { trim(); } if (active_with_clients) { |